/*
What it does: Email obfuscator - simply pass the email name as a variable to the script.
Written by BlueMonkey for electroosho.co.uk
Part of the power the web with smiles - SmileANNA - project.
*/
function mailMe(name) { //v2.0
var string1 = name;
var string2 = "@";
var string3 = "terramar";
var string4 = ".co.uk";
var string5 = string1 + string2 + string3 + string4;
mailMeWindow=window.open('','name','height=200,width=200');
var tmp = mailMeWindow.document;
tmp.write("<p>");
tmp.write("To send an email to "+ string1 +" using your own mail client click on the link below:");
tmp.write("</p><p>");
tmp.write("<a href=" + "mail" + "to:" + string5 +">" + string5 + "</a>");
tmp.write("</p>");
tmp.close();
}
function colourSwatch(colour) { //v2.0
var string1 = colour;
colourWindow=window.open('','name','height=200,width=200');
var temp = colourWindow.document;
temp.write("<p>");
temp.write("Colour: "+ string1 +"");
temp.write("</p><p>");
temp.write("<img src=\"http://www.terramar.co.uk/katrine/productIMG/colourswatches/150/"+string1+".jpg\" alt=\"colour: "+ string1 +"\" />");
temp.write("</p>");
temp.close();
}
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function validateNews() {
	if (document.news_subscribe.full_name.value.length < 1) {
		alert("Please complete the name field");
		document.news_subscribe.full_name.focus();
		return false;
	}
	if (document.news_subscribe.email.value.length < 3) {
		alert("Please complete the email field");
		document.news_subscribe.email.focus();
		return false;
	}
	return true;
}
/*Validate contact-form */
function validateForm() {
	if (document.wholesale_mail.full_name.value.length < 3) {
		alert("Please complete the name field");
		document.wholesale_mail.full_name.focus();
		return false;
	}
	if (document.wholesale_mail.email.value.length < 8) {
		alert("Please add your email address");
		document.wholesale_mail.email.focus();
		return false;
	}
	if (document.wholesale_mail.message.value.length < 10) {
		alert("Please add a message");
		document.wholesale_mail.message.focus();
		return false;
	}
	return true;
}
/*Validate request-brochure */
function validateRequest() {
	if (document.wholesale_brochure.full_name.value.length < 1) {
		alert("Please complete the name field");
		document.wholesale_brochure.full_name.focus();
		return false;
	}
	if (document.wholesale_brochure.email.value.length < 5) {
		alert("Please complete the email field");
		document.wholesale_brochure.email.focus();
		return false;
	}
	if (document.wholesale_brochure.company_name.value.length < 10) {
		alert("Please add your business/university/organisation name in the box provided");
		document.wholesale_brochure.company_name.focus();
		return false;
	}
	if (document.wholesale_brochure.address.value.length < 4) {
		alert("Please add your address");
		document.wholesale_brochure.address.focus();
		return false;
	}
	return true;
}