var maxW,maxH,fromX,fromY,toX,toY,adjX,adjY,zBox,zStep=0,zLink,zNew;

function zoom(evt,zlink,maxw,maxh,tox,toy) {
if (arguments.length > 2) zNew=1;
scrollH=(window.pageYOffset!=null)?window.pageYOffset:document.body.scrollTop;
maxW=maxw?maxw:window.innerWidth?innerWidth:document.body.clientWidth;
maxH=maxh?maxh:window.innerHeight?innerHeight:document.body.clientHeight;
toX=tox?tox:0;
toY=(toy?toy:0)+scrollH;
fromX=evt.pageX?evt.pageX:evt.clientX;
fromY=(evt.pageY?evt.pageY:evt.clientY)+(document.all?scrollH:0);
adjX=toX+evt.screenX-fromX;
adjY=toY+evt.screenY-fromY;



if (document.createElement && document.body.appendChild && !zBox) {
        zBox=document.createElement("div");
        zBox.style.position="absolute";
        document.body.appendChild(zBox);
} else if (document.all && !zBox) {
        document.all[document.all.length-1].outerHTML+='<div id="zBoxDiv" style="position:absolute"></div>';
        zBox=document.all.zBoxDiv;
} else if (document.layers && !zBox) {
        zBox=new Layer(maxW);
        zBox.style=zBox;
        }
zLink=zlink;
doZoom();
}

function doZoom() {
zStep+=1;
zPct=(10-zStep)/10
 var toX = (screen.width - maxW) / 2;
            var toY = (screen.height - maxH) / 2;
if (document.layers) {
        zBox.moveTo(toX+zPct*(fromX-toX),toY+zPct*(fromY-toY));
        zBox.document.open();
        zBox.document.write("<table width='"+maxW*(1-zPct)+"' height="+maxH*(1-zPct)+" border=2 cellspacing=0><tr><td></td></tr></table>");
        zBox.document.close();
        } else {
        zBox.style.border="2px solid #999999";
        zBox.style.left=toX+zPct*(fromX-toX);
        zBox.style.top=toY+zPct*(fromY-toY);
        zBox.style.width=maxW*(1-zPct);
        zBox.style.height=maxH*(1-zPct);
        }
zBox.style.visibility="visible";
if (zStep < 10) setTimeout("doZoom("+fromX+","+fromY+","+toX+","+toY+")",30);
else {
        zBox.style.visibility='hidden';
        zStep=0;

        if (zLink && !zNew) location.href=zLink.href;
        else if (zLink && zNew) {
              var winLeft = (screen.width - maxW) / 2;
            var winTop = (screen.height - maxH) / 2;
            winData = 'width='+maxW+',height='+maxH+',left='+winLeft+',top='+winTop+' ';
                var w = window.open(zLink.href, '', winData);
window.creator=self

                zNew=null;
                }
        }
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function blocking(nr, cookie, vis_state)
{
        if (document.layers)
        {
                current = (document.layers[nr].display == 'none') ? vis_state : 'none';
                document.layers[nr].display = current;
        }
        else if (document.all)
        {
                current = (document.all[nr].style.display == 'none') ? vis_state : 'none';
                document.all[nr].style.display = current;
        }
        else if (document.getElementById)
        {
                display = (document.getElementById(nr).style.display == 'none') ? vis_state : 'none';
                document.getElementById(nr).style.display = display;
        }
}


function adjust_popup()
{
        var w, h, fixedW, fixedH, diffW, diffH;

        if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
        }
        w = fixedW + diffW;
        h = fixedH + diffH;
        if (h >= screen.availHeight) w += 16;
        if (w >= screen.availWidth)  h += 16;
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}
