function newImage( imgSrc ){

 var imgName = new Image();
 imgName.src = imgSrc;

 return imgName;

}

function change( imgName, imgLocation )
{
 document[imgName].src = imgLocation ;
}

var preloadFlag = false;
function loadImages()
{
 if (document.images)
 {
 //****Edit this list to include rollover state images ****
 //****Example: aboutus_over = newImage( "images/aboutus-over.gif" );
 nav_left = newImage("images/top-nav-left-on.gif");
 nav_right = newImage("images/top-nav-right-on.gif");
 nav_both = newImage("images/top-nav-on.gif");
 preloadFlag = true;
 }
}


/*THIS IS THE VALIDATION FOR THE LEAD FORM*/
function ValidateContact(form)
{
	if (document.contact.realname.value=="")
	{
	alert("Please enter your Name.");
	document.contact.realname.focus();
	return false;
	}

	if (document.contact.Company.value=="")
	{
	alert("Please enter your Company Name.");
	document.contact.Company.focus();
	return false;
	}
	
	if(!check_email(document.contact.email.value))
	{
	    alert("Please make sure your Email Address is Correct");
		document.contact.email.focus();
		return false;
	}

	if (document.contact.Comments.value=="")
	{
	alert("Please let us know why you would like for us to contact you.");
	document.contact.Comments.focus();
	return false;
	}
	//alert("Worked"); 
	//return false;
	return true;
}


function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0) return (false);	
	}
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) return (-1);
	}
}
