
/*
Opens target="_blank" windows;
*/
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;
/*
Open Browser Window for Spinball
*/
function openProductWindow(theURL,winName) {
	
  var winl = (screen.width - 770) / 2;
  var wint = (screen.height - 550) / 2;
  features = 'width=770,height=550,top='+wint+',left='+winl+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no';
  //alert(theURL);
  /*
  openit=window.open(theURL,winName,features);
  openit.focus();*/
  
  myRef = window.open(theURL,'mywin','left=20,top=20,width=650,height=500,toolbar=0,resizable=0,scrollbars=1');

}
/*
Validate the form
*/

/* Form Validation
*Checks the regular Expression for the field email
*allows letters, numbers, dashes, and dots before the @
*domain and endings after the @
*/
function validate_email()
{	
	var emailRE  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var x = document.forms[0].email.value;
	if (!emailRE.test(x))
  		{return false}
		else {return true}
}
/* Form Validation
*calls the upper 3 functions
*/
function validate_form(thisform)
{
	var myErrorList = "";
	with (thisform)
	{
		if (validate_email()==false)
  		{myErrorList += "\n Email "}
  		if(myErrorList != "")
  		{var myErrorMessage = "Following fields were not filled out correctly: " + myErrorList + "!"
  		alert(myErrorMessage);
  		document.forms[0].name.focus();
  		return false;
	  	}
	}
}
