// JavaScript Document
function search(page)
{
  var razdel = $('select[name=razdel]').val();
    var words = $('input[name=words]').val();
    $('input[name=search]').val(words);
  if(!page) page = '/faq/' + razdel + '/';
  $('#search_main_form').attr('action', page).submit();
}
function ssearch(page)
{
  if(page) {
    $("#search_page").val(page);
  }
  majax("search_result","/ajax/search/getList/", $("#search_form").serializeArray());
}// JavaScript Document
$(document).ready(function(){
  //Поиск по модулю FAQ. Стоит вынести в отдельный JS и подключать только к модулю FAQ.
  $('input[name|=go_search]').click(function() {
    var model = $('select[name=model]').val();
    var razdel = $('select[name=razdel]').val();
    var words = $('input[name=words]').val();
    $('input[name=search]').val(words);
    $('#search_main_form').attr('action', '/faq/' + razdel + '/' + model + '/').submit();     
  })
  /*
  $('#col3_content ul li').hover(
  function() {
  var part1 = $(this).parent().attr('class');
  var part2 = $(this).attr('class');      
  if ( part2 != '' ) { part2 = '_' + part2; }
  
  $(this).css('backgroundImage', 'url(/images/' + part1 + '_item' + part2 + '_hover_bg.gif)');
}, function() {
  var part1 = $(this).parent().attr('class');
  var part2 = $(this).attr('class');
  if ( part2 != '' ) { part2 = '_' + part2; }
  
  $(this).css('backgroundImage', 'url(/images/' + part1 + '_item' + part2 + '_bg.gif)');
}
  );
  */
  var sco11_height = $('#scol1').height();
  var sco12_height = $('#scol2').height();

  if ( sco11_height > sco12_height ) {

    $('#scol2').height( sco11_height );
    $('#scol3').height( sco11_height );
  } else {

    $('#scol1').height( sco12_height );
    $('#scol3').height( sco12_height );
  }
  /*lenux // для навигатора по моделям на главной странице */
  if ($("#tbl_model").length!=0){
    setInterval('move()',50);
    setInterval('chgDX()',250);
  }
});


/*lenux // для навигатора по моделям на главной странице */
var dx=0;
var stop=1;
var inc_dx=0;
var buts_show=new Array();

function moveRight() {
  hideButts();
  dx=-10;
  stop=0;
  inc_dx=-2;
 }
function moveLeft() {
  hideButts();
  dx=10;
  stop=0;
  inc_dx=2;
}
function chgDX() {
  if(!stop)
    dx=dx+inc_dx;
}
function moveStop() {
  dx=0;
  stop=1;
}
function showButt(id) {
  $("#but"+id).show().css("display","inline");
  buts_show[buts_show.length]=id;
}
function hideButts() {
  for(i=0;i<buts_show.length;i++) {
    $("#but"+buts_show[i]).hide();
  }
  buts_show=new Array();
}
function moveTo(sel) {
  model_id = sel.selectedIndex;
  x=0;
  if(model_id==1) {x=0;} //FIAT 500
  if(model_id==2) {x=-250;} //Panda
  if(model_id==3) {x=-490;} //Panda 4x4
  if(model_id==4) {x=-730;} //Punto 3d
  if(model_id==5) {x=-970;} //Punto 5d
  if(model_id==6) {x=-1205;} //BRAVO
  if(model_id==7) {x=-1450;} //Albea
  if(model_id==8) {x=-1690;} //SEDICI
  if(model_id==9) {x=-1925;} //Croma
  if(model_id==10) {x=-2170;} //Doblo panorama
  if(model_id==11) {x=-2410;} //Doblo Cargo
  if(model_id==12) {x=-2650;} //Ducato
  $("#tbl_model").css("margin-left",x+"px");
}
function move() {
  if ($("#tbl_model").length!=0){
    newNode = $("#tbl_model");
    x=parseInt($(newNode).css("marginLeft"));
    new_x=x+dx;
    if(new_x<=0 && new_x>=-2650) {
      $(newNode).css("marginLeft",new_x);
    } else {
      stop=1;
    }
  }
}
/*// lenux // для навигатора по моделям на главной странице */
