
Event.observe(window, 'load', function(){

   maxheight=900;
   maxwidth= 700;

   imgs=document.getElementsByTagName("img");
   for (p=0; p<imgs.length; p++) {
     if (imgs[p].alt=="grafika") 
	   {
      w=parseInt(imgs[p].width) + 20;
      h=parseInt(imgs[p].height) + 20;
      if (parseInt(imgs[p].width)>maxwidth) {
         imgs[p].style.cursor="pointer";
         imgs[p].onclick=new Function("iw=window.open(this.src,'Podglad','height="+h+",width="+w+"');iw.focus()");
         imgs[p].alt = "Kliknij by powiększyć"
         imgs[p].height=(maxwidth/imgs[p].width)*imgs[p].height;
         imgs[p].width=maxwidth;
      }
      if (parseInt(imgs[p].height)>maxheight) {
         imgs[p].style.cursor="pointer";
         imgs[p].onclick=new Function("iw=window.open(this.src,'Podglad','height="+h+",width="+w+"');iw.focus()");
         imgs[p].alt = "Kliknij by powiększyć"
         imgs[p].width=(maxheight/imgs[p].height)*imgs[p].width;
         imgs[p].height=maxheight;
      }
     }
   }

});
