// External Links

function externalLinks() {

 if (!document.getElementsByTagName) return;

 var anchors = document.getElementsByTagName("a");

 for (var i=0; i<anchors.length; i++) {

   var anchor = anchors[i];

   if (anchor.getAttribute("href") &&

       anchor.getAttribute("rel") == "external")

     anchor.target = "_blank";

 }

}

window.onload = externalLinks;

// SUCKERFISH Single-level Dropdowns SCRIPT (http://www.htmldog.com/articles/suckerfish/dropdowns/)
// -----------------------------------------------------------------------

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/* CODE CAUSING ERROR IN EDITOR...COMMENTED OUT TO FIX

sfHoverUtility = function() {
	var sfEls = document.getElementById("utility").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHoverUtility);

*/

// Open external links in new windows
	$('a[href^="http://"], a[href^="https://"]')
	.not('[href*="orthosesame.com"],[href*="sesameinteractive.com"], a[href$=".doc"], a[href$=".pdf"], [href*="gorthodontics.com"],[href*="pearlandortho.com"]')
	.addClass('external').attr('target', '_blank');

