// JavaScript Document
//Script for the validation of the callMe check box in the contact form
function checkNumber() {
	var callMe;
	callMe=document.contactForm.callMe.checked;
	if (callMe==true){
					alert("You have asked us to telephone you regarding your enquiry. Please ensure you have\n supplied the correct telephone number and that you indicate a suitable time for us\n to call you.");
	}
}


//function to swap images on mainNav onmouseover
var W3CDOM = (document.createElement && document.getElementsByTagName);

var mouseOvers = new Array();
var mouseOuts = new Array();

window.onload = init;

function init()
{
	if (!W3CDOM) return;
	var nav = document.getElementById('mainNav');
	var imgs = nav.getElementsByTagName('img');
	for (var i=0;i<imgs.length;i++)
	{
		imgs[i].onmouseover = mouseGoesOver;
		imgs[i].onmouseout = mouseGoesOut;
		var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
		mouseOuts[i] = new Image();
		mouseOuts[i].src = imgs[i].src;
		mouseOvers[i] = new Image();
		mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')) + "_omo" + suffix;
		imgs[i].number = i;
	}
}

function mouseGoesOver()
{
	this.src = mouseOvers[this.number].src;
}

function mouseGoesOut()
{
	this.src = mouseOuts[this.number].src;
}

//function to change enquiry form if subject is weddings
function formChange(subject) { 
	var weddingPage=subject.options[subject.selectedIndex].value; 
	var spaPage=subject.options[subject.selectedIndex].value; 
	if (weddingPage=="weddingContact.html") { 
		window.location.href=weddingPage; 
	}
	if (spaPage=="spacontact.html") {
		window.location.href=spaPage;
	}
}
