
<!--
function Form1_Validator(theForm)
{
	
// check to see if the field is blank
if (theForm.txtFirstName.value == "")
{
alert("Fyll i ditt förnamn.");
theForm.txtFirstName.focus();
return (false);
}

// require at least 2 characters be entered
if (theForm.txtFirstName.value.length < 2)
{
alert("Fyll i åtminstone 2 bokstäver i  \"FirstName\" förnamnsfältet.");
theForm.txtFirstName.focus();
return (false);
}


// check to see if the field is blank
if (theForm.txtSurName.value == "")
{
alert("Fyll i ditt efternamn.");
theForm.txtSurName.focus();
return (false);
}



// check to see if the field is blank
if (theForm.selStateCounty.value == "")
{
alert("Skriv in stad Stad.");
theForm.selStateCounty.focus();
return (false);
}

// check to see if the field is blank
if (theForm.txtMessage.value == "")
{
alert("Lämna ett meddelande. Skriv tex stadsdel eller om du kan tänka dig att åka en bit för ett hundmöte.");
theForm.txtMessage.focus();
return (false);
}

// check if email field is blank
var form_email = theForm.txtEmail.value;
var invalidChars = " /:;,"
var badChar =""
if (form_email== "")
{
alert("Fyll i emailadress.");
 return (false);
}
for (i = 0;  i < invalidChars.length;  i++)
{
badChar=invalidChars.charAt(i);
if(form_email.indexOf(badChar,0)>-1)
{
alert("Kontrollera din emailadress");
theForm.txtEmail.focus();
return (false);
}
}
atPos=form_email.indexOf("@",1)
if(atPos==-1)
{
alert("Du saknar @ i din emailadress");
theForm.txtEmail.focus();
return (false);
}
if(form_email.indexOf("@",atPos+1)>-1)
{
alert("Du kan inte ha @");
theForm.txtEmail.focus();
return (false);
}
periodPos=form_email.indexOf(".",atPos)
if(periodPos==-1)
{
alert("Du saknar . i din emailadress");
theForm.txtEmail.focus();
return (false);
}
if(periodPos+3>form_email.length)
{
alert("Det måste vara minst två bokstäver efter .");
theForm.txtEmail.focus();
return (false);
}


return (true);
}
//-->

   

