  /* crossarrow - www.crossarrow.co.uk */
	
	
/* JAVASCRIPT STARTS HERE */


//Validation for Contact Us form

			function validateFirstName(myForm) 
			{
//Test to check Family Name is just letters.  Uses regular 
//expression below to test pattern and puts up alert box if incorrect.
			reFirstName = /^(\D+)$/
			if (reFirstName.test(myForm))
				return true;
						 else
        return false;
			}
						
			function validateSurname(myForm) 
			{
//Test to check Surname is just letters.  Uses regular 
//expression below to test pattern and puts up alert box if incorrect.
			reSurname = /^(\D+)$/
			if (reSurname.test(myForm))
				return true;
						 else
        return false;
			}
			
			
			function validateEmail(myForm) 
			{
//Test to check Email address input is correct.  Uses regular 
//expression below to test pattern and puts up alert box if incorrect.
			reEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
			if (reEmail.test(myForm))
				return true;
						 else
        return false;
				}

			
// ALERT BOX FORM VALIDATIONS: The function is called from the form, which 
//then calls the appropriate validation functions. If false an alert appears.
// First is the family Name followed by Phone Number then Email address.

			function validateForm(myForm) 
			{
			if (validateFirstName(myForm.FirstName.value) == false) 
			{
				 alert("Please enter your first name.");
				 							 myForm.FirstName.focus();
				 							 myForm.FirstName.select();
			return false;
		}
		
			 
			if (validateSurname(myForm.Surname.value) == false) 
			{
				 alert("Please enter your surname.");
				 							 myForm.Surname.focus();
				 							 myForm.Surname.select();
			return false;
		}
			
											
			if (validateEmail(myForm.Email.value) == false) 
			{
				 alert("Sorry your email address does not seem right!  please try again.");
				 							myForm.Email.focus();
				 							myForm.Email.select();
			return false;
		}
		   
			return true;
}

/* Start header image rotation */

function headerimage() {
images = new Array(6);
					images[0] = "<img src='images/header_bg_1.jpg' alt='The website of Christ Church Stock'></a>";
					images[1] = "<img src='images/header_bg_2.jpg' alt='The website of Christ Church Stock'></a>";
					images[2] = "<img src='images/header_bg_3.jpg' alt='The website of Christ Church Stock'></a>";
					images[3] = "<img src='images/header_bg_4.jpg' alt='The website of Christ Church Stock'></a>";
					images[4] = "<img src='images/header_bg_5.jpg' alt='The website of Christ Church Stock'></a>";
					images[5] = "<img src='images/header_bg_6.jpg' alt='The website of Christ Church Stock'></a>";
					index = Math.floor(Math.random() * images.length);
				document.write(images[index]);
}
			// -->




/* JAVASCRIPT ENDS HERE */
