I'm writing a form validation function. All went well until I did this function:

//check email field
if(document.form1.email1.value == "")
{
alert('Please enter an Email address.');
document.form1.email1.focus();
return false;
}
else
{
var email1 = document.form1.email1.value;

apos=email1.indexOf("@");
dotpos=email1.lastIndexOf(".");
lastpos=email1.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
{
alert("The Email you entered is not valid. Please fix it.");
document.form1.email1.focus();
return false;
}
else
{
return true;
}
}

//check adults field
if(document.form1.adults.value == "")
{
alert('Please enter a number of adults.');
document.form1.adults.focus();
return false;
}


as you can see, after the if/else on the email check I continued to check the field called "adults" in my form, but for some strange reason it doesnt work (I tried with some other fields too, so its not a name clash).

NOTE that when I put the "adults" field part:

if(document.form1.adults.value == "")
{
alert('Please enter a number of adults.');
document.form1.adults.focus();
return false;
}

before the check email part (that uses if/else) it worked good. So I reccon something is wrong with my statement.

thanks.