/*--------------------------------------------------------------------
 * JQuery Plugin: "EqualHeights"
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 *
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Description: Compares the heights or widths of the top-level children of a provided element
 		and sets their min-height to the tallest height (or width to widest width). Sets in em units
 		by default if pxToEm() method is available.
 * Dependencies: jQuery library, pxToEm method	(article:
		http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/)
 * Usage Example: $(element).equalHeights();
  		Optional: to set min-height in px, pass a true argument: $(element).equalHeights(true);
 * Version: 2.0, 08.01.2008
--------------------------------------------------------------------*/

jQuery.fn.equalHeights = function(px) {
	jQuery(this).each(function(){
		var currentTallest = 0;
		jQuery(this).children().each(function(i){
			if (jQuery(this).height() > currentTallest) { currentTallest = jQuery(this).height(); }
		});
		//if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.toEm();  //use ems unless px is specified
		// for ie6, set height since min-height isn't supported
		if (jQuery.browser.msie && jQuery.browser.version == 6.0) { jQuery(this).children().css({'height': currentTallest}); }
		jQuery(this).children().css({'min-height': currentTallest});
	});
	return this;
};




// JavaScript Document



//Start Dropdown menu function

var timeout         = 200;

var closetimer		= 0;

var ddmenuitem      = 0;

function findPos(obj) {
	var curleft = curtop = 0;
        if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
			return curtop;
        }
}


function jsddm_open(){

 	jsddm_canceltimer();

//	jsddm_close();

	//var num = $('#containerDiv').height()
    var num = document.getElementById('containerDiv').style.height;
	//$("#pageMask").height(num);
    document.getElementById('pageMask').style.height = num;

	//document.getElementById('pageMask').style.visibility = "visible";
	//if (navigator.appName != "Microsoft Internet Explorer") {
		//jQuery("#pageMask").animate({opacity:"show"},"slow");
//		jQuery("#pageMask").animate({opacity:"show"},"medium").css("visibility","visible");
		jQuery("#pageMask").animate({opacity:"show"},0).css("visibility","visible");
	//}else{
	//	jQuery("#pageMask").show().css("visibility","visible");
	//}


	if (navigator.appName != "Microsoft Internet Explorer") {
		var coords = findPos(document.getElementById('navDiv'));
		document.getElementById('pageMask').style.top = coords + 34 - window.pageYOffset;
	}

	// alert(document.getElementById("navDiv").style.zIndex);

}



function jsddm_close(){


	//if (navigator.appName != "Microsoft Internet Explorer") {

	//if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
	jQuery("#pageMask").animate({opacity:"hide"},600).css('visibility','hidden');
	//}else{
	//	jQuery("#pageMask").hide().css("visibility","hidden");
	//}

	//jQuery("#pageMask").css("visibility","hidden");
	//jQuery("#pageMask").animate({opacity:"hide"},"slow");
	//document.getElementById('pageMask').style.visibility = "hidden";

	ddmenuitem = 0;

}



function jsddm_timer(){	closetimer = window.setTimeout(jsddm_close, timeout);}



function jsddm_canceltimer(){if(closetimer)

	{	window.clearTimeout(closetimer);

		closetimer = null;}}



function reset_status(){

	jsddm_close()

	document.getElementById('navDiv').style.backgroundPosition = "0px 0px";

}

document.onclick = reset_status;

//End Dropdown menu function



//Event.observe(window, 'onload', initialize, false);





//$(document).ready(function(){

