var opt='scrollbars=no,status=no,width=160,height=100,left=50,top=50';
function zoom(co){
    imageURL=co.href;
    imageTitle=co.title;
    imgWin=window.open('','mbig',opt);
    with (imgWin.document){
        writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
        writeln('<html><head><title>'+ imageTitle +'</title>');
        writeln('<style type="text/css">body{margin:0;padding:0;background:#fff;color:#000;font-family:Arial;font-size:12px;overflow:hidden}');
        writeln('img{border:0;cursor:pointer}')
        writeln('#obraz{visibility:hidden}\n #loader{margin:15px 0 0 15px}');
        writeln('</style>');
        writeln('<scr'+'ipt type="text/javascript">');
        writeln('function reSizeToImage(){');
        writeln('window.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('window.resizeTo(document.images[0].width+w,document.images[0].height+h);');
        writeln('document.getElementById("obraz").style.visibility="visible";document.getElementById("loader").style.display="none";')
        writeln('};')
        writeln('function init(){');
        writeln('reSizeToImage();window.focus();}');
        writeln('window.onload=init')

        writeln('</scr'+'ipt>');

        writeln('</head><body>');
        writeln('<div id="loader">pobieram powiększenie</div>');
        writeln('<img id="obraz" src="'+imageURL+'"  alt="Zamknij" title="Zamknij" onclick="self.close()">');
        writeln('</body></html>')
        close();
        }
}

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

//window.onload=powieksz;
site={
    init: function(){
       this.addFancy(); 
    },
    addFancy: function(){
         $("a.zoom").fancybox({
            'type' : 'image',
            'transitionIn'	:	'elastic',
            'transitionOut'	:	'elastic',
            'speedIn'		:	200, 
            'speedOut'		:	200, 
            'overlayShow'	:	true,
            overlayOpacity: 0.7,
            titleShow: false,
            overlayColor: '#ffffff'
        });  
    }
};
jQuery(document).ready(function(){
    site.init();
});
