function zamknij(){
	document.getElementById('popup').style.display = 'none';
}



try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

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";
 }
}
window.onload = externalLinks;

function c(){
	d = document.getElementById('prev');
	d.innerHTML ='';
}
			
function show(i,t,w,h){
							
	if (document.documentElement && document.documentElement.scrollTop)
		theTop = document.documentElement.scrollTop;
	else if (document.body)
		theTop = document.body.scrollTop
					
	aa = getPageSize();
							
	d = document.getElementById('prev');
				
	newHTML = '<div style="background-color:black;opacity: .5;filter: alpha(opacity=50); width:'+ aa[0] +'px; height:'+ aa[1] +'px; position:absolute; top:0; left:0; z-index:50;" ></div>';
							
	if(t != 0){
		leftmargin = (aa[0]-530)/2;
		topmargin = ((aa[3]-379)/2)+theTop;
		
		newHTML = newHTML + '<div class="galP" style="top:'+topmargin+'px; left:' + leftmargin + 'px; " >'
		newHTML = newHTML + '<img src="img/sz/' + i + '" alt="tyskie" onclick="c()">';
		newHTML = newHTML + '<p>' + t + '</p>';
		newHTML = newHTML + '</div>';
	}
	else{
		leftmargin = (aa[0]-w)/2;
		topmargin = ((aa[3]-h)/2)+theTop;
					
		newHTML = newHTML + '<div  style="top:'+topmargin+'px; left:' + leftmargin + 'px; width:'+ w +'px; height:'+ h +'px;position:absolute;z-index:100; background: white url(img/loading.gif) no-repeat;background-position: 50% 50% " >'
		newHTML = newHTML + '<img src="' + i + '" alt="tyskie" onclick="c()">';
		newHTML = newHTML + '</div>';
					
	}
				
	d.innerHTML = newHTML;
				
}
			
function getPageSize(){

	var xScroll, yScroll;
				
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
		xScroll = document.documentElement.scrollWidth;
		yScroll = document.documentElement.scrollHeight;
	} else { // Explorer Mac...would also work in Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
			
	var windowWidth, windowHeight;
				
	if (self.innerHeight) { // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
			
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
		pageHeight = windowHeight;
	else 
		pageHeight = yScroll;
	
				
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth)
		pageWidth = windowWidth;
	else 
		pageWidth = xScroll;
	
				
				
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

 