
function proizvoditel()
  {
    var color;
    col = document.getElementById('select_proizvoditel');
    col2 = document.getElementById('select_marka');
    color = document.getElementById('select_proizvoditel').value;
    if (color == ""){

      return;
    }else{
      $("#select_marka").load('/ajax/cars_models.php?car='+color,function(){
        col2.selectedIndex=0;
        document.getElementById('select_marka').disabled = false;
      });
    }
  }
  function marka()
  {
    var color;
    col = document.getElementById('select_marka');
    col2 = document.getElementById('select_god_vipuska');
    color = document.getElementById('select_marka').value;

    if (color == ""){
      document.getElementById('select_god_vipuska').disabled = true;
      return;
    }else{
      $("#select_god_vipuska").load('/ajax/cars_year.php?model='+color,function(){
        col2.selectedIndex=0;
        document.getElementById('select_god_vipuska').disabled = false;
      });
    }
  }
  function god_vipuska()
  {
    var color;
    col = document.getElementById('select_god_vipuska');
    col2 = document.getElementById('select_modifikacia');
    color = document.getElementById('select_god_vipuska').value;
    if (color == ""){
      document.getElementById('select_modifikacia').disabled = true;
      return;
    }else{
      $("#select_modifikacia").load('/ajax/cars_mod.php?model='+color,function(){
        col2.selectedIndex=0;
        document.getElementById('select_modifikacia').disabled = false;
      });
    }
  }
  function modifikacia()
  {
    var color;
    color = document.getElementById('select_modifikacia').value;
    if (color == null)
      return;
      document.getElementById('pokazat').style.display = 'block';
      document.getElementById('pokazat_div').style.display = 'none';
  }
  
  function get_url(){
    if(document.getElementById('select_marka').disabled == false){
    if(document.getElementById('select_god_vipuska').disabled == false){
    if(document.getElementById('select_modifikacia').disabled == false){
      document.location.href="/tires/auto-"+document.getElementById('select_modifikacia').value+"/";
      close_wind();
    }}}
  };
  
  function get_url_en(){
    if(document.getElementById('select_marka').disabled == false){
    if(document.getElementById('select_god_vipuska').disabled == false){
    if(document.getElementById('select_modifikacia').disabled == false){
      document.location.href="/en/tires/auto-"+document.getElementById('select_modifikacia').value+"/";
      close_wind();
    }}}
  };

$(function(){
  var animated = 0;
  var bh = $(window).height();
  var ch = $(".container2").height();
  var acte;

  if (bh > ch) { 
    $(".container2").height(bh);
  }
  $(".inner .home_menu li").hover(
    function () {
      acte=$(this);
      if (animated == 0) {
        animated = 1;
        $(acte).addClass("act");
        $(".category").each(function(e){
          var n =  $(acte).attr("rel");
          if($(this).hasClass("category"+n)){
            
          }else{
            $(this).animate({opacity: '0.5'  }, 0, function() { animated = 0 })
          }
        });
      }
    },
    function () {
      var n =  $(this).attr("rel");
      $(this).removeClass("act");
      $(".category").animate({opacity: '1'  }, 0, function() {  });
    }
  );
  $(".inner .home_menu li").hover(
    function () {
      var n =  $(this).attr("rel");
      $(this).addClass("act");
    },
    function () {
      var n =  $(this).attr("rel");
      $(this).removeClass("act");
    }
  );
  $('.ul_oil .oil_link a').click(function() {
    var m =  $(this).attr("class");
    if (m == "act") {  } else {
      $('.ul_oil li').removeClass("act");
      $(this).parent(".oil_link").parent("td").parent("tr").parent("tbody").parent("table").parent("li").addClass("act");
    }
  });
  $('.oil_ul > li > .oil_bg > a').click(function() {
    var m =  $(this).attr("class");
    if (m == "act") {  } else {
      $('.oil_ul li').removeClass("act");
      $(this).parent(".oil_bg").parent("li").addClass("act");
    }
  });
  $('.oil_ul2 > li > .oil_bg > a').click(function() {
    var m =  $(this).attr("class");
    if (m == "act") {  } else {
      $('.oil_ul2 li').removeClass("act");
      $(this).parent(".oil_bg").parent("li").addClass("act");
    }
  });

  $('.oil_head').click(function() {
    var m =  $(this).attr("rel");
    var cl =  $(this).children("img").attr("class");
    var i = $("div.no_und");
    
    if (cl == "img_und") {

        $(this).removeClass('no_und');
        $(this).children("img").removeClass('img_und');
        $(".oiln_ul"+m).toggle();
     }
    else {


    $('.oil_head img').removeClass("img_und");
    $('.oil_head').removeClass("no_und");
    $(".oiln_ul").hide();
    $(this).addClass('no_und');
    $(this).children("img").addClass('img_und');
    $(".oiln_ul"+m).toggle();    }
  });


});
