﻿function showLightBox(divID, boxWidth, boxHeight)
{  
    if(boxWidth === undefined )
    {
        var boxWidth = 400;
    }
    
    if(boxHeight === undefined)
    {
        var boxHeight = 70;
    }
    
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var browserWidth = getBrowserDimension(false); //alert(browserWidth);
    var browserHeight = getBrowserDimension(true); //alert(browserHeight);  

    var layer = document.createElement('div');
    layer.style.zIndex = 2;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = document.documentElement.scrollHeight + 'px';
    layer.style.width = width + 'px';    
    layer.className= "bglightbox";
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.appendChild(layer);  
    
    var div = document.createElement('div');
    div.style.zIndex = 3;
    div.id = 'box';
    div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';
    div.style.top =  (browserHeight / 2) - (boxHeight / 2) + 'px';
    div.style.left = (browserWidth / 2) - (boxWidth / 2) + 'px';    	
    div.style.height = boxHeight + 'px';
    div.style.width = boxWidth + 'px';
    div.className = "lightbox";    
    document.body.appendChild(div);      

    div.innerHTML = document.getElementById(divID).innerHTML;
    
    /*var a = document.createElement('a');
    a.innerHTML = 'Close window';
    a.href = 'javascript:void(0)';
    a.onclick = function() 
    {
      document.body.removeChild(document.getElementById('layer'));
      document.body.removeChild(document.getElementById('box'));
    };
      
    div.appendChild(a);*/   

}  

function cancelLightBox()
{
    document.body.removeChild(document.getElementById('layer'));
    document.body.removeChild(document.getElementById('box')); 
}

function showLightBox2(divID, boxWidth, boxHeight)
{  
    if(boxWidth === undefined )
    {
        var boxWidth = 400;
    }
    
    if(boxHeight === undefined)
    {
        var boxHeight = 70;
    }    

    var browserWidth = getBrowserDimension(false); //alert(browserWidth);
    var browserHeight = getBrowserDimension(true); //alert(browserHeight);   
    
    var scrollheight = document.documentElement.scrollTop; 
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;

    var layer = document.createElement('div');
    layer.style.zIndex = 40000;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = document.documentElement.scrollHeight + 'px';
    layer.style.width = width + 'px';
    layer.className= "bglightbox";
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.appendChild(layer);
 
    var div = document.getElementById(divID);    
    div.style.display = "block";
    div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';
    div.style.top =  (browserHeight / 2) - (boxHeight / 2) + 'px';
    div.style.left = (browserWidth / 2) - (boxWidth / 2) + 'px';    
    div.style.width = boxWidth + 'px';
    div.style.height = boxHeight + 'px';
    div.style.zIndex = 40100;
    div.style.overflow = 'auto';
    div.className = "lightbox";  
    div.style.padding = '20px';    

} 

function cancelLightBox2(divID)
{
    document.body.removeChild(document.getElementById('layer'));
    document.getElementById(divID).style.display = "none";

} 

function getBrowserDimension(height) 
{
    if (typeof (window.innerWidth) == 'number') 
    { //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    }

    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {   //IE 6+ in 'standards compliant mode' 
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    }

    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {   //IE 4 compatible 
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }

    return (height == true) ? myHeight : myWidth;
}







