function f_per(){
  window.location.replace("/o_list/");
}

function fvote(e){
   document.getElementById("p_opros").value=e
}

function testFormR(){
        if (document.getElementById("login_aut").value=="") {alert("Не введен логин"); return false;}
        if (document.getElementById("email_aut").value=="") {alert("Не введен email"); return false;}
        if (document.getElementById("pass1_aut").value=="") {alert("Не введен пароль"); return false;}
        if (document.getElementById("pass2_aut").value=="") {alert("Не введен повтор пароля"); return false;}
        if (document.getElementById("pass1_aut").value!=document.getElementById("pass2_aut").value) {alert("Пароль и повтор пароля не совпадают"); return false;}
        if (document.getElementById("intgg").value=="") {alert("Не введен код с картинки"); return false;}
        return true;
}
function testFormU(){
        if (document.getElementById("login_aut").value=="") {alert("Не введен логин"); return false;}
        if (document.getElementById("email_aut").value=="") {alert("Не введен email"); return false;}
        if (document.getElementById("tpas_aut").value=="") {alert("Не введен текущий пароль"); return false;}
        if (document.getElementById("pass1_aut").value!="") {
          if (document.getElementById("pass1_aut").value!=document.getElementById("pass2_aut").value) {alert("Пароль и повтор пароля не совпадают"); return false;}		 
		}
        if (document.getElementById("user_name").value=="") {alert("Не введено имя"); return false;}
        if (document.getElementById("user_sirname").value=="") {alert("Не введена фамилия"); return false;}
        if (document.getElementById("user_day").value==0) {alert("Не выбран год рождения"); return false;}
        if (document.getElementById("user_month").value==0) {alert("Не выбран год рождения"); return false;}
        if (document.getElementById("user_year").value==0) {alert("Не выбран год рождения"); return false;}
        return true;
}
function testFormPg(){
   if (document.getElementById("login_mail").value=="") {alert("Не введен email"); return false;}
   return true;
}

function testFormRm(){
   if (document.getElementById("term").value=="") {alert("Не введен email"); return false;}
   if (document.getElementById("term").value=="Ваш e-mail") {alert("Не введен email"); return false;}
   return true;
}


function f_find_cl1(e){
  if (e==1){
       if (document.getElementById("login_aut2").value=='Логин')  document.getElementById("login_aut2").value='';
  }
  if (e==2){
       if (document.getElementById("login_aut2").value=='')  document.getElementById("login_aut2").value='Логин';
  }
}

function f_find_cl2(e){
  if (e==1){
       if (document.getElementById("term").value=='Ваш e-mail')  document.getElementById("term").value='';
  }
  if (e==2){
       if (document.getElementById("term").value=='')  document.getElementById("term").value='Ваш e-mail';
  }
}

function f_find_cl3(e){
  if (e==1){
       if (document.getElementById("search").value=='Поиск на сайте')  document.getElementById("search").value='';
  }
  if (e==2){
       if (document.getElementById("search").value=='')  document.getElementById("search").value='Поиск на сайте';
  }
}

function f_fpp(){
 document.getElementById('s_div1').style.display="none";
 document.getElementById('s_div2').style.display="";
 document.getElementById('pass_aut').focus()
}
function f_fp(){
   if(document.getElementById('pass_aut').value==""){
      document.getElementById('s_div2').style.display="none";
      document.getElementById('s_div1').style.display="";
   }
}

function f_chen(e){
 document.getElementById("in_ch_tr").value=e;
 document.f_ch_tr.submit();
}

function f_over(e){
 $("#s"+e).fadeOut("fast")
 $("#"+e).fadeIn("fast") 
}
function f_out(e){
 $("#"+e).fadeOut("fast") 
 $("#s"+e).fadeIn("fast")
}
function f_over2(e){
 $("#s"+e).hide("fast")
 $("#"+e).show("fast") 
}
function f_out2(e){
 $("#"+e).hide("fast") 
 $("#s"+e).show("fast")
}

