//use the following var to remember an image's original src value
//the imageRoll function will constantly update this value, allowing the imageOut function to use its current value
var imageSourceValue = '';
function imageRoll(imageObject)
{
	//store the current src value
	imageSourceValue = imageObject.src;
	//grab the directory from the src attribute
	var folderIndex = imageObject.src.lastIndexOf("/");
	var theDirectory = imageObject.src.substring(0,folderIndex+1);//returns the DIR in the form http://domain.com/folder
	//test for image file type, jpg v. gif
	var theFileType = imageObject.src.substring(imageObject.src.length-3);//grab the last 3 characters, they represent the file type

	imageObject.src=theDirectory+imageObject.name+'-on.'+theFileType;
}
function imageOut(imageObject)
{
	//retrieve the original image src attribute
	imageObject.src = imageSourceValue;
}
/******************************/
var popUpWin = 0;
function newWindow(page){
	if(popUpWin){popUpWin.close();}
  popUpWin=window.open(page,"popWindow","status=1,width=620,height=430")
 popUpWin.focus()
}
/******************************/
function popEnews()
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open('enews.cfm?email='+document.forms[0].signup_email.value, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=0,resizable=0,copyhistory=yes,width=450,height=500,left=10, top=10,screenX=10,screenY=10');
}
/******************************/
function loadEnews()
{
  document.location.replace('/enews.cfm?email='+document.forms[0].signup_email.value);
}
// Begin email checker
function emailCheck() {

	var re = new RegExp("^[A-Za-z0-9_-]+[A-Za-z0-9_\.\-]*[A-Za-z0-9_-]+@[A-Za-z0-9_-]+[A-Za-z0-9\.-]*\\.[a-zA-Z]{2,4}$","i");

	if(!re.test(document.form1.email.value))
	{alert('Please enter a valid email address.');}


	//test for required fields
	else if(document.form1.name.value == ""){alert("Please enter your name.");}
	else if(document.form1.zip.value == ""){alert("Please enter your zip code.");}
	
	
	else{document.form1.submit();}
}