﻿function getScrollTop() {
    var pos = 0;

    if (window.pageYOffset) { 
        pos = window.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
    	pos = document.documentElement.scrollTop;
    } else if (document.body) {
	  pos = document.body.scrollTop;
    }

    return pos;
}
function getScrollLeft() {
    var pos = 0;

    if (window.pageXOffset) { 
        pos = window.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollLeft) {
    	pos = document.documentElement.scrollLeft;
    } else if (document.body) {
	  pos = document.body.scrollLeft;
    }

    return pos;
}
function getWindowHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 
	return window.undefined; 
}

function getWindowWidth() {
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
	return window.undefined; 
}
    function funHideLayer(strPanel){
        document.getElementById('divTransparanBackground').style.width="0px";
        document.getElementById('divTransparanBackground').style.height="0px";

        var divPanel=document.getElementById(strPanel);
        divPanel.style.display = 'none';
    }
    function funShowLayer(strPanel,strWidth,strHeight,strTop,strLeft){
        try{
            document.getElementById('divTransparanBackground').style.width="100%";
            document.getElementById('divTransparanBackground').style.height="100%";
        }
        catch(ex){
            strdivTransparanBackground='<div id="divTransparanBackground" style="z-index: 200; position: absolute; top: 0px;'
            +'left: 0px; width: 0px; height: 0px; background-color: Transparent; background-color: #333333;'
            +'display: block; filter: alpha(opacity=40); -moz-opacity: 0.40;">'
            +'</div>';

            //document.write(strdivTransparanBackground);
            document.body.innerHTML+=strdivTransparanBackground;
            //document.writeln(strdivTransparanBackground);
            
            document.getElementById('divTransparanBackground').style.width="100%";
            document.getElementById('divTransparanBackground').style.height="100%";
        }
        var divPanel=document.getElementById(strPanel);

        divPanel.style.width=strWidth+"px";
        divPanel.style.height=strHeight+"px";
        divPanel.style.display = 'block';

        var width = divPanel.offsetWidth;
        var height = divPanel.offsetWidth;
        
        var fullHeight = getWindowHeight();
        var fullWidth = getWindowWidth();
        
        var scTop = getScrollTop();
        var scLeft = getScrollLeft();

        divPanel.style.top = (((fullHeight - height) / 2)) + "px";        
        divPanel.style.left =  (((fullWidth - width) / 2)) + "px";
        if(strTop.length>0){ divPanel.style.top=strTop + "px"; }
        if(strLeft.length>0){ divPanel.style.left=strLeft + "px"; }
        window.status='width:'+fullWidth+'-height:'+fullHeight+'-top:'+divPanel.style.top+'-left:'+divPanel.style.left;

        return false;
    }