$(document).ready(function(){  
  $(".menu a").click(function() {
    var adresa = $(this).attr("href");
    document.location.href=adresa;
  }); 
  $(".tlacitka img").hover(function() {
    var src = $(this).attr("id")+"2.png";
    $(this).attr("src", src);
  },
  function()  {
    var src = $(this).attr("id")+"1.png";
    $(this).attr("src", src);
  });
  $("div.pravy").hover(
    function()  {
      document.getElementById("stop").value="1";
    },
    function()  {
      document.getElementById("stop").value="0";
    }
  );
  $("input, select, textarea").focus(function() {
    $(this).addClass("actual");
  });
  jQuery("input, select, textarea").blur(function() {
    $(this).removeClass("actual");
  });
$("div.a").hover(function() {
    var id = $(this).attr("id");
    $("#"+id+" a.submenu").addClass("submenu_aktive");
    if ($("#"+id+" div.skryty").is(":hidden")) {
      $("#"+id+" div.skryty").slideDown(300);
    }
  },
  function()  {
    var id = $(this).attr("id");
    $("#"+id+" div.skryty").slideUp(300);
    $("#"+id+" a.submenu").removeClass("submenu_aktive");
  });
  
});
function posuvnik_dolu() {
  setTimeout("posun_dolu()", 5000);
}
function posun_dolu()  {
  var stop=document.getElementById("stop").value;
  if (stop=="0")  {
    var width = $("#posuvnik").height();
    var pocet = width / 154;
    if (c<= (pocet-3))  {
      $("#posuvnik").animate({"top": "-=154px"}, "slow");
      c++;
    }
    else  {
      var posun = width-462;
      $("#posuvnik").animate({"top": "+="+posun+"px"}, 2000);
      c=1;
    }
  }
  posuvnik_dolu();
}
function posun_dolu1()  {
  var width = $("#posuvnik").height();
  var pocet = width / 154;
  if (c<= (pocet-3))  {
    $("#posuvnik").animate({"top": "-=154px"}, "slow");
    c++;
  }
  else  {
    var posun = width-462;
    $("#posuvnik").animate({"top": "+="+posun+"px"},2000);
    c=1;
  }
}
function posun_nahoru()  {
  var width = $("#posuvnik").height();
  var pocet = width / 154;
  if (c > 1)  {
    $("#posuvnik").animate({'top': '+=154px'}, "slow");
    c--;
  }
  else  {
    var posun = width-462;
    $("#posuvnik").animate({"top": "-="+posun+"px"}, 2000);
    c=(pocet-2);
  }
}
function otevri(nabidka)  {
  if ($("#"+nabidka).is(":hidden")) {
    $("#"+nabidka).slideDown(500);
  }
  else  {
    $("#"+nabidka).slideUp(500);
  }
}
  function displayVals() {
    var kategorie = $("#objednavka").val();
    if (kategorie=="Objednávka")  {
      $("select#sluzba").removeAttr("disabled");
    }
    else  {
      $("select#sluzba").attr("disabled", "disabled");
    }
  } 
  displayVals();
