/*
jQuery.timer = function(time,func,callback){
var a = {timer:setTimeout(func,time),callback:null}
if(typeof(callback) == 'function'){a.callback = callback;}
return a;
};

jQuery.clearTimer = function(a){
	clearTimeout(a.timer);
	if(typeof(a.callback) == 'function'){a.callback();};
	return this;
};
*/

$(document).ready(function () {	
	var MenuTimer;
	var vykdyti = true;
	$('#nav1 li').hover(
		function () {
			//show its submenu
			//$('#nav2', this).css({'display' : 'block'});
			$('ul', this).slideDown(50);
			
			var UlWidth = 0;
			$('ul span', this).each(function(){
				//alert($(this).html() + " " + $(this).width())
				if (UlWidth < $(this).width()) {UlWidth = $(this).width()}
			});
			$('ul', this).width(UlWidth+20);
		}, 
		function () {
			//hide its submenu
			$('ul', this).slideUp(50);			
		}
	);
	
	$('#nav1 > li').mouseover(
		function(){
		clearTimeout(MenuTimer);
		vykdyti = false;
			$(this).css({'background-color' : '#BA1819'});

		}
	);

	$('#nav1 > li').mouseout(
		function(){
			$(this).css({'background-color' : ''});

		}
	);
	
});

