// JavaScript Document


function contactus(theForm) {
	var errormess = "";
	var theValue;
	theValue = document.forms[theForm].elements['fname_g'].value;
	if (alltrim(theValue) == "") {
			errormess += "Guests christian name.\n\n";
	}
	
	theValue = document.forms[theForm].elements['lname_g'].value;
	if (alltrim(theValue) == "") {
			errormess += "Guests surname.\n\n";
	}
	
	theValue = document.forms[theForm].elements['dob_g'].value;
	if (alltrim(theValue) == "") {
			errormess += "Guests date of birth or age.\n\n";
	}
	
	theValue = document.forms[theForm].elements['fname_c'].value;
	if (alltrim(theValue) == "") {
			errormess += "Carer or helpers christian name.\n\n";
	}
	
	theValue = document.forms[theForm].elements['lname_c'].value;
	if (alltrim(theValue) == "") {
			errormess += "Carer or helpers surname.\n\n";
	}
	
	theValue = document.forms[theForm].elements['dates_h'].value;
	if (alltrim(theValue) == "") {
			errormess += "Holiday date.\n\n";
	}
	



//contact details
theValue = document.forms[theForm].elements['address'].value + document.forms[theForm].elements['telephone'].value + document.forms[theForm].elements['email'].value;
	if (alltrim(theValue) == "") {
			errormess += "Please give us a telephone number, E:mail or postal address so we can contact you.\n\n";
	}
	
	
	
	
	
	theValue = document.forms[theForm].elements['email'].value;
	if (alltrim(theValue) !== "") {
		if (!isValidEmail(alltrim(theValue))) {
			errormess += "Your E:mail address is not correct.\n\n";
		}
	}
	
	theValue = document.forms[theForm].elements['strCAPTCHA'].value;
	if (alltrim(theValue) == "") {
			errormess += "Please enter the code number.\nThis helps prevent automated submissions.\n\n";
	}
	
	if (errormess) {
		alert("Please check your booking form.\n\n" + errormess);
		return;
	}
	else { 
		document.getElementById(theForm).submit();
		
	}


}// end saveBrandForm



