function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}

function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function formvalidation(thisform)
{
with (thisform)
{
if (emptyvalidation(name,"You cannot leave the name field blank")==false) {name.focus(); return false;};
if (emailvalidation(email,"You must enter a valid email address")==false) {email.focus(); return false;};
if (emailvalidation(email2,"You must enter the same valid email address twice")==false) {email2.focus(); return false;};
}
}