// Scripts developed by Nick Beech
// http://LookAndLearnTraining.com and http://LookAndLearnTraining.co.uk

// scripts to clear field and check that email address is correct format


// check additions to mailing list - Garners
function checkEmailAdd() {
	var okToSend = true;
	// checks for @ sign and "."
	atfound = document.emailsignupform.email.value.indexOf("@");
	dotfound = document.emailsignupform.email.value.indexOf(".");
	if (atfound < 1 || dotfound < 2) {
			okToSend = false;
			alert("Invalid email address: please re-enter correct address");
		}
	// sends form if no errors
	if (okToSend == true)
			{document.emailsignupform.submit();}
	}

	
// checks enquiry form

	// clears enquiry detail box
	function clearEnqText(){
		if (document.emailsignupform.email.value == "Enter email address") {
			document.emailsignupform.email.value = "";
		}
	}
	
// check additions to mailing list - Craft Room
function checkEmailAddCraft() {
	var okToSend = true;
	// checks for @ sign and "."
	atfound = document.emailsignupformCraft.email.value.indexOf("@");
	dotfound = document.emailsignupformCraft.email.value.indexOf(".");
	if (atfound < 1 || dotfound < 2) {
			okToSend = false;
			alert("Invalid email address: please re-enter correct address");
		}
	// sends form if no errors
	if (okToSend == true)
			{document.emailsignupformCraft.submit();}
	}

	
// checks enquiry form

	// clears enquiry detail box
	function clearEnqTextCraft(){
		if (document.emailsignupformCraft.email.value == "Enter email address") {
			document.emailsignupformCraft.email.value = "";
		}
	}
	
