// validate contact us form
function validate_contact(f) {
	//check that name field is not blank
	if(f.your_name.value=="") {
		alert("You have not filled in your name");
		return false;
		f.your_name.focus;
	}
	
	//check that email field is not blank;
	if(f.your_email.value=="") {
		alert("Please fill in your email address");
		return false;
		f.your_email.focus;
	}
	
	//Telephone Contact MUST strictly be numbers
	if(isNaN(f.your_phone.value)) {
		alert('Telephone Contact MUST be numbers!');
		return false;
		f.your_phone.focus;
	}
	
	//make sure the user enquires about something
	if(f.enquiry_about[0].selected){
		alert("Please Select an enquiry");
		return false;
		f.enquiry_about.focus;
	}
	
	/**
	 *	make sure there is a corresponding
	 * 	product is enquiry is about product
	 **/
	 if(f.products[0].selected){
		alert("Please Select a Product");
		return false;
		f.products.focus;
	}
	
	//make sure there is an enquiry comment
	if(f.comments.value=="") {
		alert("Please type in your comment");
		return false;
		f.comment.focus;
	}
}




//-------------- validate the request quote form -----------------//
function request_quote(f) {
	//check that name field is not blank
	if(f.your_name.value=="") {
		alert("You have not filled in your name");
		return false;
		f.your_name.focus;
	}
	
	//check that email field is not blank;
	if(f.your_email.value=="") {
		alert("Please fill in your email address");
		return false;
		f.your_email.focus;
	}
	
	//phone number must not be blank
	if(f.your_phone.value=="") {
		alert ("Provide your phone Contacts");
		return false;
		f.your_phone.focus;
	}
	
	if(isNaN(f.your_phone.value)) {
		alert('Telephone Contact MUST be numbers!');
		return false;
		f.your_phone.focus;
	}
	
	//date of birth cannot be null
	if(f.your_dob.value=="") {
		alert("Please provide birth date")
		return false;
		f.your_dob.focus;
	}
	
	//residential area cannot be null
	if(f.your_residence.value=="") {
		alert('Please provide residential area');
		return false;
		f.your_residence.focus;
	}
	
	//products cannot be null
	if(f.products[0].selected){
		alert("Please Select a Product");
		return false;
		f.products.focus;
	}
	
	//make sure there is an enquiry comment
	if(f.comments.value=="") {
		alert("Please type in your comment");
		return false;
		f.comment.focus;
	}
	
	//one must enter the numbers shown
	if(f.rand_no.value=="") {
		alert ("Enter the numbers shown");
		return false;
		f.rand_no.focus;
	}
	
	//random numbers must be equal
	if(f.rand_no.value != f.rand_no2.value) {
		alert("You typed a wrong number, re-enter");
		return false;
		f.rand_no.focus;
	}
}


/********************* validating the download forms elements ***************/
function validate_download(f){
	//check that name field is not blank
	if(f.your_name.value=="") {
		alert("You have not filled in your name");
		return false;
		f.your_name.focus;
	}
	
	//check that email field is not blank;
	if(f.your_email.value=="") {
		alert("Please fill in your email address");
		return false;
		f.your_email.focus;
	}
	
	//phone number must not be blank
	if(f.your_phone.value=="") {
		alert ("Provide your phone Contacts");
		return false;
		f.your_phone.focus;
	}
	
	//Telephone Contact MUST strictly be numbers
	if(isNaN(f.your_phone.value)) {
		alert('Telephone Contact MUST be numbers!');
		return false;
		f.your_phone.focus;
	}
	
	//one must enter the numbers shown
	if(f.rand_no.value=="") {
		alert ("Enter the numbers shown");
		return false;
		f.rand_no.focus;
	}
	
	//random numbers must be equal
	if(f.rand_no.value != f.rand_no2.value) {
		alert("You typed a wrong number, re-enter");
		return false;
		f.rand_no.focus;
	}
	
	//now download the relevant forms
	//window.open (f.download_form_name.value, "_blank");
}
