		$(document).ready(function(){

		$.ajaxSetup({ cache: false });

    // odkryti 3.urovne
	  $(".treti-link").click(function(){
      $("#overlay").show();
      $("#menu .ctvrta").hide();
      
      var vyskarodic=$(this).parents(".druha").height();
      var vyska=$(this).parents(".treti").children(".ctvrta").height();
      vyska = vyska - vyskarodic;		
 
      var styl = {'position' : 'absolute',
      'margin' : '-'+vyska+'px 0 0 0'}; 
            
      $(this).parents(".treti").children("#menu .ctvrta").fadeIn('fast').css(styl);
  	});	      

    // tlacitko zpet
		$(".zpet").click(function(){
//		  $("#overlay").hide();
      $(this).parent().fadeOut('normal');
    });	
		
//    // popisky sekci ve 3.urovni
//		$(".ctvrta ul li a").mouseenter(function(){
//        $(this).children("span").show("fast");
//		});	
//
//		$(".ctvrta ul li a").mouseout(function(){
//      	$(this).children("span").hide("fast");
//		});	
//

     // onClick prvni uroven - zmena 27/10/09
    
      $(".prvni_link").click(function(){
            
          $(".druha").hide(100);
		  $("#overlay").show();
          $(".activehover").removeClass("activehover");
          $(".active").removeClass("active").addClass("activePast");
          
          $(this).addClass("activehover");
          $(".druha .treti").show();
          $(".ctvrta").hide();
          
          var vyska=$(this).parents(".prvni").children(".druha").height();
          vyska = vyska + 87;
          
          var styl = {'position' : 'absolute',
          'margin' : '-'+vyska+'px 0 0 0'
          };
          
          $(this).parents(".prvni").children("#menu .druha").fadeIn(50).css(styl);           
      });	
    
    // odkryvani menu
    
    var configShowMenu = {    
     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
     interval: 100, // number = milliseconds for onMouseOver polling interval    
     over: showMenu1, // function = onMouseOver callback (REQUIRED)    
     timeout: 200, // number = milliseconds delay before onMouseOut    
     out: hideMenu1 // function = onMouseOut callback (REQUIRED)    
    };
    
    function showMenu1(){
    };
    function hideMenu1(){};
    
    $(".prvni").hoverIntent( configShowMenu );    

    // skryvani menu

    var config = {    
     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
     interval: 50, // number = milliseconds for onMouseOver polling interval    
     over: showMenu, // function = onMouseOver callback (REQUIRED)    
     timeout: 200, // number = milliseconds delay before onMouseOut    
     out: hideMenu // function = onMouseOut callback (REQUIRED)    
    };
    
    function showMenu(){};
    function hideMenu(){ 
      $("#overlay").hide();   
      $(".druha").fadeOut("fast");
      $(".treti").fadeOut("slow");
      $(".ctvrta").hide();
      $(".activehover").removeClass("activehover");
      $(".activePast").removeClass("activePast").addClass("active");
    };
    
    $("#menu").hoverIntent( config );

    // oblíbení

    var url = this.URL; 
    var title = this.title
    
    // skryvani bookmarks
    
    var configbook = {    
     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
     interval: 100, // number = milliseconds for onMouseOver polling interval    
     over: showBook, // function = onMouseOver callback (REQUIRED)    
     timeout: 200, // number = milliseconds delay before onMouseOut    
     out: hideBook // function = onMouseOut callback (REQUIRED)    
    };   
    
    function showBook(){
    		$("#book-content").fadeIn('fast');
		    $("#book span").addClass("activebook");
		    $("#book-content ul").html('Nahrávám...');
		    $.get("favourites.php", { makefavourites: true },function(data){ $("#book-content ul").html(data); });
    };
    function hideBook(){
    
      $("#book-content").fadeOut('fast');
      $("#book span").removeClass("activebook");
      
    }; 
    
    $("#book").hoverIntent( configbook );
        
    /*
		$("#book").click(function(){
		    $("#book-content").fadeIn('fast');
		    $("#book span").addClass("activebook");
		    $("#book-content ul").html('Nahrávám...');
		    $.get("favourites.php", { makefavourites: true },function(data){ $("#book-content ul").html(data); });
   	});

    */
    // přidej položku
		$(".favourite_add").click(function(){
		  
		  $.get("favourites.php", { addurl: url, title: title }, function(data){
      
        $("#book-content ul").hide().html(data).fadeIn(500);

      } );
		  
		});


		});

