var GB_ROOT_DIR = "/public/scripts/greybox/";

function popupPdf(link){
    window.open(link,"pipe","toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,width=1024,height=740");
}
$(document).ready(function(){  
    externalLinks();
	setTimeout("switchImage(0)",3000);
	$("#animation").click(function(){
		$(location).attr('href',"/videa");

	});
	$("#container").append($('<div id="okno-3d"></div>'));
	$("#menu-item-34 a").live("click",function(){
		var url = $(this).attr("href"); 
		$("#okno-3d").lightbox_me({
	        centered: true,
	        overlayCSS: { opacity: .7, background: "#000"},
	        onLoad:	function() {
	        	$("#okno-3d").append($('<iframe src="'+url+'"></iframe>'));
	        	$("#okno-3d").append($('<a href="#">zavřít X</a>'));
	        },
	        onClose: function() {
	        	$("#okno-3d iframe").remove();
	        },
	   	});
		return false;
	});
	$("#okno-3d a").live("click",function(){
		$("#okno-3d").trigger("close");
	});
});

function animateShop(){
	col = $("#menu-item-36 a").css("color");
	$("#menu-item-36 a").css("color",$("#menu-item-36 a").data("color"));
	$("#menu-item-36 a").data("color",col);
	setTimeout("animateShop()",1000);
}
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"; 
       } 
} 

function switchImage(id){
	var newid = (Math.abs(id - 1));
	pic = $("#anim"+id).attr("src");
	pos = pic.substring(pic.length - 5,pic.length - 4);
	pos = (pos % 9) + 1
	$("#anim"+newid).attr("src","/public/images/anim"+pos+".jpg");

	$("#anim"+id).fadeOut(400);
	$("#anim"+newid).fadeIn(200);
	setTimeout("switchImage("+newid+")",3000);
}
