function clearForm() {
	if(search_form.area.value=='Postcode'){
		search_form.area.value='';
	}
}
function search_form_text_click(textinput) {
	if(textinput.name=='search' && textinput.value=='What?') { textinput.value=''; }
	else if(textinput.name=='search_name' && textinput.value=='or Who?') { textinput.value=''; }
	else if(textinput.name=='area' && textinput.value=='Postcode') { textinput.value=''; }
}
function check_feedback_form() {
	var error = '';
	var emailregex = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;		
	var firstname = document.feedback_form.firstname.value;
	var surname = document.feedback_form.surname.value;
	var email = document.feedback_form.email.value;
	var suggestion = document.feedback_form.suggestion.value;

	if(firstname == ''){error = error + "You must enter a first name\n";}
	if(surname == ''){error = error + "You must enter a surname\n";}
	if(email == ''){error = error + "You must enter an e-mail address\n";}
	if(!email.match(emailregex)){error = error + "You must enter a valid e-mail address\n";}
	if(suggestion == ''){error = error + "You must enter a suggestion\n";}
	if(error != ''){
		alert(error);
		return false;
	}else{
		return true;
	}
}
function fv_sign_up_basic() {
	var error = '';
	var company_phone = document.sign_up_form.company_phone.value;
	var phone_regex = /^[0-9+(]?[0-9( -)]*?$/;
	if(company_phone == ''){error = error + "You must enter a phone number\n";}
	if(!company_phone.match(phone_regex)){error = error + "You must enter a valid phone number\n";}
	if(error != ''){
		alert(error);
		return false;
	}else{
		return true;
	}
}
function fv_sign_up_phone_search() {
	var error = '';
	var company_postcode_r = document.sign_up_form.company_postcode_r.value;
	var company_postcode_l = document.sign_up_form.company_postcode_l.value;
	var postcode_r_regex = /^[a-zA-Z]{1,2}[0-9]{1,2}[a-zA-Z]?$/;
	var postcode_l_regex = /^[0-9]{1}[a-zA-Z]{2}$/;
	if(company_postcode_r == ''){error = error + "You must enter a postcode region\n";}
	if(!company_postcode_r.match(postcode_r_regex)){error = error + "You must enter a valid postcode region\n";}
	if(company_postcode_l == ''){error = error + "You must enter a postcode localiser\n";}
	if(!company_postcode_l.match(postcode_l_regex)){error = error + "You must enter a valid postcode localiser\n";}
	if(error != ''){
		alert(error);
		return false;
	}else{
		return true;
	}
}
function fv_sign_up_add_mod(){
	var error = '';

	var company_phone = document.sign_up_form.company_phone.value;
	var phone_regex = /^[0-9\+(]?[0-9( -)]*?$/;
	if(company_phone == ''){error = error + "You must enter a phone number\n";}
	if(!company_phone.match(phone_regex)){error = error + "You must enter a valid phone number\n";}

	var uk_biz_check = document.sign_up_form.uk_biz_check.value;
	if(uk_biz_check == 1){
		var company_postcode_r = document.sign_up_form.company_postcode_r.value;
		var postcode_r_regex = /^[a-zA-Z]{1,2}[0-9]{1,2}[a-zA-Z]?$/;
		if(company_postcode_r == ''){error = error + "You must enter a postcode region\n";}
		if(!company_postcode_r.match(postcode_r_regex)){error = error + "You must enter a valid postcode region\n";}

		var company_postcode_l = document.sign_up_form.company_postcode_l.value;
		var postcode_l_regex = /^[0-9]{1}[a-zA-Z]{2}$/;
		if(company_postcode_l == ''){error = error + "You must enter a postcode localiser\n";}
		if(!company_postcode_l.match(postcode_l_regex)){error = error + "You must enter a valid postcode localiser\n";}
	}

	var company_name = document.sign_up_form.company_name.value;
	var name_regex = /^[a-zA-Z0-9., '\!\&\(\)-]*?$/;
	if(company_name == ''){error = error + "You must enter a company name\n";}
	if(!company_name.match(name_regex)){error = error + "You must enter a valid company name\n";}

	var contact_name = document.sign_up_form.contact_name.value;
	var cname_regex = /^[a-zA-Z0-9., '-]*?$/;
	if(contact_name == ''){error = error + "You must enter a contact name\n";}
	if(!contact_name.match(cname_regex)){error = error + "You must enter a valid contact name\n";}

	var company_address = document.sign_up_form.company_address.value;
	var address_regex = /^[a-zA-Z0-9., '-]*?$/;
	if(company_address == ''){error = error + "You must enter a company address\n";}
	if(!company_address.match(address_regex)){error = error + "You must enter a valid company address\n";}

	var company_town = document.sign_up_form.company_town.value;
	var town_regex = /^[a-zA-Z. '-]*?$/;
	if(company_town == ''){error = error + "You must enter a company town\n";}
	if(!company_town.match(town_regex)){error = error + "You must enter a valid company town\n";}

	var company_mobile = document.sign_up_form.company_mobile.value;
	var mobile_regex = /^[0-9\+(]?[0-9( -)]*?$/;
	if(company_mobile != '' && !company_mobile.match(mobile_regex)){error = error + "You must enter a valid company mobile\n";}

	var company_fax = document.sign_up_form.company_fax.value;
	var fax_regex = /^[0-9\+(]?[0-9( -)]*?$/;
	if(company_fax != '' && !company_fax.match(fax_regex)){error = error + "You must enter a valid company fax\n";}

	var company_county = document.sign_up_form.company_county.value;
	var county_regex = /^[a-zA-Z '-]*?$/;
	if(company_county == ''){error = error + "You must enter a company county\n";}
	if(!company_county.match(county_regex)){error = error + "You must enter a valid company county\n";}

	var company_email = document.sign_up_form.company_email.value;
	var email_regex = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	if(company_email == ''){error = error + "You must enter a company email\n";}
	if(!company_email.match(email_regex)){error = error + "You must enter a valid company email\n";}

	if(error != ''){
		alert(error);
		return false;
	}else{
		return true;
	}
}


function max_link_length(link){
	if (link.length>37)
		{
			document.write('Click Here!')
		}
	else
		{
			document.write(link)
		}
}