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_email(login_username,"Introduceti corect adresa de email!")==false)
  {login_username.focus();return false;}
  
if (validate_required(secretkey,"Introduceti parola!")==false)
  {secretkey.focus();return false;}
  
if (validate_required(login,"Introduceti adresa site-ului!")==false)
  {login.focus();return false;}
  
if (validate_required(passwd,"Introduceti parola!")==false)
  {passwd.focus();return false;}
}

}
