if (document.images)
{
	// "On" images
	// Fiesta Side Panel
	imgSidePanelon = new Image();
	imgSidePanelon.src = "images/Fiesta/SidePanel/SidePanelOn.jpg";
	// Fiesta Spoiler
	imgSpoileron = new Image();
	imgSpoileron.src = "images/Fiesta/Spoiler/SpoilerOn.jpg";
	// Fiesta
	imgFiestaon = new Image();
	imgFiestaon.src = "images/Fiesta/Fiesta/FiestaOn.jpg";
	// Bumper
	imgBumperon = new Image();
	imgBumperon.src = "images/Fiesta/Bumper/BumperOn.jpg";
	/*
	// Links
	imgLinkson = new Image();
	imgLinkson.src = "images/buttons/links_red.gif";
	// Contact
	imgContacton = new Image();
	imgContacton.src = "images/buttons/contact_red.gif";
	*/
	
	// "Off" images
	// Fiesta Side Panel
	imgSidePaneloff = new Image();
	imgSidePaneloff.src = "images/Fiesta/SidePanel/SidePanelOff.jpg";
	// Fiesta Spoiler
	imgSpoileroff = new Image();
	imgSpoileroff.src = "images/Fiesta/Spoiler/SpoilerOff.jpg";
	// Fiesta
	imgFiestaoff = new Image();
	imgFiestaoff.src = "images/Fiesta/Fiesta/FiestaOff.jpg";
	// Bumper
	imgBumperoff = new Image();
	imgBumperoff.src = "images/Fiesta/Bumper/BumperOff.jpg";
	/*
	// Links
	imgLinksoff = new Image();
	imgLinksoff.src = "images/buttons/links_blue.gif";
	// Contact
	imgContactoff = new Image();
	imgContactoff.src = "images/buttons/contact_blue.gif";
	*/
}


function imgOn (imgName)
{
	if (document.images)
	{			
		document.images[imgName].src = eval (imgName + "on.src");
	} 
}

function imgOff (imgName)
{
	if (document.images)
	{
		document.images[imgName].src = eval (imgName + "off.src");
	}		 
}



function emailCheck(form)
{
	var emailFilter =/^.+@.+\..{2,3}$/;
	var illegalEmailChars = /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
	illegalChars = /[\W_]/; /* Only allow Letters and Numbers */
		
	var name = form.Name_.value;
	var e_mail_address = form.E_Mail_.value;
	var check = 1;

	if (name == "")
	{
		alert("No Name has been submitted!");
		form.Name_.focus();
		check = 0;	
	}
	
	else if (e_mail_address == "")
	{
		alert("E-Mail address field is empty!");
		form.E_Mail_.focus();
		check = 0;	
	}
	
	else if (!(emailFilter.test(e_mail_address)))
	{
		alert("Please enter a valid e-mail address!");
		form.E_Mail_.focus();
		check = 0;	
	}
	
	else if (e_mail_address.match(illegalEmailChars))
	{
		alert("The e-mail address contains illegal characters!");
		form.E_Mail_.focus();
		check = 0;	
	}	

	if (check == 1)
	{
		alert("Your enquiry has passed the validation process.\nand your enquiry will be submitted.");
		return true;
	}
	else
	{
		/* Don't send the message yet as it failed the check process */
		/* alert("Please correct your enquiry."); */
		return false;
	}	
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/* This function is used by the directions.htm page multimap link */
function map_confirm()
{
	var name=confirm("You have selected to open a new Browser window with Multimaps's web site.\nDo you wish to proceed?")
	if (name==true)
	{
		/* The code below opens a new window sized accordingly in the target web site */
		aWindow=window.open('http://www.multimap.com/maps/?hloc=GB|so304bg#t=l&map=50.91212,-1.32238|16|4&loc=GB:50.91212:-1.32238:16|so304bg|SO30 4BG', 'myWin','toolbar,status,resizable,scrollbars,width=700,height=600');		
	}
	else
	{
		/* Remain within the Finishing Touch's  web site location.htm page*/
	}
}

function greeting() 
{
	var d = new Date();
	var time = d.getHours();
	// alert("Start");
	// document.write(time);
	if (time < 10)
	{
		 //alert("Got here - 1");
		document.write("Good Morning, and welcome to ");
	}
	else if (time >= 10 && time < 13)
	{
		 //alert("Got here - 2");
		document.write("Good Day, and welcome to ");
	}
	else if (time >= 13 && time < 17)
	{
		 //alert("Got here - 3");
		document.write("Good Afternoon, and welcome to ")
	}
	else
	{
		// alert("Got here - 4")
		document.write("Good Evening and welcome to ");
	}
	// alert("end of greeting");
}

//Working! do not edit.


function startTime()
{
	// alert("startTime()");
	var today=new Date();
	var h=today.getHours();
	var m=today.getMinutes();
	var s=today.getSeconds();
	// add a zero in front of numbers<10
	m=checkTime(m);
	s=checkTime(s);
	document.getElementById("txt").innerHTML=h+":"+m+":"+s;
	t=setTimeout('startTime()',500);
}

function checkTime(i)
{
	if (i<10)
	{
	  //alert("checkTime()");
	  i="0" + i;
	}
	return i;
}

function wipe_default(id, val) 
{
	// var myString = "checkTime() called with val: " + val + " id: " + id;
	// alert(myString);
	
	var t=window.get(id);
	alert("Got here");
	myString1 = "checkTime() called with t.value: " + t.value + " id: " + id;
	alert(myString1);	
	if(t.value==val)
	{
		myString2 = "checkTime() called with t.value: " + t.value + " val: " + val;
		alert(myString2);
		t.value='';
	}
	return true;
}

