////////// Image changer for rollover images on the menu. ////////////
/////////////////////////////////////////////////////////////////////
function imgchange(thatpic)
{
	if (document.images)
	{
		document.images[thatpic].src= eval(thatpic + "_new.src");
	}
}
function change_back(thatpic)
{
	if (document.images)
	{
		document.images[thatpic].src= eval(thatpic + "_init.src");
	}
}

// Contact info validation
// function to check email format
function isEmailAddr(email)
	{
	  var result = false
	  var theStr = new String(email)
	  var index = theStr.indexOf("@");
	 if (index > 0)
	  {
	    var pindex = theStr.indexOf(".",index);
	    if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
	  }
	  return result;
	}
// end

function validateForm(form) { //This is the name of the function

	if (form.Name.value == "") {
		alert("Please enter your name."); 
		form.Name.focus( ); 
		return false; 
		}

	if (form.Email.value == "") {
		alert("Please provide your email address so we can contact you."); 
		form.Email.focus( ); 
		return false; 
		}

// add email validation to check format 
	if (!isEmailAddr(form.Email.value))
		{
		alert("Please check the format of your email address. Please use the form: yourname@yourdomain.com");
		form.Email.focus();
		return false;
		}
		     
	if (form.OpenHouse.selectedIndex == 0) {
		alert("Please let us know if you plan to attend our next open house."); 
		form.OpenHouse.focus( ); 
		return false; 
		}

}

///////////////////////////////////////////////////////
////////// Pop up window for small images ////////////
//////////////////////////////////////////////////////

var newwindow;
	function popimg(url)
	{
		newwindow=window.open(url,'img','height=500,width=500,scrollbars=no');
		if (window.focus) {newwindow.focus()}
	}