function openPopup()
{
	newwin = window.open("popup.html","popup","width=400,height=350,scrollbars=no");
}
function ImageThumbnailsGranville(imageID){
	newwin = window.open("granville_thumbnail.html?image=" + imageID,"aerialview","width=708,height=540,scrollbars=no");
}
function ImageThumbnailsOther(imageID){
	newwin = window.open("other_thumbnail.html?image=" + imageID,"aerialview","width=708,height=540,scrollbars=no");
}
function ImageThumbnailsRail(imageID){
	newwin = window.open("rail_thumbnail.html?image=" + imageID,"aerialview","width=708,height=540,scrollbars=no");
}
function ImageThumbnailsGal(imageID){
	newwin = window.open("post_thumbnail.html?image=" + imageID,"aerialview","width=708,height=540,scrollbars=no");
}
function navOver(imgName)
{
	var theImage = document.getElementById(imgName);
	
	if(theImage.src.indexOf("_off.gif") != -1)
	{
		theImage.src = theImage.src.replace("_off.gif","_over.gif");
	}
	else if(theImage.src.indexOf("_on.gif") != -1)
	{
		theImage.src = theImage.src.replace("_on.gif","_off.gif");
	}
	else
	{
		theImage.src = theImage.src.replace("_over.gif","_off.gif");
	}
}
function navDown(imgName)
{
	var theImage = document.getElementById(imgName);
	
	if(theImage.src.indexOf("_over.gif") != -1)
	{
		theImage.src = theImage.src.replace("_over.gif","_on.gif");	
	}
}


function getDealerLocation(state){
	
	var dealerElement = document.getElementById("dealerAddress");
	
}

function validateForm(theForm)
{
	valid = true;
	message = "So we can deal with your enquiry: \n\n";
	if(theForm.elements["firstname"].value == "")
	{
		message += "  Please enter your first name\n";
		valid = false;
	}
	if(theForm.elements["lastname"].value == "")
	{
		message += "  Please enter your last name\n";
		valid = false;
	}
	if(theForm.elements["phone"].value == "")
	{
		message += "  Please enter your phone number\n";
		valid = false;
	}
	
	var supEmail = theForm.elements["email"].value;
	var emLen = supEmail.length;
	var posAt = supEmail.indexOf('@')
	var posDot = supEmail.lastIndexOf('.')
	if((emLen < 7) || (posAt < 1) || (posDot <= (posAt + 1)) || (posDot >= (emLen - 1)))
	{
		message += "  Please enter a valid email address\n";
		valid = false;
	}
	if(valid)
	{
		return true;
	}
	else
	{
		alert(message);
		//createCustomAlert(message);
		return false;
	}
}



