function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}


function validate_form(thisform)
{
with (thisform)
{
if (validate_required(name,"Please, write your first name.")==false)
  {name.focus();return false;}
}
with (thisform)
{
if (validate_required(name2,"Please, write your last name.")==false)
  {name2.focus();return false;}
}
with (thisform)
{
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
}
with (thisform)
{
if (validate_required(country,"Please, select a country")==false)
  {country.focus();return false;}
}

with (thisform)
{
var found_it
for (var i=0; i<gender.length; i++)  {

    if (gender[i].checked)  {

    found_it = gender[i].value //set found_it equal to checked button's value

    } 

}
if(!found_it){ //if found_it is equal to false or null, a button has NOT been checked

alert("Please select a gender");
country.focus();return false;
}
}

with (thisform)
{
var found_it1
for (var i=0; i<accom.length; i++)  {

    if (accom[i].checked)  {

    found_it1 = accom[i].value //set found_it equal to checked button's value

    } 

}
if(!found_it1){ //if found_it is equal to false or null, a button has NOT been checked

alert("Please select accommodation type");
year_e.focus();return false;
}
}


}

