// This script applies a class to all external links
function linkinOut(){
  //var serverone = document.location.hostname;
  var serverone = "stetsonbuildingproducts.com";
  // Enter an additional domain that you *don't* want in new windows here 
  var servertwo = "php1.secure-shopping.com";
  var serverthree = "67.41.55.79";
  var serverfour = "stetsons.com";
  
  if (!document.getElementsByTagName) return null;
  var anchors = document.getElementsByTagName("a");
  //alert("There are " + anchors.length + " links in this document.");
  for(var i=0; i < anchors.length; i++){
    var a = anchors[i];
    var href = a.href;
	var thistitle = a.title;
	var thisclass = a.className;

    if ((href.indexOf("http") != -1) && (href.indexOf(serverone) == -1) && (href.indexOf(servertwo) == -1) && (href.indexOf(serverthree) == -1) && (href.indexOf(serverfour) == -1)) {  
	  	  if(thisclass !== ""){
				thisclass = thisclass + " ";
		  }
		  a.className = thisclass + "external";
		  if(thistitle !== ""){
				thistitle = thistitle + " ";
		  }
		  a.title = thistitle + "(This link will open in a new window)";
		  a.target = "_blank";
    }
  }
}
window.onload = function(){
  linkinOut();
}