// JScript File

var oldElementID = null;

function setMoadalBGBounds(bgId)
{
    var backgroundElement = document.getElementById(bgId);
    var clientWidth;
    var clientHeight;
   
    if( window.innerWidth != undefined )
    {
        if(document.documentElement && document.documentElement.clientWidth) //mozilla
        {
            clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
            clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
        }
        else
        { 
            if (document.body) // opera
            {               
                clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
                clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
            }
            else //safari
            {                
                clientWidth = window.innerWidth;
                clientHeight = window.innerHeight;
            }
        }
    }
    else //ie
    {
        clientWidth = document.documentElement.clientWidth;
        clientHeight = document.documentElement.clientHeight;
    }
    
    if (navigator.userAgent.indexOf('MSIE') != -1 && parseFloat(navigator.appVersion)<7)
    {
        backgroundElement.style.position = 'absolute';                  
    }
    backgroundElement.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth)+'px';
    backgroundElement.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight)+'px';
}

function showModal(modalId, bgId, stat)
{    

    if (stat)
    {
		 if (oldElementID != null)
		 {
			 make(oldElementID, false);
		 }
		 
		//setMoadalBGBounds(bgId);
		make(modalId, true);
		//make(bgId, true);
		
		oldElementID = modalId;
		
    }
    else
    {
        make(modalId, false);
        //make(bgId, false);
    }
}

