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;

// pop-up function
var newWin = null;
function closeWin(){
        if (newWin != null){
                if(!newWin.closed)
                        newWin.close();
        }
}

function perfect_popUp(strURL,strType,strHeight,strWidth) {
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") 	strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;

	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}

function validate(){
	missinginfo = "";
	if (document.forms["infoForm"].Contact_Name.value == "") {
		missinginfo += "\n   -  Contact Name";
	}
	if (document.forms["infoForm"].Company_Name.value == "") {
		missinginfo += "\n   -  Company Name";
	}
	if (document.forms["infoForm"].Company_Address.value == "") {
		missinginfo += "\n   -  Company Address";
	}
		if (document.forms["infoForm"].Country.value == "") {
		missinginfo += "\n   -  Country";
	}
	if (document.forms["infoForm"].Telephone.value == "") {
		missinginfo += "\n   -  Phone Number";
	}
	if ((document.forms["infoForm"].Email.value == "") ||
		(document.forms["infoForm"].Email.value.indexOf('@') == -1) ||
		(document.forms["infoForm"].Email.value.indexOf('.') == -1)) {
			missinginfo += "\n   -  Email Address";
	}

	if (missinginfo != "") {
		missinginfo ="_____________________________\n" +
		"You failed to correctly fill in your:\n" +
		missinginfo + "\n_____________________________" +
		"\nPlease re-enter and submit again!";
		alert(missinginfo);
		return false;
	}
	else return true;
}
