function Validator(theForm)
{
   var h=false;
   for(j=1;j<4;j++)
     if(theForm["i"+j].checked)
     {
         h=true;
         break;
     }

  if(!h) 
  {
    alert("Хотя бы одно товарное направление должно быть отмечено");
    theForm.i1.focus();
    return (false);
  }

  var h=false;
  for(j=1;j<9;j++)
     if(theForm["o"+j].checked)
     {
         h=true;
         break;
     }
     if (theForm.o9.value != "")
        {h=true;}
  if(!h) 
  {
    alert("Укажите направление деятельности вашей компании");
    theForm.o1.focus();
    return (false);
  }
  
   var h=false;
  for(j=1;j<4;j++)
     if(theForm["z"+j].checked)
     {
         h=true;
         break;
     }
     if (theForm.z4.value != "")
       { h=true;}
  if(!h) 
  {
    alert("Укажите цель приобретения оборудования");
    theForm.z1.focus();
    return (false);
  }
  
  if (theForm.name.value == "")
  {
    alert("Поле \"Название организации\" не может быть пустым");
    theForm.name.focus();
    return (false);
  }
  if (theForm.city.value == "")
  {
    alert("Поле \"Город\" не может быть пустым");
    theForm.city.focus();
    return (false);
  }
  if (theForm.phone.value == "")
  {
    alert("Поле \"Телефон\" не может быть пустым");
    theForm.phone.focus();
    return (false);
  }
  
  if (theForm.email.value == "")
  {
    alert("Поле \"E-Mail\" не может быть пустым");
    theForm.email.focus();
    return (false);
  }
  
  if (theForm.email.value.length < 5)
  {
    alert("Поле \"E-Mail\" не может быть таким коротким!!");
    theForm.email.focus();
    return (false);
  }
  
  var at=false;
  var dot=false;
  var codes=false;

  for(j=0;j<theForm.email.value.length;j++)
  { 
     if (theForm.email.value.charAt(j)=='@')
         at=true;
     if (at && theForm.email.value.charAt(j)=='.')
         dot=true 
     h=theForm.email.value.charCodeAt(j) 
     if ((h<64 || h>90) && (h<97 || h>122) && (h<48 || h>57) && (h!=45 && h!=95 && h!=43 && h!=33 && h!=46 && h!=37 && h!=95))   
        codes=true;
         
  }
 
  if (!at || !dot || codes || theForm.email.value.charAt(0)=='@' || theForm.email.value.charAt(0)=='.' || 
       theForm.email.value.charAt(j-1)=='@' || theForm.email.value.charAt(j-1)=='.')
  {
    alert("Поле \"E-Mail\" заполнено некорректно");
    theForm.email.focus();
    return (false);
  }
  
  if (theForm.Branch.value=="")
  {
  
    alert("Укажите отделение с которым Вы хотели бы работать");
    theForm.Branch.focus();
    return (false);
  }
  
  if (theForm.companysubscriber.value == "")
  {
  
    alert("Укажите \"Ф. И. О.\" сотрудника ответственного за работу с MAS Elektronik AG");
    theForm.companysubscriber.focus();
    return (false);
  }
  
  return (true);
}