
$(document).ready(function() {
    externalLinks(); 
    tlhtml='<img src="http://toplist.cz/count.asp?ID=205421&logo=counter&start=4238&http='+top.document.referrer+' alt="TOPlist"/>';
    $("#toplist").html(tlhtml);

	var windowWidth = document.documentElement.offsetWidth;  
	var windowHeight = document.documentElement.clientHeight;  
	var popupHeight = $("#dovolenaPopup").height();  
	var popupWidth = $("#dovolenaPopup").width();  
	var activeLay = 0;

	$("#dovolenaPopup").css({  
	"top": 150,  
	"left": windowWidth/2-popupWidth/2  
	});  

//	$("#backgroundPopup").show();
//	$("#dovolenaPopup").fadeIn("slow");
	$("#akceLayer").fadeIn("slow");
	$("#closeAkce").click(function(){
		$("#akceLayer").fadeOut("slow");
	});
	$("#closePopup").click(function(){
		$("#backgroundPopup").hide();
		$("#dovolenaPopup").fadeOut("slow",function(){
				$("#akceLayer").fadeIn("slow");
		});
	});
	
	$("#logo").click(function(){
		$("#Layer"+activeLay).fadeOut("fast");
		$("#picaso").fadeTo("slow",1);
		activeLay=0;
		$("#LayerEnd").css("top","350px");
		$("#akceLayer").fadeIn("slow");
	});
	$("#Layer2 a").click(function(){
		$("#Layer"+activeLay).fadeOut("fast");
		$("#akceLayer").hide("fast");
		$("#LayerEnd").hide("fast");
		activeLay = parseInt(this.id.charAt(6)) + 2;
		$("#Layer"+activeLay).fadeIn("normal",function(){
			var pos = $("#Layer"+activeLay).attr("offsetHeight");
			if (pos<=200) {pos=220}
			$("#LayerEnd").css("top",pos+100+"px");
			$("#LayerEnd").show("slow");
		});
		$("#picaso").fadeTo("slow",0.15);
		
	});
});


function externalLinks() { 
    if (!document.getElementsByTagName) return; 
   var anchors = document.getElementsByTagName("a"); 
       for (var i=0; i<anchors.length; i++) { 
          var anchor = anchors[i]; 
          if (anchor.getAttribute("href") && 
              anchor.getAttribute("rel") == "external") 
            anchor.target = "_blank"; 
       } 
} 



