 
	/*
	
	Site: http://www.manderstam.com
	Filename: validate.js
	Requires: contact.html
	Creation date: 11th July 2004
	Author: Alex Beston, deltaTraffic
	
	Description: This script analyses the form contents and returns false for empty fields 
	and true if all fields are filled out: user is disallowed from sending the form until something 
	is provided 
	The cursor is focussed to the relevant field and an error message is given to the user. 
	
	Further Development: Add elements[n] for extra fields to customise the form validation.
	
	 */
	
	
	function validateContactForm(){   		
		// check 4 parameters
		var name = document.forms[0].elements[0];
		var phone = document.forms[0].elements[1]; 
		var email = document.forms[0].elements[2];
		var details = document.forms[0].elements[3];
	 
	 
		// check user name
	if (name.value==""){
		alert("Please enter your name");
		 name.focus();
		return false ;
		}  
	 
/*	if(services.selectedIndex=="0"){
		 alert("Please choose a service");
		 services.focus();
		return false ;
		 
	} */
		// check email address
	if ( email.value=="" && phone.value=="")   {
      alert( "Please add either a email or phone number otherwise we wont be able to contact you!" );
      email.focus();
      return false ;
     } 
	
	if (details.value==""){
		 alert("Please give us an idea of what you want us to consult for ...");
		 details.focus();
		return false ;
		}
		
	 
	return true; // everything's ok - user is allowed to send his message.
	}
	
	
	 
	 
