var resId=0;
var imgWndw;
var Title = "Новая Скандинавия";

function largevar(imgLink) {
    if (typeof(window.resizeBy)=='undefined') return true;
    imgWndw=window.open('',imgLink.target,'width=100,height=100'+',toolbar=no,menubar=no,location=no,status=no,'+'resizable=yes,scrollbars=no,left='+(screen.width>>>2)+',top='+(screen.height>>>4));
    self.focus();
    var imgTitle=(Title)?Title:imgLink.href;
    with (imgWndw.document){
        open();
	       write('<ht'+'ml><he'+'ad><ti'+'tle>'+imgTitle+'</ti'+'tle>'+'</he'+'ad><bo'+'dy '+'style="margin:0;padding:0;position:fixed;overflow:hidden;"'+'marginheight="0"><img src="'+imgLink.href+'" border="0" '+' alt="'+imgTitle+'" title="'+imgTitle+'" /></bo'+'dy></ht'+'ml>');
        close();
    }
    resId=setInterval('imgResize()',100);
    return false;
}

function imgResize() {
    var w=imgWndw.document.images[0].width;
    if (w>screen.availWidth) w=screen.availWidth;
    var h=imgWndw.document.images[0].height;
    if (h>screen.availHeight) h=screen.availHeight;
    if (w>50 && h>50) {
        var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)?imgWndw.document.body.clientWidth:null);
        var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)?imgWndw.document.body.clientHeight:null);
        if (ww && wh) {
            imgWndw.resizeBy(w-ww,h-wh);
            var wwn=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)?imgWndw.document.body.clientWidth:null);
            if(ww == wwn && ww != w) {
                imgWndw.resizeBy(w-(100+w-ww),0);
            }
        }
        imgWndw.focus();
        clearInterval(resId);
    }
}


function addLoadHandler(handler)
{
	if(window.addEventListener)
	{
		window.addEventListener("load",handler,false);
	}
	else if(window.attachEvent)
	{
		window.attachEvent("onload",handler);
	}
	else if(window.onload)
	{
		var oldHandler = window.onload;
		window.onload = function piggyback()
		{
		    oldHandler();
		    handler();
		};
	}
	else
	{
		window.onload = handler;
	}
}

