var GB_ROOT_DIR = "/public/scripts/greybox/";

$(document).ready(function(){
	$("a.menu").hover(function(){
			$("#"+this.id+"-img-1").fadeOut("slow");
			$("#"+this.id+"-img-2").fadeIn("slow");
		},
		function(){
			$("#"+this.id+"-img-1").fadeIn("slow");
			$("#"+this.id+"-img-2").fadeOut("slow");
	});

	if ($("#player").length >0 ) {
	    $f("player", "/public/scripts/flowplayer-3.1.5.swf", { 
	        clip: { 
	            autoPlay: true, 
	            autoBuffering: true 
	        	},	        
	        canvas: { 
	        		backgroundColor:'transparent'
	        }, 
	        plugins:  { 
	        	controls: {
        			autoHide: 'always',
	        		backgroundColor: 'transparent', 
	        		backgroundGradient: 'none', 
	                bufferColor: '#4076082', 
	                progressColor: '#4076082',             
	                buttonColor: '#4076082', 
	                buttonOverColor: '#4076082', 
	                tooltipColor: '#4076082', 
	                timeColor: '#4076082'
	        	}
	        }
	     });
	}

	externalLinks();
	 $('a.highslide').each(function() {
		    this.onclick = function() {
		      return hs.expand(this, config1);
		    };
	 });	
	 $('div.galItemHome a.highslide').each(function() {
	      htmlCaption = "<span class=\"highslide-caption\">"+$(this).next("span.highslide-caption-visible").html()+"</span>";
		  $(this).after(htmlCaption);		    	
	});
		$("a.pdfHighslide").click(function(){
			hs.allowSizeReduction = false
			hs.useBox = false;
			hs.minWidth = 0;
			hs.minHeight = 0;
			hs.maxWidth = 0;
			hs.maxHeight = 0;
			hs.width = 1000;
			hs.height = 0;
			hs.marginRight = 0;
			hs.marginBottom = 0;
			return hs.htmlExpand(this, {objectType: 'iframe',headingEval: 'this.a.title', wrapperClassName: 'titlebar' } )
		});
	 
		$(document).ready(function() {
			var picts='';
			for(var i=1;i<6;i++){ 
				num = rand(5);
				if (picts.indexOf('/public/images/intro/'+num+'.jpg')<0) picts+='<img src="/public/images/intro/'+num+'.jpg" />'; 
			}
			html='<div class="pics" id="slideshow">'+picts+'</div>';
			$("#adresy").append(html);
		});
		$('#slideshow').cycle('fade');
		
		
		function rand(n){
		  return ( Math.floor ( Math.random ( ) * n + 1 ) );
		}
	 
	
});
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") != "internal") {
            anchor.target = "_blank"; 
          }
       } 
} 
