
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
function emailvalidation(entered, alertbox)
{
with (entered)
	{
	apos=value.indexOf("@"); 
	dotpos=value.lastIndexOf(".");
	lastpos=value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>4 || lastpos-dotpos<2) 
	{if (alertbox) {alert(alertbox);} return false;}
	else {return true;}
	}
} 

function emptyvalidation(entered, alertbox)
{
with (entered)
	{
	var mustcontain = value.search(/[a-z]|[A-Z]|[0-9]/);
	if (mustcontain==-1) {if (alertbox!="") {alert(alertbox);} return false;}
	// if (value==null || value=="") {if (alertbox!="") {alert(alertbox);} return false;}
	else {return true;}
	}
} 

function formvalidation1(thisform)
{
with (thisform)
	{
	if (emptyvalidation(firstname,"Please enter your first name")==false) {firstname.focus(); return false;};
	if (emptyvalidation(lastname,"Please enter your last name")==false) {lastname.focus(); return false;};
	if (emptyvalidation(tel,"Please enter your telephone number")==false) {tel.focus(); return false;};
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	if (howheard.options[howheard.selectedIndex].value == "Not specified") {alert("Please tell us how you heard about The Next Stage"); return false;};
	}
} 

function formvalidation2(thisform)
{
with (thisform)
	{
	if (emptyvalidation(fullname,"Please enter your name")==false) {fullname.focus(); return false;};
	if (emptyvalidation(tel,"Please enter your telephone number")==false) {tel.focus(); return false;};
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	if (howheard.options[howheard.selectedIndex].value == "Not specified") {alert("Please tell us how you heard about The Next Stage"); return false;};
	}
} 

function formvalidation3(thisform)
{
with (thisform)
	{
	if (emptyvalidation(fullname,"Please enter your name")==false) {fullname.focus(); return false;};
	if (emptyvalidation(tel,"Please enter your telephone number")==false) {tel.focus(); return false;};
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	}
} 

function formvalidation4(thisform)
{
with (thisform)
	{
	if (emptyvalidation(fullname,"Please enter your name")==false) {fullname.focus(); return false;};
	if (emptyvalidation(tel,"Please enter your telephone number")==false) {tel.focus(); return false;};
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	if (howheard.options[howheard.selectedIndex].value == "Not specified") {alert("Please tell us how you heard about The Next Stage"); return false;};
	}
} 

function formvalidation5(thisform)
{
with (thisform)
	{
	if (emptyvalidation(fullname,"Please enter your name")==false) {fullname.focus(); return false;};
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	if (howheard.options[howheard.selectedIndex].value == "Not specified") {alert("Please tell us how you heard about The Next Stage"); return false;};
	}
} 

function formvalidation6(thisform)
{
with (thisform)
	{
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	}
} 

function formvalidation7(thisform)
{
with (thisform)
	{
	if (emptyvalidation(fullname,"Please enter your name")==false) {fullname.focus(); return false;};
	if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	if (howheard.options[howheard.selectedIndex].value == "Not specified") {alert("Please tell us how you heard about The Next Stage"); return false;};
	}
} 


