

// pocet polozek v hlavnim menu

function sumapolozek(){
/*
	var i=0;

	jQuery('a').filter('.external').each(function(){i++;});

	return i;
//*/
return coutermenuitems;
	
	}

	

// vypocita vysku polozek menu

function vyskali(){

	var v = sumapolozek();

	var vyskamenu = 264;

	var vyska = 0;

	vyska = vyskamenu / v;
	return vyska;


	}



// fce pro vyjeti menu

function makeTall()

{

        // nastavim vysku polozek aby byly stejne

        var h = vyskali();

        $(this).children('ul').children('li').css("height",h+"px");

        $(this).children('ul').children('li').children('a').css("height",h+"px");



        // posledni polozka vetsi spodni padding

        //$(this).children('ul').children('li:last').css("height",(h+4)+"px");

        //$(this).children('ul').children('li:last').children('a').css("height",(h+4)+"px");

        

        

        // vyjeti nahoru/dolu

        var count = sumapolozek();

        var sub_count = $(this).children('ul').children('li').length;

        var poradi = $(this).attr('data-index');



        var nahoru = false;

        if ((count-poradi)<sub_count) nahoru = true;

        if (nahoru && (poradi+1)<sub_count) nahoru = false;



        

        if (nahoru)

        {

            $(this).children('ul').css("top", "-"+(sub_count*h-1)+"px");

        }

        else

        {

            $(this).children('ul').css("top", "-"+h+"px");

        }



        // animace

        $(this).children('ul').show().animate({left: '209px'}, 250);

}



// fce pro zajeti menu

function makeShort() {

        if("\v"!="v")

            $(this).children('ul').hide({left: '0px', display: 'none'},function() {

              $(this).hide('fast');

            });

		else

            $(this).children('ul').hide();

}





$(document).ready(function() {


	$("a.lightbox").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': false
	});



 // menu

    var config = {

	over: makeTall, // function = onMouseOver callback (REQUIRED)

	timeout: 250, // number = milliseconds delay before onMouseOut

	out: makeShort // function = onMouseOut callback (REQUIRED)

	};

	$('#hl_menu li').hoverIntent(config);









var h = vyskali();



$('#hl_menu').children('li').each(function(index){ $(this).attr('data-index',index); });


$('#hl_menu li').css("height", h);

                             
$('#hl_menu a.external').css("height", h);
                                      
                                     
//$('#hl_menu a.external:last').css('height', h+4);







function openBlock(openingDivID, button){

									  openingDivID.find(".ie7bug").css("display","block");

									  var divToResize = openingDivID;

									  var childDiv = divToResize.children();

									  								  

									  divToResize.css("height", childDiv.height());

									  button.css("display","none");

									  openingDivID.find(".gradient").css("display","none");

									  }

									  

function closeBlock(openingDivID){

									  openingDivID.css("height", 120);

									  openingDivID.find(".next_button").css("display","block");

									  openingDivID.find(".gradient").css("display","block"); 
									  openingDivID.find(".ie7bug").css("display","none");
}
									  
									  



jQuery(".next_button").click(function(){

									    openBlock($(this).parent().parent(),$(this));

										 

									  });



jQuery(".prev_button").click(function(){

									    closeBlock($(this).parent().parent().parent());

										

									  });

							 

							 

							 

});

/*function fixvyska(){

	var suma = sumapolozek();

	var heightli = vyskali();

	var fix = 0;

	

	if (suma > 5){

		fix = heightli - 0.65;}

		

	if (suma<5){

		fix = heightli + 0.5;}

		

	if (suma == 5){

		fix = heightli;}

		

	return fix;

	}*/


$(function()
{
var userAgent = navigator.userAgent.toLowerCase();
var userBrowserName  = navigator.appName.toLowerCase();
$.browser = {
	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
	safari: /webkit/.test( userAgent ),
	opera: /opera/.test( userAgent ),
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ),
	name:userBrowserName
};
});



























