/*  Encrypted Email Link  *////////////////////////////////////////////////////////////////////////////////

function displayEmail () {
var email_anchor_array = [70,73,78,65,78,67,69,64,83,77,69,69,85,82,79,46,67,79,77];
var email_link_array = [102,105,110,97,110,99,101,64,115,109,101,101,117,114,111,46,99,111,109];
var encrypted_link = ''; var encrypted_anchor = '';
for (var i=0; i<email_link_array.length; i++) { encrypted_link += String.fromCharCode (email_link_array[i]); }
for (var i=0; i<email_anchor_array.length; i++) { encrypted_anchor += String.fromCharCode(email_anchor_array[i]); }
document.write('<a href="mailto:' + encrypted_link + '" rel="nofollow">' + encrypted_anchor + '</a>')
}



/*  checkContactForm  *////////////////////////////////////////////////////////////////////////////////
function	 checkContactForm () { //document.write("HERE");

// place form data into variables (only checking for required fields)
var name = document.fContact.name.value;
var email = document.fContact.email.value;
var message = document.fContact.message.value;

// check name has been entered
if (name == "") {
	alert("Please enter your Full Name");
	document.fContact.name.focus();
	return false; } 

// check emails has been entered	
if (email == "") {
	alert("Please enter your Email Address.");
	document.fContact.email.focus();
	return false; 	} 

// check email is valid
var emailFilter=/^.+@.+\..+$/
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
// test structure of email address
if (!(emailFilter.test(email))) { alert("Please enter a valid email address"); document.fContact.email.focus(); return false;}
// check email contains no illegal characters
if (email.match(illegalChars)) {alert("Please enter a valid email address"); document.fContact.email.focus(); return false;}

// check message has been entered	
if (message == "") {
	alert("Please enter a Message.");
	document.fContact.message.focus();
	return false; } 
	
return true;
}




function mapHide () {
	document.getElementById('map').style.display = "none";
}

function mapShow () {
	document.getElementById('map').style.display = "block";
}




function showPartner (id) {
	document.getElementById('partner'+id).style.display = "block";
}




/*  checkSupplierForm  *////////////////////////////////////////////////////////////////////////////////
function	 checkSupplierForm () { //document.write("HERE");

// place form data into variables (only checking for required fields)
var name = document.fSupplier.name.value;
var business = document.fSupplier.business.value;
var address = document.fSupplier.address.value;
var postcode = document.fSupplier.postcode.value;
var phone = document.fSupplier.phone.value;
var email = document.fSupplier.email.value;
var trading = document.fSupplier.trading.value;
var name1 = document.fSupplier.name1.value;
var address1 = document.fSupplier.address1.value;
var postcode1 = document.fSupplier.postcode1.value;
var tnc = document.fSupplier.tnc.checked;

//document.write(tnc);

// check name has been entered
if (name == "") {
	alert("Please enter your full name");
	document.fSupplier.name.focus();
	return false; } 
	
// check business has been entered
if (business == "") {
	alert("Please enter a business name");
	document.fSupplier.business.focus();
	return false; } 
	
// check address has been entered
if (address == "") {
	alert("Please enter your business address");
	document.fSupplier.address.focus();
	return false; } 
	
// check postcode has been entered
if (postcode == "") {
	alert("Please enter your business postal code");
	document.fSupplier.postcode.focus();
	return false; } 
	
// check phone has been entered
if (phone == "") {
	alert("Please enter a contact telephone number");
	document.fSupplier.phone.focus();
	return false; } 

// check emails has been entered	
if (email == "") {
	alert("Please enter your Email Address.");
	document.fSupplier.email.focus();
	return false; 	} 

// check email is valid
var emailFilter=/^.+@.+\..+$/
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
// test structure of email address
if (!(emailFilter.test(email))) { alert("Please enter a valid email address"); document.fSupplier.email.focus(); return false;}
// check email contains no illegal characters
if (email.match(illegalChars)) {alert("Please enter a valid email address"); document.fSupplier.email.focus(); return false;}

// check trading has been entered	
if (trading == "") {
	alert("Please enter the time you have been trading.");
	document.fSupplier.trading.focus();
	return false; } 
	
// check name1 has been entered	
if (name1 == "") {
	alert("Please enter the name of a partner/director.");
	document.fSupplier.name1.focus();
	return false; } 
	
// check address1 has been entered	
if (address1 == "") {
	alert("Please enter the address of a partner/director.");
	document.fSupplier.address1.focus();
	return false; } 
	
// check postcode has been entered	
if (postcode1 == "") {
	alert("Please enter the postcode of a partner/director.");
	document.fSupplier.postcode1.focus();
	return false; } 

// check terms & conditions box has been checked
if (tnc == false) {
	alert("You must agree to our Terms & Conditions");
	document.fSupplier.tnc.focus();
	return false; }	 
	
return true;
}





/*  checkProposalForm  *////////////////////////////////////////////////////////////////////////////////
function	 checkProposalForm () { //document.write("HERE");

// place form data into variables (only checking for required fields)
var name = document.fProposal.name.value;
var phone = document.fProposal.phone.value;
var email = document.fProposal.email.value;
var business = document.fProposal.business.value;
var regno = document.fProposal.regno.value;
var address = document.fProposal.address.value;
var postcode = document.fProposal.postcode.value;
var trading = document.fProposal.trading.value;
var equipment = document.fProposal.equipment.value;
var amount = document.fProposal.amount.value;
var term = document.fProposal.term.value;
var tnc = document.fProposal.tnc.checked;

// check name has been entered
if (name == "") {
	alert("Please enter your full name");
	document.fProposal.name.focus();
	return false; } 
	
// check phone has been entered
if (phone == "") {
	alert("Please enter a contact telephone number");
	document.fProposal.phone.focus();
	return false; } 

// check email has been entered	
if (email == "") {
	alert("Please enter your Email Address.");
	document.fProposal.email.focus();
	return false; 	} 

// check email is valid
var emailFilter=/^.+@.+\..+$/
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
// test structure of email address
if (!(emailFilter.test(email))) { alert("Please enter a valid email address"); document.fProposal.email.focus(); return false;}
// check email contains no illegal characters
if (email.match(illegalChars)) {alert("Please enter a valid email address"); document.fProposal.email.focus(); return false;}


// check business has been entered
if (business == "") {
	alert("Please enter a business name");
	document.fProposal.business.focus();
	return false; } 
	
// check address has been entered
if (address == "") {
	alert("Please enter your business address");
	document.fProposal.address.focus();
	return false; } 
	
// check postcode has been entered
if (postcode == "") {
	alert("Please enter your business postal code");
	document.fProposal.postcode.focus();
	return false; } 

// check trading has been entered	
if (trading == "") {
	alert("Please enter the time you have been trading.");
	document.fProposal.trading.focus();
	return false; } 
	
// check equipment has been entered	
if (equipment == "") {
	alert("Please enter details of the equipment being financed.");
	document.fProposal.equipment.focus();
	return false; } 
	
// check amount has been entered	
if (amount == "") {
	alert("Please enter the amount of the equipment.");
	document.fProposal.amount.focus();
	return false; } 
	
// check term has been entered	
if (term == "") {
	alert("Please enter the term of the finance agreement.");
	document.fProposal.term.focus();
	return false; } 

// check terms & conditions box has been checked
if (tnc == false) {
	alert("You must agree to our Terms & Conditions");
	document.fProposal.tnc.focus();
	return false; }	 
	
return true;
}