  function onLoad() { sendForm.aname.focus(); }
  function checkValue(p,alertmsg,chop,checkisnan,setfocus) { if (chop){ var str; str=p.value; while (str.substr(0,1)==" ") {str=str.substr(1,str.length-1);} p.value=str; } if (checkisnan) { if (isNaN(p.value)) { if (alertmsg) {alert(alertmsg);} if (setfocus) {p.focus();} return false;} } if (p.value=='') { if (alertmsg) {alert(alertmsg);} if (setfocus) {p.focus();} return false;}  return true; }
  function checkEmail(p,alertmsg,setfocus)
  {
   mail=p.value;
   if (mail.indexOf("@")==-1 || mail.indexOf("@")==0) { alert(alertmsg); if (setfocus) { p.focus(); } return false; }
   amail=mail.substring(mail.indexOf("@")+1,mail.length);
   if (amail=="") { alert(alertmsg); if (setfocus) { p.focus(); } return false; }
   if (amail.indexOf(".")==-1 || amail.indexOf(".")==0 || amail.indexOf(".")==amail.length-1) { alert(alertmsg); if (setfocus) { p.focus(); } return false; }
   return true;
  }
  function clearFields()
  {
   sendForm.aname.value="";
   sendForm.email.value="";
   sendForm.aname.focus();
  }
  function sendFormData()
  {
   if (!checkValue(sendForm.aname,'Пожалуйста, укажите свое имя!', true,false,true)) {return;}
   if (!checkValue(sendForm.email,'Пожалуйста, укажите e-mail друга!', true,false,true)) {return;}
   if (!checkEmail(sendForm.email,'Некорректный e-mail!', true)) {return;}
   sendForm.submit();
  }