// JavaScript Document
function zoom() {
	if (document.getElementById) {
		allLinks=document.getElementsByTagName('a');
		for (i=0;i<allLinks.length;i++) {
			
			if(allLinks[i].className=='powieksz') {
			allLinks[i].onclick=function(){a_tags(this);return false}

			}			
		}
	}
}

function a_tags(co) {
	imageURL=co.href;
	imageTitle=co.title;
	
	w_imgWin=300;
	h_imgWin=100;
	od_L=screen.availWidth/2-w_imgWin/2;
	od_G=screen.availHeight/2-h_imgWin/2;
	
	imgWin=window.open('','','status=no,width='+w_imgWin+',height='+h_imgWin+',left='+od_L+',top='+od_G+',scrollbars=yes,resizable=yes');
	imgWin.focus();

	with (imgWin.document){
		writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
		writeln('<html><head><title>Podglad Obrazka</title>');
		/***************STYLE*****************************************/
		writeln('<style type="text/css">body{margin:0;padding:0px;background:#DCDCDC;}');
		writeln('img{border:0}');
		writeln('#obraz{visibility:hidden}\n #loader{padding:50px; color:black}');
		writeln('.head1 {background-color:#606060;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;font-weight: bold;color: #DFDFDF; text-align:center; text-decoration: none; padding:6px; display:block; border:1px solid #B5B5B5; margin-top:10px}.head1:hover { color: #9EC6F3; background-color: #777777}.tresc {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color:black;margin-top:10px}</style>');
		/***************JAVASCRIPT***********************************/
		writeln('<scr'+'ipt type="text/javascript">');
		
		writeln('function reSizeToimage(){');
			writeln('resizeTo(300,300);');	
			writeln('if (window.outerHeight){');
				writeln('h=window.outerHeight-window.innerHeight');
				writeln('w=window.outerWidth-window.innerWidth');
				writeln('}')	
			writeln('if (document.body.clientHeight && !window.outerHeight){'); 
				writeln('h=300-document.body.clientHeight;');
				writeln('w=300-document.body.clientWidth;');
				writeln('}')
			writeln('var newwinheight=document.images[0].height+h+90');
			writeln('if(newwinheight>600) newwinheight=600')
			
			writeln('window.resizeTo(document.images[0].width+w+40,newwinheight);');
			writeln('document.getElementById("obraz").style.visibility="visible";document.getElementById("loader").style.display="none";')
			writeln('};')
			
		writeln('function MoveWindow () {')			
		writeln('var imgW = document.images[0].width+40;');
	    writeln('var imgH = document.images[0].height+90;');
		writeln('window.moveBy(-((imgW-300)/2),-((imgH-100)/2));');
		writeln('};')	
		
		writeln('function init(){');
			writeln('reSizeToimage(); MoveWindow(); window.focus();}');
			writeln('window.onload=init')
		
		writeln('</scr'+'ipt>');
		/***************BODY*******************************************/	
		writeln('</head><body>');
		writeln('<div id="loader" style="font:normal 11px verdana,arial">laduje obrazek...</div>');
		writeln('<table width="100%" height="100%"><tr><td valign="middle" align="center"><img onClick="self.close()" title="zamknij" id="obraz" src="'+imageURL+'"><br><div class="tresc">'+imageTitle+'</div><a href="javascript:void(0)" class="head1" onClick="self.close()">zamknij okno</a></td></tr></table>');
		writeln('</body></html>');
		close();
	}	
}