function f_com(e){
 document.getElementById("d_com1").style.display="none"; 
 document.getElementById("d_com2").style.display="none";
 document.getElementById("d_com3").style.display="none";
 document.getElementById("d_com1x").style.display="none";
 document.getElementById("dv_1p").className="vkl2_inner";
 document.getElementById("dv_2p").className="vkl2_inner";
 document.getElementById("dv_3p").className="vkl2_inner";
 document.getElementById("cod_form").value=e; 
 if (e==1){ // открытие тех. характеристик
   document.getElementById("d_com1").style.display=""; 
   document.getElementById("dv_1p").className="vkl1_inner";
 }
 if (e==2){ // открытие комментариев
   document.getElementById("d_com1x").style.display="";
   document.getElementById("d_com2").style.display=""; 
   document.getElementById("dv_2p").className="vkl1_inner";
 }
 if (e==3){ // открытие объявлений
   document.getElementById("d_com1x").style.display="";
   document.getElementById("d_com3").style.display="";
   document.getElementById("dv_3p").className="vkl1_inner";
 }
}
function check_but(f) {
f.act_pic.value=0
var about = !f.about.disabled?f.about.value:"";
var mail = !f.email.disabled?f.about.value:"";
var ingg = !f.intgg.disabled?f.intgg.value:""; 
var name = !f.name.disabled?f.name.value:"";
f.add.disabled = !(about != '' && name !='' && mail !='' && ingg !='');
}
function check_butb(f) {
var about = !f.about.disabled?f.about.value:"";
var mail = !f.email.disabled?f.about.value:"";
var ingg = !f.intgg.disabled?f.intgg.value:""; 
var name = !f.name.disabled?f.name.value:"";
f.add.disabled = !(about != '' && name !='' && mail !='' && ingg !='');
}
function textAreaCounter(path) {
  xd=path.value.length
  if (xd>250) xd=250
  document.getElementById('textarea-string').innerText = '(' + (250 - xd) + ')';

  if(path.value.length > 250) {
    path.value = path.value.substr(0,250);
    return false;
  }
}
function f_clim(e,f){
 for (x=1;x<=f;x++){
  $("#div_imf"+x).hide("fast")
 }
  $("#div_imf"+e).show("fast")
}
function CheckToSubmit1(){
  if (document.getElementById("fData[1]").value=="") {alert("Не введено название фирмы"); return false;}
  if (document.getElementById("fData[5]").value=="") {alert("Не введено телефон фирмы"); return false;}
  if (document.getElementById("fData[7]").value=="") {alert("Не введено контактный e-mail"); return false;}
  if (document.getElementById("fData[8]").value=="") {alert("Не введена фамилия контактного лица"); return false;}
  if (document.getElementById("fData[9]").value=="") {alert("Не введено имя контактного лица"); return false;}
}
function CheckToSubmit2(){
  if (document.getElementById("fData[1]").value=="") {alert("Не введено телефон"); return false;}
  if (document.getElementById("fData[3]").value=="") {alert("Не введено контактный e-mail"); return false;}
  if (document.getElementById("fData[4]").value=="") {alert("Не введена фамилия контактного лица"); return false;}
  if (document.getElementById("fData[5]").value=="") {alert("Не введено имя контактного лица"); return false;}
}
function f_ch_selch(e){
 if (e>0) x="/issled/"+e+"/"
 else x="/issled/"
 window.location.replace(x);
}

function f_enfi(){
  document.getElementById("li_par5").disabled=0
  document.getElementById("li_par5_click").value=1
}
function f_difi(){
  document.getElementById("li_par5").disabled=1
  document.getElementById("li_par5_click").value=2
}
function del_li_par5_pic(){
  document.getElementById("li_par5_sel").value=""
}

function check_disability2() {
 if (($("#com_name").val()!="")&&($("#fio_name").val()!="")&&($("#d1_name").val()!="")&&($("#d2_name").val()!="")&&($("#d3_name").val()!="")&&($("#l1_name").val()!="")&&($("#d4_name").val()!="")&&($("#intgg").val()!="")) document.getElementById('add_but').disabled=0
 else  document.getElementById('add_but').disabled=1
}