/*
Rotates Images
*/
var bannerImg = new Array();
  bannerImg[0]="../images/contact/map1.gif";
  bannerImg[1]="../images/contact/map2.gif";
  bannerImg[2]="../images/contact/map3.gif";

var newBanner = 0;
var totalBan = bannerImg.length;

function cycleBan() {
  newBanner++;
  if (newBanner == totalBan) {
    newBanner = 0;
  }
  document.getElementById("mapImage").src=bannerImg[newBanner];
  setTimeout("cycleBan()", 8*1000);
}
//window.onload=cycleBan;
/*
Opens target="_blank" windows;
*/
function externalLinks() {
	cycleBan();
 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].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;
	  	}
	}
}
