function check_com(form)
{
         if (form.name.value=='')
           {
              alert('Введите имя!');
              return false;
           }

         if (form.comment_text.value=='')
           {
              alert('Заполните поле \'Отзыв\'!');
              return false;
           }

         if (form.keystring.value=='')
           {
              alert('Введите проверочные символы!');
              return false;
           }
}

function show_raz_brand()
{
     soh = document.getElementById('now_show').value;
     if (soh=='raz')
       {
         document.getElementById('brand').innerHTML='<div style="height:26px;background-color:#FFFFFF;"><div class="block" style="color:#000000;padding-top:4px;" >БРЕНДЫ</div></div>';
         document.getElementById('raz').innerHTML='<div style="height:26px;background-color:#333333;"><div class="block" style="padding-top:4px;color:#FFFFFF;cursor: pointer; cursor: hand;" onClick="show_raz_brand();">РАЗДЕЛЫ</div></div>';

         document.getElementById('cat_brand').style.display='block';
         document.getElementById('cat_raz').style.display='none';


         document.getElementById('now_show').value='brand';
       }
     else
       {
         document.getElementById('brand').innerHTML='<div style="height:26px;background-color:#333333;"><div class="block" style="padding-top:4px;color:#FFFFFF;cursor: pointer; cursor: hand;" onClick="show_raz_brand();">БРЕНДЫ</div></div>';
         document.getElementById('raz').innerHTML='<div style="height:26px;background-color:#FFFFFF;"><div class="block" style="color:#000000;padding-top:4px;" >РАЗДЕЛЫ</div></div>';

         document.getElementById('cat_brand').style.display='none';
         document.getElementById('cat_raz').style.display='block';


         document.getElementById('now_show').value='raz';

       }
}

function keyFilter(str, reg_s)
{
    result=reg_s.test(str);
    return result;
}

var isIE = (document.all) ? 1 : 0;
function keyFilter_first(e, strPattern,form)
{
   var chr = (isIE) ? e.keyCode : e.which;
   var ch = String.fromCharCode(chr);

   first_number_1=form.first_number.value.length;
   if (first_number_1<4)
    {
      if (chr != 13 && chr != 8 && chr != 0)
       {
         var re = new RegExp(strPattern);

         if (ch.search(re) == -1)
           {
             if(isIE)
               e.returnValue = false;
             else
               e.preventDefault();
           }
        }
     }
   else
    {
      if (chr != 13 && chr != 8 && chr != 0)
       {
             if(isIE)
               e.returnValue = false;
             else
               e.preventDefault();
        }
    }
}

function keyFilter_second(e, strPattern,form)
{
   var chr = (isIE) ? e.keyCode : e.which;
   var ch = String.fromCharCode(chr);

   second_number_1=form.second_number.value.length;
   if (second_number_1<3)
    {
      if (chr != 13 && chr != 8 && chr != 0)
       {
         var re = new RegExp(strPattern);

         if (ch.search(re) == -1)
           {
             if(isIE)
               e.returnValue = false;
             else
               e.preventDefault();
           }
        }
     }
   else
    {
      if (chr != 13 && chr != 8 && chr != 0)
       {
             if(isIE)
               e.returnValue = false;
             else
               e.preventDefault();
        }
    }
}

//---------------------------------------------------Логин-------------------//
function login_test()
{
   var handle;
   reg_s=/[^a-z0-9_]/i

   handle = document.getElementById("login_id").value;
  // if (handle.indexOf('\,',0)==0)
 //     alert('v');
   stat=keyFilter(handle,reg_s);

   if (stat)
     {
       login_test_bad();
     }
   else
       x_getlogin(handle,set_result);

}

function login_test_all()
{
   var handle;
   reg_s=/[^a-z0-9_]/i

   handle = document.getElementById("login_id").value;
  // if (handle.indexOf('\,',0)==0)
 //     alert('v');
   stat=keyFilter(handle,reg_s);

   if (stat)
     {
       login_test_bad();
     }
   else
       return 11;

}

