function main_linker_on(ref,page) {
	document.getElementById(ref).className='main_links_on_'+page;
	document.getElementById(ref).style.cursor='pointer';
}
function main_linker(ref) {
	//if (whichpage!=ref) 
	document.getElementById(ref).className='main_links';
}
function checkemail(email,error) {
	emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(email))) { 
       error+= "The email address you have entered does not appear to be a valid one.\n";
    }
    else {
	//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (email.match(illegalChars)) {
          error+= "The email address contains illegal characters.\n";
       }
    }
    return error;
}
function validate_contact_form(theForm) {
	name=theForm.name.value;
	email=theForm.email.value;
	message=theForm.message.value;
	error="";
	if (name=="") error+="Name is required.\n";
	if (email!="") {
		error=checkemail(email,error);
    } else error+="Email address is required.\n";
	if (message=="") error+="You did not type a message.\n";
    if (error!="") {
    	alert(error);
    	return false;
    }
    return true;
}
function validate_jobs_form(theForm) {
	name=theForm.name.value;
	position=theForm.position.value;
	email=theForm.email.value;
	citizen=theForm.citizen.checked;
	error="";
	if (name=="") error+="Name is required.\n";
	if (position=="") error+="Please tell us the position you are interested in.\n";
	if (email!="") {
		error=checkemail(email,error);
    } else error+="Email address is required.\n";
	if (citizen==false) error+="You must be a UK citizen to apply for this job.\n";
    if (error!="") {
    	alert(error);
    	return false;
    }
    return true;
}
function validate_praise_report(theForm) {
	name=theForm.name.value;
	county=theForm.county.value;
	country=theForm.country.value;
	email=theForm.email.value;
	message=theForm.message.value;
	error="";
	if (name=="") error+="Name is required.\n";
	if (county=="") error+="County is required.\n";
	if (country=="") error+="Country is required.\n";
	if (email!="") {
		error=checkemail(email,error);
    } else error+="Email address is required.\n";
	if (message=="") {
		error+="You did not type a message in the text box.\n";
	}
    if (error!="") {
    	alert(error);
    	return false;
    }
    return true;
}
function validate_newsletter_form(theForm) {
	firstname=theForm.firstname.value;
	lastname=theForm.lastname.value;
	address1=theForm.lastname.value;
	town=theForm.town.value;
	county=theForm.county.value;
	postcode=theForm.postcode.value;
	country=theForm.country.value;
	telephone=theForm.telephone.value;
	email=theForm.email.value;
	$add_email=false; $add_post=false;
	if (theForm.add_email.checked==true) $add_email=true;
	if (theForm.add_post.checked==true) $add_post=true;
	error="";
	if (firstname=="") error+="First name is required.\n";
	if (lastname=="") error+="Last name is required.\n";
	if ($add_post) {
		if (address1=="") error+="Address line 1 is required.\n";
		if (town=="") error+="Town is required.\n";
		if (county=="") error+="County/province is required.\n";
		if (postcode=="") error+="Postcode is required. If you live in region without postcodes, please type 'NA'.\n";
		if (country=="") error+="Country is required.\n";
	}
	if (email!="") {
		error+=checkemail(email,error);
    } else error+="Email address is required.\n";
    if (error!="") {
    	alert(error);
    	return false;
    }
    return true;
}
function validate_free_offer_form(theForm) {
	firstname=theForm.firstname.value;
	lastname=theForm.lastname.value;
	address1=theForm.lastname.value;
	town=theForm.town.value;
	county=theForm.county.value;
	postcode=theForm.postcode.value;
	country=theForm.country.value;
	telephone=theForm.telephone.value;
	email=theForm.email.value;
	error="";
	if (firstname=="") error+="First name is required.\n";
	if (lastname=="") error+="Last name is required.\n";
	if (address1=="") error+="Address line 1 is required.\n";
	if (town=="") error+="Town is required.\n";
	if (county=="") error+="County/province is required.\n";
	if (postcode=="") error+="Postcode is required. If you live in region without postcodes, please type 'NA'.\n";
	if (country=="") error+="Country is required.\n";
	if (telephone=="") error+="Telephone is required.\n";
	if (email!="") {
		error+=checkemail(email,error);
    }
    if (error!="") {
    	alert(error);
    	return false;
    }
    return true;
}