$(function() {
  aktivuj_slider();

  Cufon.replace("h2");
  Cufon.replace("#banner-zavodnici");
  Cufon.replace("#navigace a");
  Cufon.replace("#body p.vyber");
  //Cufon.replace("#banner-doprava");
  
  $("a[rel^='lightbox']").prettyPhoto({
	   animationSpeed:'slow',
     show_title:false,
     overlay_gallery:false,
     deeplinking:false,
     social_tools: '<div class="pp_social"></div>' /* html or false to disable */
	});
	
	$("#slider div.swrap").mouseover(function() {
    if ($(this).children("a").children("img").css("z-index")==1000) {
      $(this).children("div.shover").css("display", "block");
    }
  }).mouseleave(function() {
      $(this).children("div.shover").css("display", "none");
  });
});

function aktivuj_slider() {
  var typ = $("body").attr("class");
  if (typ=="uvod")
    $("#slider").theatre({
      effect: "3d",
      selector: "img",
      autoplay: false,
      controls: "none",
      width: "840px",
      height: "249px",
      itemWidth: "248px",
      itemHeight: "249px"
    });
  else
    $("#slider").theatre({
      effect: "horizontal",
      selector: "img",
      autoplay: false,
      controls: "none",
      width: "900px",
      height: "130px",
      itemWidth: "109px",
      itemHeight: "109px"
    });
    
  $("#slider-left").click(function() {
    $("#slider").theatre('prev');
    return false;
  });
  $("#slider-right").click(function() {
    $("#slider").theatre('next');
    return false;
  });
  
  var nahledy = $("#nahledy-wrap").val()
  if (nahledy!=null) {
    $("#nahledy").theatre({
      effect: "horizontal",
      selector: "a",
      autoplay: false,
      controls: "none",
      width: "660px",
      height: "110px",
      itemWidth: "218px",
      itemHeight: "110px"
    });
    
    $("#nahled-left").click(function() {
    $("#nahledy").theatre('prev');
    return false;
  });
  $("#nahled-right").click(function() {
    $("#nahledy").theatre('next');
    return false;
  });
  } 
}

$(document).ready(function(){
        
    $("#prihlaseni a").bind("click", function() {
        $("#login-dialog").load("_login-form.php");
        $("#login-dialog").dialog({
            modal: true,
            closeText: '',
            position: ['center',150]
        });
        return false;
    });
    
    $("#login-dialog").delegate("#zavrit", "click", function() {
        $("#login-dialog").dialog("close");
        return false;
    });

    
});
