function WidthHeightObj(){
    var visWidth;
    var visHeight;
    var visTop;
    var visLeft;
    var htmlWidth;
    var htmlHeight;

    this.setValues=function(visWidth,visHeight,visTop,visLeft,htmlWidth,htmlHeight){
        this.visHeight=visHeight;
        this.visWidth=visWidth;
        this.visTop=visTop;
        this.visLeft=visLeft;
        this.htmlWidth=htmlWidth;
        this.htmlHeight=htmlHeight;
    }
    this.reload=function(){
        if (navigator.userAgent.indexOf("Opera") != -1){ret=posGet1();}
        else if (document.all)                         {ret=posGet2();}
        else if (document.layers)                      {ret=posGet3();}
        else if (document.getElementById)              {this.browser4();}
    }
    this.browser1=function(){
        this.visHeight=innerHeight;
        this.visWidth=innerWidth;
        this.visTop=window.pageYOffset;
        this.visLeft=window.pageXOffset;
        this.htmlWidth=document.documentElement.offsetWidth;
        this.htmlHeight=document.documentElement.offsetHeight;
    }
    this.browser2=function(){
    }
    this.browser3=function(){
    }
    this.browser4=function(){
        //	this.setValues(innerHeight,innerWidth,window.pageYOffset,window.pageXOffset,document.documentElement.clientWidth,document.documentElement.clientHeight);
        this.visHeight=innerHeight;
        this.visWidth=innerWidth;
        this.visTop=window.pageYOffset;
        this.visLeft=window.pageXOffset;
        this.htmlWidth=document.documentElement.clientWidth;
        this.htmlHeight=document.documentElement.clientHeight;
    }
    this.reload();

    this.getAll=function(){
        var ret='<hr><div><pre>';
        ret+='\nvisWidth  : '+this.visWidth;
        ret+='\nvisHeight : '+this.visHeight;
        ret+='\nvisTop    : '+this.visTop;
        ret+='\nvisLeft   : '+this.visLeft;
        ret+='\nhtmlWidth : '+this.htmlWidth;
        ret+='\nhtmlHeight: '+this.htmlHeight;
        ret+='</pre></div>';
        return ret;
    }
}
window.fullScreen=true;
var WH=new WidthHeightObj();



function posGet1(){
    inHeight=innerHeight;
    inWidth=innerWidth;
    pHeight=window.pageYOffset;
    pWidth=window.pageXOffset;
    ret=new Array(inHeight,inWidth,pHeight,pWidth);
    return ret;
}
function posGet2(){
    inHeight=parseInt(document.body.offsetHeight);
    if(document.documentElement.clientHeight){
        inHeight=document.documentElement.clientHeight;
    }
    inWidth=parseInt(document.body.offsetWidth);
    if(document.documentElement.clientWidth){
        inWidth=document.documentElement.clientWidth;
    }
    pHeight=document.body.scrollTop;
    pWidth=document.body.scrollLeft;
    ret=new Array(inHeight,inWidth,pHeight,pWidth);
    return ret;
}
function posGet3(){
    inHeight=innerHeight;
    inWidth=innerWidth;
    pHeight=window.pageYOffset;
    pWidth=window.pageXOffset;
    ret=new Array(inHeight,inWidth,pHeight,pWidth);
    return ret;
}
function posGet4(){
    inHeight=innerHeight;
    inWidth=innerWidth;
    pHeight=window.pageYOffset;
    pWidth=window.pageXOffset;
    ret=new Array(inHeight,inWidth,pHeight,pWidth);
    return ret;
}



function posArray(){
    if (navigator.userAgent.indexOf("Opera") != -1)
    {
        ret=posGet1();
        ret.push(1);
    }
    else if (document.all)
    {
        ret=posGet2();
        ret.push(2);
    }
    else if (document.layers)
    {
        ret=posGet3();
        ret.push(3);
    }
    else if (document.getElementById)
    {
        ret=posGet4();
        ret.push(4);
    }
    return ret;
}
function Popper(closeOnOutside){
    this.width=800;
    this.height=400;
    this.content=false;
    this.background=false;
    this.doshit = function(){
        //document.getElementById('dBackground').style.display='block';
        this.darken_background();
        this.content=document.createElement('div');
        this.content.id='azFiler';
        this.content.className='azFiler';
        //        centerDiv(this.content,this.width,this.height);
        this.center();
        document.body.appendChild(this.content);
    }
    this.center =function(){
        pos=posArray();
        inHeight=pos[0];
        inWidth=pos[1];
        scrTop=pos[2];
        scrLeft=pos[3];
        what=pos[4];

        nTop=((inHeight-this.height)/2)+scrTop;
        if(nTop<scrTop){nTop=scrTop;}
        this.content.style.top=nTop+'px';
        nLeft=((inWidth-this.width)/2)+scrLeft;
        if(nLeft<scrLeft){nLeft=scrLeft;}
        this.content.style.left=nLeft+'px';
        this.content.style.width=this.width+'px';
        this.content.style.height=this.height+'px';
        //        this.content.style.display='block';
        this.content.innerHTML='scrLeft:' + scrLeft + '<br>scrTop:' + scrTop;
        this.content.innerHTML+='<br>in X:' + inWidth + '<br>Y:' + inHeight;
        this.content.innerHTML+='what:'+what;
        this.content.innerHTML+='what:'+window;
        WH.reload();
        this.content.innerHTML+=WH.getAll();


        x = document.body.scrollWidth;
        if(x<inWidth){x=inWidth;}
        y = document.body.scrollHeight;
        if(y<inHeight){y=inHeight;}
        this.background.style.width=x+'px';
        this.background.style.height=y+'px';
    }

    this.darken_background=function(){
        this.background=document.createElement('div');
        this.background.style.background='black';
        this.background.style.position='absolute';
        this.background.style.top='0';
        this.background.style.left='0';
        this.background.style.width='100%';
        this.background.style.height='100%';
        this.background.style.opacity='0.6';
        this.background.style.filter='alpha(opacity=60)';
        this.background.onclick=function(){closePopper();}
        document.body.appendChild(this.background);
        // display:none;position:absolute;top:0;left:0;background:black;width:100%;height: 804px; opacity: 0.8;"
    }
    this.close=function(){
        document.body.removeChild(this.background);
        document.body.removeChild(this.content);
    }
    this.doshit();
    window.onscroll=fixaPlacering;
    window.onresize=fixaPlacering;
}
function fixaPlacering(){
    if(fFiler){
        fFiler.center();
    }
}
function closePopper(){
    fFiler.close();    
}

function newPopper(){
    fFiler=new Popper(true);
}
