/*Changes the images boxes on the front page */
if (document.images)
{
	preload_image = new Image(236,130); 
	preload_image.src="style/box_hover.gif"; 
}
function changeBox(myName, changeTo)
{	
	if(changeTo=='orange')
	{
		document.getElementById(myName).style.backgroundImage = "url(style/box_hover.gif)";
	}
	else
	{
		document.getElementById(myName).style.backgroundImage = "url(style/box.gif)";
	}	
}
/*
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 openBrWindow2(theURL,winName,features) { //v2.0

  var theURL = '/spinball/spinball.html';
  var winName = 'flashwindow';
  var winl = (screen.width - 550) / 2;
  var wint = (screen.height - 300) / 2;
  features = 'width=550,height=300,top='+wint+',left='+winl+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no'
  openit=window.open(theURL,winName,features);
  openit.focus();
}
/*
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].p_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);
  		p_name.focus();
  		return false;
	  	}
	}
}
