function fixExitLinks(){
    var myLinks = document.links;
    var btype=0;
    if (window.attachEvent) {
        b=1;
    } else if (window.addEventListener) {
        b=2;
    }
	// run the regular script
    for(var i=0;i < myLinks.length;i++) {
        var thehref = myLinks[i].href.toString();
        if(thehref.indexOf("intellidriveusa.org") == -1){
            switch (b) {
                case 1:
                    myLinks[i].attachEvent("onclick",confirmExit);
					myLinks[i].className = "external";
                    break;
                case 2:
                    myLinks[i].setAttribute("onclick","return confirmExit()")
					myLinks[i].className = "external";
                    break;
                default:
                    //do nothing
            }
        }
    }
	// break the script for mailto links
	for(var i=0;i < myLinks.length;i++) {
        var thehref = myLinks[i].href.toString();
        if(thehref.indexOf("mailto:") == 0){
            switch (b) {
                case 1:
                    myLinks[i].detachEvent("onclick",confirmExit);
					myLinks[i].className = "";
                    break;
                case 2:
                    myLinks[i].removeAttribute("onclick","return confirmExit()")
					myLinks[i].className = "";
                    break;
                default:
                    //do nothing
            }
        }
    }
	
	
}

function confirmExit () {
if(confirm('Thank you for visiting.\n\nYou are now leaving the Intellidrive website. Our website has many links to other organizations.\n\nWhile we offer these electronic linkages for your convenience in accessing transportation-related information, please be aware that when you exit our website, the privacy and accessibility policies stated on our website may not be the same as that on other websites. If you have any questions or comments, please email us. ')){
    return true;
  } else {
      return false;
  }
}