﻿// JScript File

    function BodoPopUp(popup, popupbg)
    {
        this.fg = popup;
        this.bg = popupbg;
        
        this._show = function()
        {
            this.fg.style.display = 'block';
            this.bg.style.display = 'block';
        }
        
        this._resize = function()
        {
            if (!this.fg || !this.bg) return;
            var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
            var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
            var pwidth = parseInt(this.fg.style.width);
            var pheight = parseInt(this.fg.style.height);
            
            this.fg.style.top =  (getClientHeight() - pheight) / 2 + "px";
            this.fg.style.left = (getClientWidth() - pwidth) / 2 + "px";
            
            this.bg.style.left = scrollLeft + "px";
            this.bg.style.top = scrollTop + "px";
            this.bg.style.height = getClientHeight() + "px";
            this.bg.style.width = getClientWidth() + "px";
        }

        this._onLayout = function()
        {   
            this._resize(this.fg, this.bg);
        } 
        
        var _pascrollHandler;
        var _paresizeHandler;
        _pascrollHandler = Function.createDelegate(this, this._onLayout);
        _paresizeHandler = Function.createDelegate(this, this._onLayout);
	if (window.addEventListener) //DOM method for binding an event
	{
		window.addEventListener('onresize', _paresizeHandler, false);
		window.addEventListener('onscroll', _pascrollHandler, false);
	}
	else if (window.attachEvent) //IE exclusive method for binding an event
	{
		window.attachEvent('onresize', _paresizeHandler);
		window.attachEvent('onscroll', _pascrollHandler);
	}
	else if (document.getElementById) //support older modern browsers
	{
		window.onload=_paresizeHandler;
		window.onload=_pascrollHandler;
	}
        
        function getClientWidth()
        {
                
		        var clientWidth; 

		        if (window.innerWidth){ 
			        clientWidth = (window.__safari ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
        			
		        } else if (document.documentElement && document.documentElement.clientWidth){ 
        		
			        clientWidth = document.documentElement.clientWidth;
        			
		        } else if (document.body){ 
        		
			        clientWidth = document.body.clientWidth;
        			
		        } else { 
        		
			        clientWidth = document.documentElement.clientWidth;
		        }
		        return clientWidth;
        }

        function getClientHeight()
        {
		        var clientHeight; 
        	
		        if (window.innerHeight) { 
        		
			        clientHeight = (window.__safari ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
        			
		        } else if (document.documentElement && document.documentElement.clientHeight){ 
        		
			        clientHeight = document.documentElement.clientHeight;
        			
		        } else if (document.body){ 
        		
			        clientHeight = document.body.clientHeight;
        			
		        } else { 
        		
			        clientHeight = document.documentElement.clientHeight;
		        }
		        return clientHeight;
        }        
    }

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();

