<!--
function init_manuf() {
  manuf = document.all.poisk.set_manuf_options.options;        // Initialize models
  manuf.length = 0;
  //manuf[0] = new Option('-Производитель-', 0, false, false);
  manuf_array=manuf_str.split(';');
  for(i=0;i<manuf_array.length; i++) {
    manuf_pair=manuf_array[i].split(':');
    manuf[manuf.length] = new Option(manuf_pair[1], manuf_pair[0] +':'+manuf_pair[1], false, false);
  }
}
function select_manuf(manuf_name) {
  manuf = document.all.poisk.set_manuf_options.options;        // Initialize models
  for(i=0;i<manuf.length;i++) {
    my_arr = document.all.poisk.set_manuf_options[i].value.split(':');
    if (my_arr[1]==manuf_name)
      document.all.poisk.set_manuf_options[i].selected = true;
  }
}
function load_model(model) {
  model_id = model.split(':')[0];
  model = document.all.poisk.set_model_options.options;
  model.length=0;
  //model[0] = new Option('-Модель-', 0, false, false);
  model_array=model_str.split(';');
  for(i=0;i<model_array.length; i++) {
    model_pair=model_array[i].split(':');
    if(model_pair[0]==model_id) {
      model[model.length] = new Option(model_pair[1], model_pair[0]+':'+model_pair[1], false, false);
    }
  }
}
function load_model_parts(model) {
  model_id = model.split(':')[0];
  model = document.all.poisk.set_model_options.options;
  model.length=0;
  model[0] = new Option('-Модель-', 0, false, false);
  model_array=model_str.split(';');
  for(i=0;i<model_array.length; i++) {
    model_pair=model_array[i].split(':');
    if(model_pair[0]==model_id) {
      model[model.length] = new Option(model_pair[1], model_pair[0]+':'+model_pair[1], false, false);
    }
  }
}
function select_model(model_name) {
  model = document.all.poisk.set_model_options.options;        // Initialize models
  for(i=0;i<model.length;i++) {
    my_arr = document.all.poisk.set_model_options[i].value.split(':');
    if (my_arr[1]==model_name)
      document.all.poisk.set_model_options[i].selected = true;
  }
}
function hidearea(get_string) {
  p = get_string.split(':')[2];
  p.charAt(0) != '0' ? hidefield(document.all.poisk.set_manuf_options,'1','#fff') : hidefield(document.all.poisk.set_manuf_options,'0','#fff');
  p.charAt(1) != '0' ? hidefield(document.all.poisk.set_model_options,'1','#fff') : hidefield(document.all.poisk.set_model_options,'0','#fff');
  p.charAt(2) != '0' ? hidefield(document.all.poisk.kuzov_code,'1','#fff') : hidefield(document.all.poisk.kuzov_code,'0','#eee');
  p.charAt(3) != '0' ? hidefield(document.all.poisk.optic_code,'1','#fff') : hidefield(document.all.poisk.optic_code,'0','#eee');
  p.charAt(4) != '0' ? hidefield(document.all.poisk.eng_code,'1','#fff') : hidefield(document.all.poisk.eng_code,'0','#eee');
  if(p.charAt(5) =='0')
    hidecheckbox(document.all.poisk.FR,1);
  else
    hidecheckbox(document.all.poisk.FR,0);
  if(p.charAt(6) =='0')
    hidecheckbox(document.all.poisk.RL,1);
  else
    hidecheckbox(document.all.poisk.RL,0);
  if(p.charAt(7) =='0')
    hidecheckbox(document.all.poisk.UD,1);
  else
    hidecheckbox(document.all.poisk.UD,0);
}
function hidearea3(get_string) {
  p = get_string.split(':')[2];
  p.charAt(0) != '0' ? hidefield(document.all.poisk.set_manuf_options,'1','#fff') : hidefield(document.all.poisk.set_manuf_options,'0','#fff');
  p.charAt(1) != '0' ? hidefield(document.all.poisk.set_model_options,'1','#fff') : hidefield(document.all.poisk.set_model_options,'0','#fff');
  p.charAt(2) != '0' ? hidefield(document.all.poisk.kuzov_code,'1','#fff') : hidefield(document.all.poisk.kuzov_code,'0','#eee');
  p.charAt(3) != '0' ? hidefield(document.all.poisk.optic_code,'1','#fff') : hidefield(document.all.poisk.optic_code,'0','#eee');
  p.charAt(4) != '0' ? hidefield(document.all.poisk.eng_code,'1','#fff') : hidefield(document.all.poisk.eng_code,'0','#eee');
}
function hidefield(field,op,color) {
  if(op=='1') {
    field.disabled = false;
    field.style.backgroundColor = color;
  }
  if(op=='0') {
    field.disabled = true;
    field.style.backgroundColor = color;
  }
}
function hidecheckbox(checkbox_name,op) {
  if (op=='1') {
    checkbox_name[0].disabled = true;
    checkbox_name[1].disabled = true;
    checkbox_name[2].disabled = true;
  }
  if(op=='0') {
    checkbox_name[0].disabled = false;
    checkbox_name[1].disabled = false;
    checkbox_name[2].disabled = false;
  }
}
function hidearea2(get_string) {
  p = get_string.split(':')[2];
  p.charAt(0) != '0' ? set_manuf_options_id.style.display = '' : set_manuf_options_id.style.display = 'none';
  p.charAt(1) != '0' ? set_model_options_id.style.display = '' : set_model_options_id.style.display = 'none';
  p.charAt(2) != '0' ? kuzov_id.style.display = '' : kuzov_id.style.display = 'none';
  p.charAt(3) != '0' ? optic_id.style.display = '' : optic_id.style.display = 'none';
  p.charAt(4) != '0' ? engine_id.style.display = '' : engine_id.style.display = 'none';
  if(p.charAt(5) =='0')
    FR_id.style.display = 'none';
  else
    FR_id.style.display = '';
  if(p.charAt(6) =='0')
    RL_id.style.display = 'none';
  else
    RL_id.style.display = '';
  if(p.charAt(7) =='0')
    UD_id.style.display = 'none';
  else
    UD_id.style.display = '';
}
function check_avto() {
  var ind, my_error; 
  ind = 0;
  my_error = '';
  if (document.forms['poisk'].set_manuf_options.value=='0'){
    ind = 1;
    my_error+='\nВы не указали "Производителя"';
  }
  if (document.forms['poisk'].set_model_options.value=='0'){
    ind = 1;
    my_error+='\nВы не указали "Модель"';
  }
  if ((document.forms['poisk'].eng_v.value<1)||(document.forms['poisk'].eng_v.value>100000)||(document.forms['poisk'].eng_v.value=='')){
    my_error+='\nНеверно указан "Объем"';
    ind = 1;
  }
  if ((document.forms['poisk'].price.value==0)||(document.forms['poisk'].price.value<-2)||(document.forms['poisk'].price.value=='')){
    my_error+='\nНеверно указана "Цена"';
    ind = 1;
  }
  if ( ind == 1 )
    alert(my_error);
  else
    document.forms['poisk'].submit();
}
function check_form_upload() {
  if ( 
       (document.forms['poisk'].foto.value=='') &&
       (document.forms['poisk'].foto2.value=='') &&
       (document.forms['poisk'].foto3.value=='') &&
       (document.forms['poisk'].foto4.value=='') &&
       (document.forms['poisk'].foto5.value=='') &&
       (document.forms['poisk'].foto6.value=='') &&
       (document.forms['poisk'].foto7.value=='')
     )
    alert('\nНе указана фотография для загрузки');
  else {
    document.forms['poisk'].is_foto_upload.value=1;
    document.forms['poisk'].submit();
  }
}
function check_form_remove_image(s) {
  s_arr = s.split(':');
  var is_confirmed = confirm('\nУбрать фото номер '+s_arr[0]+'.\n Вы уверены ?');
  if (is_confirmed==1) {
    document.forms['poisk'].foto_remove.value=s_arr[1];
    document.forms['poisk'].submit();
  }
}
function check_form_replace_image(s) {
  document.forms['poisk'].foto_replace.value=s;
  document.forms['poisk'].submit();
}
function check_form_are_you_sure(i) {
  var is_confirmed = confirm('\nУдалить '+i+'-ю позицию.\n Вы уверены ?');
  if (is_confirmed==1) 
    document.forms['are_you_sure'+i].submit();
}
//-->
