
<!--
function Form1_Validator(theForm)
{
// check to see if the field is blank
if (theForm.txtFirstName.value == "")
{
alert("Please enter your name.");
theForm.txtFirstName.focus();
return (false);
}
// require at least 2 characters be entered
if (theForm.txtFirstName.value.length < 2)
{
alert("Please enter at least 2 characters in the \"Your name\" field.");
theForm.txtFirstName.focus();
return (false);
}
// check to see if the field is blank
if (theForm.txtSurName.value == "")
{
alert("Please enter the type of your regret.");
theForm.txtSurName.focus();
return (false);
}

// check to see if the field is blank
if (theForm.txtMessage.value.replace(/[\s\r\n]/g,"")=="")
{
alert("Please enter your story of regret.");
theForm.txtMessage.focus();
return (false);
}

// check if email field is blank
var form_email = theForm.txtEmail.value;
var invalidChars = " <>/:;,"
var badChar =""
if (form_email!= "")
{

for (i = 0;  i < invalidChars.length;  i++)
{
badChar=invalidChars.charAt(i);
if(form_email.indexOf(badChar,0)>-1)
{
alert("Your email is not valid, it cannot contain <>/:;, or space characters.");
theForm.txtEmail.focus();
return (false);
}
}
atPos=form_email.indexOf("@",1)
if(atPos==-1)
{
alert("Your email is not valid, it must have an @");
theForm.txtEmail.focus();
return (false);
}
if(form_email.indexOf("@",atPos+1)>-1)
{
alert("Your email is not valid, it cannot contain more than one @ character.");
theForm.txtEmail.focus();
return (false);
}
periodPos=form_email.indexOf(".",atPos)
if(periodPos==-1)
{
alert("Your email is not valid, it must have at least one . character.");
theForm.txtEmail.focus();
return (false);
}
if(periodPos+3>form_email.length)
{
alert("Your email is not valid, please check and submit your story again.");
theForm.txtEmail.focus();
return (false);
}
}

return (true);
}
//-->

   

