﻿    var iBrowserWidth;
    var iBrowserHeight;
        
    function centerFormPanel(iPanelWidth, iPanelHeight)
    {
        //Center Main Panel
        //And all absolutely positioned children panels 
        //stay in place ;)
        //Assumes objParentPanel style: visibility is "hidden"
        //And sets it to "visible" when done
    
        //var iBrowserWidth=document.body.clientWidth;
        //var iBrowserHeight=document.documentElement.clientHeight;
        
        iBrowserWidth=document.body.clientWidth;
        iBrowserHeight=document.documentElement.clientHeight;
        
        var objParentPanel=document.getElementById("Panel_Root");
        
        var iParentLeft=0;
        var iParentTop=0;
             
        if (iPanelWidth>0) 
            iParentLeft=(iBrowserWidth-iPanelWidth)/2;
        if (iParentLeft<0)
            iParentLeft=0;
        
        if (iPanelHeight>0)
            iParentTop=(iBrowserHeight-iPanelHeight)/2;
        if (iParentTop<0)
            iParentTop=0;
            
        objParentPanel.style.left=iParentLeft+"px";
        objParentPanel.style.top=iParentTop+"px";
        
        objParentPanel.style.visibility="visible";
        
        return true;
    };