function login_test_foc()
{

            login = document.getElementById("login_id").value;
            if (login=='')
              {
                document.getElementById("login_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("login_e").value='b';
              }
}

function login_test_bad()
{              document.getElementById("login_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("login_res").innerHTML='<font color="#F73460">Доступны только a-z, 0-9, _</font>';
               document.getElementById("login_e").value='b';
}

 //-------------------------------------Пароль-----------------//
function pass_test()
{
   reg_s=/[^a-z0-9_]/i
   str = document.getElementById("pass_id").value;
   if (str=='')
     {
       pass_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       pass_test_bad();
     }
   else
     {
               document.getElementById("pass_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("pass_res").innerHTML='';
               document.getElementById("pass_e").value='g';
               str2 = document.getElementById("pass2_id").value;
               if (str2!='')
                 {
                         if (str2==str)
                           {
                             document.getElementById("pass2_img").innerHTML='<img src="images/validated.gif"  border=0>';
                              document.getElementById("pass2_res").innerHTML='';
                              document.getElementById("pass2_e").value='g';
                           }
                         else
                           {
                              document.getElementById("pass2_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
                              document.getElementById("pass2_res").innerHTML='<font color="#F73460">Пароли не совпадают</font>';
                              document.getElementById("pass2_e").value='b';
                           }
                 }

     }

}

function pass_test_foc()
{
            login = document.getElementById("pass_id").value;
            if (login=='')
              {
               document.getElementById("pass_img").innerHTML='<img src="images/required.gif"  border=0>';
               document.getElementById("pass_res").innerHTML='<font color="#F73460"></font>';
               document.getElementById("pass_e").value='b';
              }
}

function pass_test_bad()
{              document.getElementById("pass_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("pass_res").innerHTML='<font color="#F73460">Доступны только a-z, 0-9, _</font>';
               document.getElementById("pass_e").value='b';
}

 //-------------------------------------Пароль 2-----------------//


function pass2_test()
{
   reg_s=/[^a-z0-9_]/i
   str = document.getElementById("pass2_id").value;
   if (str=='')
     {
       pass2_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       pass2_test_bad();
     }
   else
     {
              str2 = document.getElementById("pass_id").value;
              if (str2==str)
                {
                  document.getElementById("pass2_img").innerHTML='<img src="images/validated.gif"  border=0>';
                  document.getElementById("pass2_res").innerHTML='';
                  document.getElementById("pass2_e").value='g';
                }
              else
                {
                  document.getElementById("pass2_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
                  document.getElementById("pass2_res").innerHTML='<font color="#F73460">Пароли не совпадают</font>';
                  document.getElementById("pass2_e").value='b';
                }
     }

}

function pass2_test_foc()
{
            login = document.getElementById("pass2_id").value;
            if (login=='')
              {
               document.getElementById("pass2_img").innerHTML='<img src="images/required.gif"  border=0>';
               document.getElementById("pass2_res").innerHTML='<font color="#F73460"></font>';
               document.getElementById("pass2_e").value='b';
              }
}

function pass2_test_bad()
{              document.getElementById("pass2_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("pass2_res").innerHTML='<font color="#F73460">Доступны только a-z, 0-9, _</font>';
               document.getElementById("pass2_e").value='b';
}



 //-------------------------------------Имя-----------------//
function name_test()
{
   reg_s=/[^a-zа-яё]/i
   str = document.getElementById("name_id").value;
   if (str=='')
     {
       name_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       name_test_bad();
     }
   else
     {
               document.getElementById("name_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("name_res").innerHTML='';
               document.getElementById("name_e").value='g';
     }

}

function name_test_foc()
{
            login_1 = document.getElementById("name_id").value;
            if (login_1=='')
              {
                document.getElementById("name_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("name_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("name_e").value='b';
              }
}

function name_test_bad()
{              document.getElementById("name_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("name_res").innerHTML='<font color="#F73460">Доступны только a-z, а-я</font>';
               document.getElementById("name_e").value='b';
}

 //-------------------------------------Фамилия-----------------//
function lastname_test()
{
   reg_s=/[^a-zа-яё]/i
   str = document.getElementById("lastname_id").value;
   if (str=='')
     {
       lastname_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       lastname_test_bad();
     }
   else
     {
               document.getElementById("lastname_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("lastname_res").innerHTML='';
               document.getElementById("lastname_e").value='g';
     }

}

function lastname_test_foc()
{
            login_1 = document.getElementById("lastname_id").value;
            if (login_1=='')
              {
                document.getElementById("lastname_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("lastname_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("lastname_e").value='b';
              }
}

function lastname_test_bad()
{              document.getElementById("lastname_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("lastname_res").innerHTML='<font color="#F73460">Доступны только a-z, а-я</font>';
               document.getElementById("lastname_e").value='b';
}


 //-------------------------------------Телефон-----------------//
function phone_test()
{
   reg_s=/[^+0-9()\\-]/i
   str = document.getElementById("phone_id").value;
   if (str=='')
     {
       phone_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if ((stat))
     {
       phone_test_bad();
     }
   else
     {
         if (str.length<7)
           {
             phone_length();
           }
         else
           {
             document.getElementById("phone_img").innerHTML='<img src="images/validated.gif"  border=0>';
             document.getElementById("phone_res").innerHTML='';
             document.getElementById("phone_e").value='g';
           }
     }
}

function phone_test_foc()
{
            login_1 = document.getElementById("phone_id").value;
            if (login_1=='')
              {
                document.getElementById("phone_img").innerHTML='<img src="images/required.gif"  border=0>';
                document.getElementById("phone_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("phone_e").value='b';
              }
}

function phone_test_bad()
{

                document.getElementById("phone_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
                document.getElementById("phone_res").innerHTML='<font color="#F73460">Доступны только 0-9 + ( ) -</font>';
                document.getElementById("phone_e").value='b';
}

function phone_length()
{
                document.getElementById("phone_img").innerHTML='<img src="images/required.gif"  border=0>';
                document.getElementById("phone_res").innerHTML='<font color="#F73460">Не меньше 7 символов</font>';
                document.getElementById("phone_e").value='b';
}


 //-------------------------------------Мобильный Телефон-----------------//
function mobphone_test()
{
   reg_s=/[^+0-9()\\-]/i
   str = document.getElementById("mobphone_id").value;
   if (str=='')
     {
       mobphone_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       mobphone_test_bad();
     }
   else
     {
           if (str.length<7)
             {
               mobphone_length();
             }
           else
             {
               document.getElementById("mobphone_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("mobphone_res").innerHTML='';
               document.getElementById("mobphone_e").value='g';
             }
     }

}

function mobphone_test_foc()
{
            login_1 = document.getElementById("mobphone_id").value;
            if (login_1=='')
              {
                document.getElementById("mobphone_img").innerHTML='<img src="images/blank.gif"  border=0>';

                document.getElementById("mobphone_res").innerHTML='';
                document.getElementById("mobphone_e").value='g';
              }
}

function mobphone_test_bad()
{              document.getElementById("mobphone_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("mobphone_res").innerHTML='<font color="#F73460">Доступны только 0-9 + ( ) -</font>';
               document.getElementById("mobphone_e").value='b';
}

function mobphone_length()
{
               document.getElementById("mobphone_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("mobphone_res").innerHTML='<font color="#F73460">Не меньше 7 символов</font>';
               document.getElementById("mobphone_e").value='b';
}

 //-------------------------------------ICQ-----------------//
function icq_test()
{
   reg_s=/[^0-9]/
   str = document.getElementById("icq_id").value;
   if (str=='')
     {
       icq_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       icq_test_bad();
     }
   else
     {
               document.getElementById("icq_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("icq_res").innerHTML='';
               document.getElementById("icq_e").value='g';
     }

}

function icq_test_foc()
{
            login_1 = document.getElementById("icq_id").value;
            if (login_1=='')
              {
                document.getElementById("icq_img").innerHTML='<img src="images/blank.gif"  border=0>';
                document.getElementById("icq_res").innerHTML='';
                document.getElementById("icq_e").value='g';
              }
}

function icq_test_bad()
{              document.getElementById("icq_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("icq_res").innerHTML='<font color="#F73460">Доступны только 0-9</font>';
               document.getElementById("icq_e").value='b';
}



 //-------------------------------------Email-----------------//
    function test_11(src)
     {
       var emailReg =/^[-0-9a-zA-Z_\.]+@[0-9,a-z,A-Z_,\.,^\-]+\.[a-zA-Z]{2,6}$/
       var regex = new RegExp(emailReg);
       return regex.test(src);
     }

function email_test()
{

/*    function test(src)
     {
       var emailReg ="^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
       var regex = new RegExp(emailReg);
       return regex.test(src);
     }        */
   str = document.getElementById("email_id").value;
   if (str=='')
     {
       email_test_foc();
       return;
     }
   stat=test_11(str);
   if (!stat)
     {
       email_test_bad();
     }
   else
     {
             x_getemail(str,set_email);
     }

}

function email_test_all()
{

   str = document.getElementById("email_id").value;
   if (str=='')
     {
       email_test_foc();
       return 0;
     }
   stat=test_11(str);
   if (!stat)
     {
       email_test_bad();
       return 0;
     }
   else
     {
            return 11;
     }

}

function email_test_foc()
{
            login_1 = document.getElementById("email_id").value;
            if (login_1=='')
              {
                document.getElementById("email_img").innerHTML='<img src="images/required.gif"  border=0>';
                document.getElementById("email_res").innerHTML='';
                document.getElementById("email_e").value='b';
              }
}

function email_test_bad()
{              document.getElementById("email_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("email_res").innerHTML='<font color="#F73460">Неверный E-mail</font>';
               document.getElementById("email_e").value='b';
}

//----------------------------------------------------- kapcha -----------//

function kapcha_test()
{
   var handle;

   handle = document.getElementById("kapcha_id").value;
//   alert('ccc');
   x_getkap(handle,set_kap);

}

function kapcha_test_foc()
{
            kap = document.getElementById("kapcha_id").value;
            if (kap=='')
              {
                document.getElementById("kapcha_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("kapcha_e").value='b';
              }
}

function kap_test_bad()
{              document.getElementById("kapcha_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("kapcha_res").innerHTML='<font color="#F73460">Недопустимое значение</font>';
               document.getElementById("kapcha_e").value='b';
}


function submit_reg(ie)
 {
    pass_test();
    pass2_test();
    name_test();
    lastname_test();
    phone_test();
    mobphone_test();
    icq_test();

    count_e=0;

    st_l=login_test_all();
    st_e=email_test_all();

        login=document.getElementById("login_id").value;
        email=document.getElementById("email_id").value;
        kap=document.getElementById("kapcha_id").value;

        if (document.getElementById("pass_e").value=='b')
           count_e=count_e+1;

        if (document.getElementById("pass2_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("name_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("lastname_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("phone_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("mobphone_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("icq_e").value=='b')
           count_e=count_e+1;

        if (ie==1)
          {
           if (document.getElementById("email_e").value=='b')
              count_e=count_e+1;
           if (document.getElementById("login_e").value=='b')
              count_e=count_e+1;
           document.getElementById("err_id").value=count_e;
           x_getall(login,kap,email,st_l,st_e,set_all);
           return false;
          }
       else
         {
           if (count_e==0)
            {
              document.getElementById("waiting").innerHTML='Ожидайте, идет проверка данных (15-20 сек)...';
              return true;
            }
           else
            {
              document.getElementById("errOutput").innerHTML='Обнаружено '+ count_e + ' ошибок!';
              return false;
            }
         }

       return false;

 }

 // --------------  Функции Кредитный калькулятор        -------------------

function credit_calc(tovar_id)
{
      if (tovar_id!='')
       {
        calc_window1=window.open("include/calc_window.php?tovar_id="+tovar_id,"cacl_window","width=350,height=450,scrollbars=no,resizable=no, screenX=250,screenY=0,alwaysLowered=yes");
        calc_window1.moveTo(10,10);

       }
}

function goto_credit(tovar_cod) {
  url='http://www.creditonline.com.ua/comfort_credit/order/type/comfort?partner=2802017192.1&order='+tovar_cod+'&soap_cart_url=http://www.sis-tema.com.ua/include/credit/soapik_tovar.php';
  credit_window=window.open(url,"credit_window","toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=900,height=500,screenX=150,screenY=150,top=50,left=50");
}

// --------------  Конец Функции Работы с корзиной   -------------------


 // --------------  Функции Работы с корзиной        -------------------

function add_to_cart(tovar_id)
{
   //   alert('dd');
      if (tovar_id!='')
       {
        cart_window1=window.open("include/cart_window.php?tovar_id="+tovar_id+"&action=add","cart_window","width=700,scrollbars=yes,resizable=yes, screenX=250,screenY=0,alwaysLowered=yes");
        cart_window1.moveTo(0,0);

       }

}

function update_cart()
{
        cart_window1=window.open("include/cart_window.php","cart_window","width=700,scrollbars=yes,resizable=yes, screenX=250,screenY=0,,alwaysLowered=yes");
        cart_window1.moveTo(0,0);

}

function del_order(order_id)
{
         if (confirm('Вы действительно хотите отменить заказ?'))
           {
              document.d_f.order_id.value=order_id;
              document.d_f.action.value='del';
              document.d_f.submit();
           }
}

function serv_check(form)
{
    first_number_1=form.first_number.value;
    second_number_1=form.second_number.value;
    if ((first_number_1!='')&&(second_number_1!='')&&(first_number_1.length==4)&&(second_number_1.length==3))
     {
       return true;
     }
    else
     {
       alert('Неверный номер квитанции!');
       return false;
     }
}

// --------------  Конец Функции Работы с корзиной   -------------------



// -------------- Замена рисунков --------------------------------------------
function change_image(pic_id, need_resize,pic_name,pic_name_full)
{
    pic_path='wpics/400/'+pic_name;
    pic_path_full='wpics/full/'+pic_name_full;
    if (need_resize==1) //ресайзить можно
      {
        if (pic_name!='')
          {
            if (pic_name_full!='')
             document.getElementById("pic").innerHTML="<a href=\""+pic_path_full+"\" target=\"_blank\" class=\"borderit_big_resize\" ><img src=\""+pic_path+"\"></a>";
            else
             document.getElementById("pic").innerHTML="<a href=\"include/iw_max.php?pic_id="+pic_id+"&im=big\" target=\"_blank\" class=\"borderit_big_resize\" ><img src=\""+pic_path+"\"></a>";
          }
        else
            if (pic_name_full!='')
              document.getElementById("pic").innerHTML="<a href=\""+pic_path_full+"\" target=\"_blank\" class=\"borderit_big_resize\" ><img src=\"include/iw_b.php?pic_id="+pic_id+"&im=b\"></a>";
            else
              document.getElementById("pic").innerHTML="<a href=\"include/iw_max.php?pic_id="+pic_id+"&im=big\" target=\"_blank\" class=\"borderit_big_resize\" ><img src=\"include/iw_b.php?pic_id="+pic_id+"&im=b\"></a>";
      }
    else
        if (pic_name!='')
           document.getElementById("pic").innerHTML="<a href=\"#see_pic\" class=\"borderit_big_noresize\" ><img src=\""+pic_path+"\"></a>";
        else
           document.getElementById("pic").innerHTML="<a href=\"#see_pic\" class=\"borderit_big_noresize\" ><img src=\"include/iw_b.php?pic_id="+pic_id+"&im=b\"></a>";
}
// -------------- Клнец Замена рисунков --------------------------------------------




//--------------------------- Анкета диллера ------------------------------------
//-------------------------------------------------------------------------------

 //-------------------------------------Название компании-----------------//
function company_name_test()
{
   reg_s=/[^a-zа-яё -]/i
   str = document.getElementById("company_name_id").value;
   if (str=='')
     {
       company_name_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       company_name_test_bad();
     }
   else
     {
               str=str.replace(/^\s+/, '').replace(/\s+$/, '');
               if (str=='')
                 {
                      company_name_test_bad();
                 }
               else
                 {
                  document.getElementById("company_name_img").innerHTML='<img src="images/validated.gif"  border=0>';
                  document.getElementById("company_name_res").innerHTML='';
                  document.getElementById("company_name_e").value='g';
                 }
     }

}

function company_name_test_foc()
{
            login_1 = document.getElementById("company_name_id").value;
            if (login_1=='')
              {
                document.getElementById("company_name_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("company_name_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("company_name_e").value='b';
              }
}

function company_name_test_bad()
{              document.getElementById("company_name_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("company_name_res").innerHTML='<font color="#F73460">Доступны только a-z, а-я</font>';
               document.getElementById("company_name_e").value='b';
}

 //------------------------------------- Конец Название компании-----------------//


 //-------------------------------------Сайт компании-----------------//
function company_site_test()
{
   reg_s=/^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/i
   str = document.getElementById("company_site_id").value;
   if (str=='')
     {
       company_site_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (!stat)
     {
       company_site_test_bad();
     }
   else
     {
               document.getElementById("company_site_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("company_site_res").innerHTML='';
               document.getElementById("company_site_e").value='g';
     }

}

function company_site_test_foc()
{
            login_1 = document.getElementById("company_site_id").value;
            if (login_1=='')
              {
                document.getElementById("company_site_img").innerHTML='<img src="images/blank.gif"  border=0>';

                document.getElementById("company_site_res").innerHTML='';
                document.getElementById("company_site_e").value='g';
              }
}

function company_site_test_bad()
{              document.getElementById("company_site_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("company_site_res").innerHTML='<font color="#F73460">Неверный URL</font>';
               document.getElementById("company_site_e").value='b';
}

 //------------------------------------- Конец Сайт компании-----------------//

  //-------------------------------------Сайт компании-----------------//

function company_adress_test()
{
//   reg_s=/[]/i
   str = document.getElementById("company_adress_id").value;
/*   if (str=='')
     {
       company_adress_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       company_adress_test_bad();
     }
   else
     {     */
               str=str.replace(/^\s+/, '').replace(/\s+$/, '');
               if (str=='')
                 {
                      company_adress_test_bad();
                 }
               else
                 {
                   document.getElementById("company_adress_img").innerHTML='<img src="images/validated.gif"  border=0>';
                   document.getElementById("company_adress_res").innerHTML='';
                   document.getElementById("company_adress_e").value='g';
                 }
  //   }

}

function company_adress_test_foc()
{
            login_1 = document.getElementById("company_adress_id").value;
            if (login_1=='')
              {
                document.getElementById("company_adress_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("company_adress_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("company_adress_e").value='b';
              }
}

function company_adress_test_bad()
{              document.getElementById("company_adress_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("company_adress_res").innerHTML='<font color="#F73460">Поле не должно быть пустым</font>';
               document.getElementById("company_adress_e").value='b';
}

 //------------------------------------- Конец Сайт компании-----------------//

 //-------------------------------------ФИО директора-----------------//
function director_fio_test()
{
   reg_s=/[^a-zа-яё -]/i
   str = document.getElementById("director_fio_id").value;
   if (str=='')
     {
       director_fio_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       director_fio_test_bad();
     }
   else
     {
               str=str.replace(/^\s+/, '').replace(/\s+$/, '');
               if (str=='')
                 {
                      director_fio_test_bad();
                 }
               else
                 {
                   document.getElementById("director_fio_img").innerHTML='<img src="images/validated.gif"  border=0>';
                   document.getElementById("director_fio_res").innerHTML='';
                   document.getElementById("director_fio_e").value='g';
                 }
     }

}

function director_fio_test_foc()
{
            login_1 = document.getElementById("director_fio_id").value;
            if (login_1=='')
              {
                document.getElementById("director_fio_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("director_fio_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("director_fio_e").value='b';
              }
}

function director_fio_test_bad()
{              document.getElementById("director_fio_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("director_fio_res").innerHTML='<font color="#F73460">Доступны только a-z, а-я</font>';
               document.getElementById("director_fio_e").value='b';
}

 //------------------------------------- Конец ФИО директора компании-----------------//

 //------------------------------------- Опыт работы -----------------//
function work_exp_test()
{
   reg_s=/[^0-9]/i
   str = document.getElementById("work_exp_id").value;
   if (str=='')
     {
       work_exp_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       work_exp_test_bad();
     }
   else
     {
               document.getElementById("work_exp_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("work_exp_res").innerHTML='';
               document.getElementById("work_exp_e").value='g';
     }

}

function work_exp_test_foc()
{
            login_1 = document.getElementById("work_exp_id").value;
            if (login_1=='')
              {
                document.getElementById("work_exp_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("work_exp_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("work_exp_e").value='b';
              }
}

function work_exp_test_bad()
{              document.getElementById("work_exp_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("work_exp_res").innerHTML='<font color="#F73460">Доступны только цифры</font>';
               document.getElementById("work_exp_e").value='b';
}

 //------------------------------------- Конец Опыт работы компании-----------------//


 //------------------------------------- Оборот -----------------//
function oborot_test()
{
   reg_s=/[^0-9]/i
   str = document.getElementById("oborot_id").value;
   if (str=='')
     {
       oborot_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       oborot_test_bad();
     }
   else
     {
               document.getElementById("oborot_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("oborot_res").innerHTML='';
               document.getElementById("oborot_e").value='g';
     }

}

function oborot_test_foc()
{
            login_1 = document.getElementById("oborot_id").value;
            if (login_1=='')
              {
                document.getElementById("oborot_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("oborot_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("oborot_e").value='b';
              }
}

function oborot_test_bad()
{              document.getElementById("oborot_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("oborot_res").innerHTML='<font color="#F73460">Доступны только цифры</font>';
               document.getElementById("oborot_e").value='b';
}

 //------------------------------------- Конец Оборот компании-----------------//


 //-------------------------------------ФИО чела-----------------//
function man_fio_test()
{
   reg_s=/[^a-zа-яё -]/i
   str = document.getElementById("man_fio_id").value;
   if (str=='')
     {
       man_fio_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       man_fio_test_bad();
     }
   else
     {
               str=str.replace(/^\s+/, '').replace(/\s+$/, '');
               if (str=='')
                 {
                      man_fio_test_bad();
                 }
               else
                 {
                   document.getElementById("man_fio_img").innerHTML='<img src="images/validated.gif"  border=0>';
                   document.getElementById("man_fio_res").innerHTML='';
                   document.getElementById("man_fio_e").value='g';
                 }
     }

}

function man_fio_test_foc()
{
            login_1 = document.getElementById("man_fio_id").value;
            if (login_1=='')
              {
                document.getElementById("man_fio_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("man_fio_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("man_fio_e").value='b';
              }
}

function man_fio_test_bad()
{              document.getElementById("man_fio_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("man_fio_res").innerHTML='<font color="#F73460">Доступны только a-z, а-я</font>';
               document.getElementById("man_fio_e").value='b';
}

 //------------------------------------- Конец ФИО чела -----------------//

 //-------------------------------------Должность-----------------//

function man_post_test()
{
   reg_s=/[^a-zа-яё -]/i
   str = document.getElementById("man_post_id").value;
   if (str=='')
     {
       man_post_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       man_post_test_bad();
     }
   else
     {
               str=str.replace(/^\s+/, '').replace(/\s+$/, '');
               if (str=='')
                 {
                      man_post_test_bad();
                 }
               else
                 {
                  document.getElementById("man_post_img").innerHTML='<img src="images/validated.gif"  border=0>';
                  document.getElementById("man_post_res").innerHTML='';
                  document.getElementById("man_post_e").value='g';
                }
     }

}

function man_post_test_foc()
{
            login_1 = document.getElementById("man_post_id").value;
            if (login_1=='')
              {
                document.getElementById("man_post_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("man_post_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("man_post_e").value='b';
              }
}

function man_post_test_bad()
{              document.getElementById("man_post_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("man_post_res").innerHTML='<font color="#F73460">Доступны только a-z, а-я</font>';
               document.getElementById("man_post_e").value='b';
}

 //------------------------------------- Конец Должность -----------------//

 //-------------------------------------E-mail-----------------//
function man_email_test()
{
   str = document.getElementById("man_email_id").value;
   if (str=='')
     {
       man_email_test_foc();
       return;
     }
   stat=test_11(str);
   if (!stat)
     {
       man_email_test_bad();
     }
   else
     {
               document.getElementById("man_email_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("man_email_res").innerHTML='';
               document.getElementById("man_email_e").value='g';
     }

}

function man_email_test_foc()
{
            login_1 = document.getElementById("man_email_id").value;
            if (login_1=='')
              {
                document.getElementById("man_email_img").innerHTML='<img src="images/required.gif"  border=0>';

                document.getElementById("man_email_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("man_email_e").value='b';
              }
}

function man_email_test_bad()
{              document.getElementById("man_email_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("man_email_res").innerHTML='<font color="#F73460">Неверный E-mail</font>';
               document.getElementById("man_email_e").value='b';
}

 //------------------------------------- Конец E-mail -----------------//

 //-------------------------------------Телефон рабочий-----------------//

function man_phone_work_test()
{
   reg_s=/[^+0-9()\\-]/i
   str = document.getElementById("man_phone_work_id").value;
   if (str=='')
     {
       man_phone_work_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if ((stat))
     {
       man_phone_work_test_bad();
     }
   else
     {
         if (str.length<7)
           {
             man_phone_work_length();
           }
         else
           {
             document.getElementById("man_phone_work_img").innerHTML='<img src="images/validated.gif"  border=0>';
             document.getElementById("man_phone_work_res").innerHTML='';
             document.getElementById("man_phone_work_e").value='g';
           }
     }
}

function man_phone_work_test_foc()
{
            login_1 = document.getElementById("man_phone_work_id").value;
            if (login_1=='')
              {
                document.getElementById("man_phone_work_img").innerHTML='<img src="images/required.gif"  border=0>';
                document.getElementById("man_phone_work_res").innerHTML='<font color="#F73460"></font>';
                document.getElementById("man_phone_work_e").value='b';
              }
}

function man_phone_work_test_bad()
{

                document.getElementById("man_phone_work_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
                document.getElementById("man_phone_work_res").innerHTML='<font color="#F73460">Доступны только 0-9 + ( ) -</font>';
                document.getElementById("man_phone_work_e").value='b';
}

function man_phone_work_length()
{
                document.getElementById("man_phone_work_img").innerHTML='<img src="images/required.gif"  border=0>';
                document.getElementById("man_phone_work_res").innerHTML='<font color="#F73460">Не меньше 7 символов</font>';
                document.getElementById("man_phone_work_e").value='b';
}

 //------------------------------------- Конец Телефон рабочий -----------------//


 //-------------------------------------Мобильный телефон-----------------//
function man_phone_mob_test()
{
   reg_s=/[^+0-9()\\-]/i
   str = document.getElementById("man_phone_mob_id").value;
   if (str=='')
     {
       man_phone_mob_test_foc();
       return;
     }
   stat=keyFilter(str,reg_s);
   if (stat)
     {
       man_phone_mob_test_bad();
     }
   else
     {
           if (str.length<7)
             {
               man_phone_mob_length();
             }
           else
             {
               document.getElementById("man_phone_mob_img").innerHTML='<img src="images/validated.gif"  border=0>';
               document.getElementById("man_phone_mob_res").innerHTML='';
               document.getElementById("man_phone_mob_e").value='g';
             }
     }

}

function man_phone_mob_test_foc()
{
            login_1 = document.getElementById("man_phone_mob_id").value;
            if (login_1=='')
              {
                document.getElementById("man_phone_mob_img").innerHTML='<img src="images/blank.gif"  border=0>';

                document.getElementById("man_phone_mob_res").innerHTML='';
                document.getElementById("man_phone_mob_e").value='g';
              }
}

function man_phone_mob_test_bad()
{              document.getElementById("man_phone_mob_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("man_phone_mob_res").innerHTML='<font color="#F73460">Доступны только 0-9 + ( ) -</font>';
               document.getElementById("man_phone_mob_e").value='b';
}

function man_phone_mob_length()
{
               document.getElementById("man_phone_mob_img").innerHTML='<img src="images/required_invalid.gif"  border=0>';
               document.getElementById("man_phone_mob_res").innerHTML='<font color="#F73460">Не меньше 7 символов</font>';
               document.getElementById("man_phone_mob_e").value='b';
}

 //------------------------------------- Конец Мобильный телефон-----------------//


function submit_reg_dealer(ie)
 {
    company_name_test();
    company_site_test();
    company_adress_test();
    director_fio_test();
    work_exp_test();
    oborot_test();
    man_fio_test();
    man_post_test();
    man_email_test();
    man_phone_work_test();
    man_phone_mob_test();

    count_e=0;


        if (document.getElementById("company_name_e").value=='b')
           count_e=count_e+1;

        if (document.getElementById("company_site_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("company_adress_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("director_fio_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("work_exp_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("oborot_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("man_fio_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("man_post_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("man_email_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("man_phone_work_e").value=='b')
           count_e=count_e+1;
        if (document.getElementById("man_phone_mob_e").value=='b')
           count_e=count_e+1;


           if (count_e==0)
            {
              return true;
            }
           else
            {
              document.getElementById("errOutput").innerHTML='Обнаружено '+ count_e + ' ошибок!';
              return false;
            }
 }

//--------------------------- Конец Анкета диллера ------------------------------------
//-----------------------------------------------------------------------------

//--------------------------- Служба обратного звонка -------------------------
function call_me(tovar_kod){
        text="include/call_me.php?tovar_kod="+tovar_kod;
        call_me_window1=window.open(text,"call_me_window","width=430,height=320,scrollbars=yes,resizable=yes, screenX=250,screenY=0,alwaysLowered=yes");
        call_me_window1.moveTo(0,0);
}
//----------------------------Конец службы обратного звонка -------------------