//Menus
function pageMaskLoad(){
	var elem = document.getElementById('navDiv');

	elem.onmouseover = function anonymous(event) {

		elem.style.zIndex = 1000;

	    jsddm_open();



	}



	document.getElementById('navDiv').onmouseout = function anonymous(event){


	   	jsddm_close();


	}

//document.getElementById('myMenu').onmouseout = reset_status;

	//init framework

	var IE6 = true



	if (typeof document.body.style.maxHeight != "undefined") {// IE 7, mozilla, safari, opera 9

	  IE6 = false

	}



	if(IE6){

		//alert(document.body.scrollHeight);

		if(document.body.scrollHeight < 665){

			document.getElementById('containerDiv').style.height = 665;

		}else{

			document.getElementById('containerDiv').style.height = document.body.scrollHeight;

		}

		if(screen.width > 1024){

			window.onresize = function(){

				var num = document.body.scrollHeight

				if(num > 665){

					document.getElementById('containerDiv').style.height = document.body.scrollHeight;

				}

			}

		}
	}
}


	//Jquery Menu Effect
	 jQuery(document).ready(function(){

	  jQuery("a.showvideo").click(function() {
        	jQuery.fancybox({
        			'padding'		: 0,
        			'autoScale'		: false,
        			'transitionIn'	: 'none',
        			'transitionOut'	: 'none',
        			'title'			: this.title,
        			'width'		: 400,
        			'height'		: 400,
        			'href'			: this.href.replace(new RegExp("watch\?v=", "i"), 'v/'),
        			'type'			: 'swf',
        			'swf'			: {
                			   	  'wmode'		: 'transparent',
                	     			'allowfullscreen'	: 'true'
        			               }
        		});

        	return false;
        });


	  jQuery('.videoBoxMain').equalHeights();
	 	//alert(jQuery('ul.jwts_tabbernav').height());

	 	jQuery('a').each(function(index) {
			var alink = jQuery(this).attr('href');
			if(alink != null){
				if (alink.search('http://www.phoca.cz/') != -1) {
					jQuery(this).text("");
				}
			}
		});

	 	jQuery("#footer ul li:last-child a").addClass("noborder");
	 	jQuery("#navDiv li ul").css({ opacity: 0.95 });
	 	jQuery("#pageMask").css({ opacity: 0.5 });
	 //	jQuery("ul.gk_news_show_list li:last-child").css("border":"none");

	 if (typeof document.body.style.maxHeight != "undefined") {
			  //Mouseover with animate Effect for Menu List Items
			  jQuery('#navDiv>ul>li>ul>li').hover(function() {
			    jQuery(this).children().animate({paddingLeft:"18px"}, {queue:false, duration:200});
			  },function() {
			    jQuery(this).children().animate({paddingLeft:"12px"}, {queue:false, duration:200});
			  });

      	}
			  /* jQuery('#navDiv>ul>li>ul>li>ul>li').hover(function() {
			    jQuery(this).children().animate({paddingLeft:"18px"}, {queue:false, duration:200});
			  },function() {
			    jQuery(this).children().animate({paddingLeft:"12px"}, {queue:false, duration:200});
			  });*/

			jQuery("#navDiv ul li ul").css("left","-144px");
			jQuery("#navDiv ul li ul").css("background-color","#fff");
			///jQuery("#navDiv ul li ul").css("border","1px solid #F16F3E");


			jQuery("#navDiv ul li ul li ul").css("left","0px");

		 	jQuery("#navDiv>ul>li>ul").hide();

			jQuery("#navDiv>ul>li.item27").hoverIntent(over,out);
			jQuery("#navDiv>ul>li.item2").hoverIntent(over1,out1);
			jQuery("#navDiv>ul>li.item37").hoverIntent(over2,out2);
			jQuery("#navDiv>ul>li.item308").hoverIntent(over3,out3);
			jQuery("#navDiv>ul>li.item41").hoverIntent(over4,out4);
			jQuery("#navDiv>ul>li.item53").hoverIntent(over5,out5);
			jQuery("#navDiv>ul>li.item722").hoverIntent(over6,out6);
			jQuery("#navDiv>ul>li.item723").hoverIntent(over7,out7);
			jQuery("#navDiv>ul>li.item724").hoverIntent(over8,out8);
			jQuery("#navDiv>ul>li.item725").hoverIntent(over9,out9);
			jQuery("#navDiv>ul>li.item726").hoverIntent(over10,out10);
			jQuery("#navDiv>ul>li.item727").hoverIntent(over12,out12);

  	});
	 	function over(){
	 		// jQuery("#navDiv>ul>li.item27>ul").css('visibility','visible');
	 		// jQuery("#navDiv>ul>li.item27>ul").animate({opacity:"show"},"slow");
	 		 jQuery("#navDiv>ul>li.item27>ul").slideDown('slow').show();
	    }

		function out(){
			//jQuery("#navDiv>ul>li.item27>ul").hide().css('visibility','hidden');
			 jQuery("#navDiv>ul>li.item27>ul").slideUp('slow');
		}

		function over1(){
	 		//jQuery("#navDiv>ul>li.item2>ul").css('visibility','visible');
	 		//jQuery("#navDiv>ul>li.item2>ul").animate({opacity:"show"},"slow");
	 		 jQuery("#navDiv>ul>li.item2>ul").slideDown('slow').show();
	 	}

		function out1(){
			//jQuery("#navDiv>ul>li.item2>ul").hide().css('visibility','hidden');
			jQuery("#navDiv>ul>li.item2>ul").slideUp('slow');


		}

		function over2(){
	 		//jQuery("#navDiv>ul>li.item37>ul").css('visibility','visible');
	 		//jQuery("#navDiv>ul>li.item37>ul").animate({opacity:"show"},"slow");
	 		 jQuery("#navDiv>ul>li.item37>ul").slideDown('slow').show();
	 	}

		function out2(){
			//jQuery("#navDiv>ul>li.item37>ul").hide().css('visibility','hidden');
			jQuery("#navDiv>ul>li.item37>ul").slideUp('slow');


		}

		function over3(){
	 		//jQuery("#navDiv>ul>li.item308>ul").css('visibility','visible');
	 		//jQuery("#navDiv>ul>li.item308>ul").animate({opacity:"show"},"slow");
	 		 jQuery("#navDiv>ul>li.item308>ul").slideDown('slow').show();
	 	}

		function out3(){
			//jQuery("#navDiv>ul>li.item308>ul").hide().css('visibility','hidden');
			jQuery("#navDiv>ul>li.item308>ul").slideUp('slow');

		}

		function over4(){
	 		//jQuery("#navDiv>ul>li.item41>ul").css('visibility','visible');
	 		//jQuery("#navDiv>ul>li.item41>ul").animate({opacity:"show"},"slow");
	 		 jQuery("#navDiv>ul>li.item41>ul").slideDown('slow').show();
	 	}

		function out4(){
			//jQuery("#navDiv>ul>li.item41>ul").hide().css('visibility','hidden');
			jQuery("#navDiv>ul>li.item41>ul").slideUp('slow');


		}

		function over5(){
	 		//jQuery("#navDiv>ul>li.item53>ul").css('visibility','visible');
	 		//jQuery("#navDiv>ul>li.item53>ul").animate({opacity:"show"},"slow");
	 		 jQuery("#navDiv>ul>li.item53>ul").slideDown('slow').show();
	 	}

		function out5(){
			//jQuery("#navDiv>ul>li.item53>ul").hide().css('visibility','hidden');
			jQuery("#navDiv>ul>li.item53>ul").slideUp('slow');


		}

		function over6(){
	 		 jQuery("#navDiv>ul>li.item722>ul").slideDown('slow').show();
	 	}

		function out6(){
			jQuery("#navDiv>ul>li.item722>ul").slideUp('slow');


		}

		function over7(){
	 		 jQuery("#navDiv>ul>li.item723>ul").slideDown('slow').show();
	 	}

		function out7(){
			jQuery("#navDiv>ul>li.item723>ul").slideUp('slow');


		}

		function over8(){
	 		 jQuery("#navDiv>ul>li.item724>ul").slideDown('slow').show();
	 	}

		function out8(){
			jQuery("#navDiv>ul>li.item724>ul").slideUp('slow');


		}

		function over9(){
	 		 jQuery("#navDiv>ul>li.item725>ul").slideDown('slow').show();
	 	}

		function out9(){
			jQuery("#navDiv>ul>li.item725>ul").slideUp('slow');


		}


		function over10(){
	 		 jQuery("#navDiv>ul>li.item726>ul").slideDown('slow').show();
	 	}

		function out10(){
			jQuery("#navDiv>ul>li.item726>ul").slideUp('slow');


		}

		function over12(){
	 		 jQuery("#navDiv>ul>li.item727>ul").slideDown('slow').show();
	 	}

		function out12(){
			jQuery("#navDiv>ul>li.item727>ul").slideUp('slow');


		}
//});

