
function PopupWindow(strDiv)
{
    this.Width = 400;
    this.Height = 300;
    this.ContentDiv = strDiv;
    this.ZIndex = 10;
    this.ShowShadow = true;
    
    this.SetShadow = function(bOn)
    {
        this.ResizeShadow();
        
        drop = document.getElementById("shadow");
        
        if( bOn )
        {
            drop.style.zIndex=this.ZIndex;
            drop.style.display='block';
            drop.style.backgroundColor = 'Gray';
//            drop.style.filter='alpha(opacity=75)';
//            drop.style.opacity=.75;
        }
        else
        {
            drop.style.display='none';
        }
    }

    this.CenterObject = function() {
        panel = document.getElementById(this.ContentDiv);

        if (self.innerHeight) // all except Explorer
        {
            innerW = self.innerWidth;
            innerH = self.innerHeight;
            panel.style.position = 'fixed';
        }
        else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
        {
            innerH = document.documentElement.clientHeight;
            innerW = document.documentElement.clientWidth;

            panel.style.position = 'absolute';
            document.body.style.overflow = 'hidden';
        }
        else if (document.body) // other Explorers
        {
            innerW = document.body.clientWidth;
            innerH = document.body.clientHeight;
            version = 0;

            if (navigator.appVersion.indexOf("MSIE") != -1) {
                temp = navigator.appVersion.split("MSIE")
                version = parseFloat(temp[1])

                if (version < 7)// < ie 7
                {
                    panel.style.position = 'absolute';
                    document.body.style.overflow = 'hidden';
                }
                else// ie 7
                {
                    panel.style.position = 'fixed';
                }
            }
        }

        panel.style.display = 'block';
        panel.style.left = ((innerW - this.Width) / 2).toString() + 'px';
        panel.style.top = (((innerH - this.Height) / 2)).toString() + 'px';
        panel.style.width = this.Width.toString() + 'px';
        panel.style.height = this.Height.toString() + 'px';
        panel.style.zIndex = this.ZIndex + 1;
    }

    this.ShowPopup = function()
    {
        if( this.ShowShadow )
            this.SetShadow(true);

        this.CenterObject();
    }

    this.HidePopup = function()
    {
        panel=document.getElementById(this.ContentDiv);
        panel.style.display='none';
        
        if( this.ShowShadow )
            this.SetShadow(false);
    }
    
    this.ResizeShadow = function()
    {
        var drop = document.getElementById("shadow");
        
        if( drop )
        {
            if (self.innerHeight) // all except Explorer
            {
                innerW = self.innerWidth;
                innerH = self.innerHeight;
            }
            else if (document.documentElement && document.documentElement.clientHeight)	// Explorer 6 Strict Mode
            {
                innerW = document.documentElement.clientWidth;
                innerH = document.documentElement.clientHeight;
            }
            else if (document.body) // other Explorers
            {
                innerW = document.body.clientWidth;
                innerH = document.body.clientHeight;
            }
            drop.style.left='0px';
            drop.style.top='0px';
            drop.style.width=innerW.toString() + 'px';
            drop.style.height=innerH.toString() + 'px';
        }
    }
}

// Make sure we have a drop shadow
if( !document.getElementById('shadow') )
{
            if (self.innerHeight) // all except Explorer
            {  
            document.write('<div id="shadow" style="position:fixed; display:none; filter:alpha(opacity=50); opacity:.5;"></div>');
            }
            else{
                 version=0
                 if (navigator.appVersion.indexOf("MSIE")!=-1)
                 {
                    temp=navigator.appVersion.split("MSIE")
                    version=parseFloat(temp[1])
                 }


                 if (version<7)	// Explorer 6  
                {
                     document.write('<div id="shadow" style="position:absolute; display:none; filter:alpha(opacity=50); opacity:.5;"></div>');
                }
                 else
                 {
                        document.write('<div id="shadow" style="position:fixed; display:none; filter:alpha(opacity=50); opacity:.5;"></div>');
                    }
    }
}