function showOverlay(id)
{
  if (!document.getElementById('overlaybox'))
  {
    var pageSize  = getPageSize();
    var soChild   = document.createElement("DIV");
    var soParent  = document.getElementsByTagName("BODY")[0];
    var oIframe   = document.createElement("IFRAME");
    var boxObj    = document.getElementById(id);
    
    soParent.appendChild(soChild);

    soChild.style.width = (pageSize[0]) + 'px';
    soChild.style.height = (pageSize[1] + 'px');

    soChild.style.position = 'absolute';
    soChild.style.top = '0px';
    soChild.style.left = '0px';
    soChild.style.display = 'block';
    soChild.style.zIndex = '30000';
    soChild.style.backgroundColor = '#999999';
    soChild.id = 'overlaybox';
    setOpacity(soChild, 70);

    // Creating and adding dynamic iframe to the page source.
    
    oIframe.setAttribute('id', 'IFrmHelper');
    oIframe.style.border = 0;
    oIframe.width = boxObj.offsetWidth;
    oIframe.height = boxObj.offsetHeight;
    oIframe.style.position = "absolute";
    oIframe.style.visibility = 'hidden';
    soParent.appendChild(oIframe);        
  }
}

function hideOverlay()
{
    var soChild     = document.getElementById('overlaybox');
    var soParent    = document.getElementsByTagName("BODY")[0];
    
    soParent.removeChild(soChild);
}

function setOpacity(obj, opacity)
{
	opacity = (opacity == 100) ? 99.999 : opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLopacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.Mozopacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

/**
 * Get the size of the page loaded in the current window
 */
function getPageSize() 
{ 
     var xScroll, yScroll; 

     if (window.innerHeight && window.scrollMaxY)  
     {        
         xScroll = document.body.scrollWidth;
         yScroll = window.innerHeight + window.scrollMaxY; 
     }  
     else if (document.body.scrollHeight > document.body.offsetHeight) 
     { // all but Explorer Mac 
         xScroll = document.body.scrollWidth; 
         yScroll = document.body.scrollHeight; 
     }  
     else  
     { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 
         xScroll = document.body.offsetWidth; 
         yScroll = document.body.offsetHeight; 
     }

     var windowWidth, windowHeight; 

     if (self.innerHeight)  
     {   // all except Explorer 
         windowWidth = self.innerWidth; 
         windowHeight = self.innerHeight; 
     }  
     else if (document.documentElement && document.documentElement.clientHeight)  
     { // Explorer 6 Strict Mode 
         windowWidth = document.documentElement.clientWidth; 
         windowHeight = document.documentElement.clientHeight; 
     }  
     else if (document.body)  
     { // other Explorers 
         windowWidth = document.body.clientWidth; 
         windowHeight = document.body.clientHeight; 
     }

     // for small pages with total height less then height of the viewport 
     if(yScroll < windowHeight) 
     {
         pageHeight = windowHeight;
     }
     else
     {
         pageHeight = yScroll;
     }

     // for small pages with total width less then width of the viewport 
     if(xScroll < windowWidth) 
     {        
         pageWidth = windowWidth; 
     }  
     else  
     { 
         pageWidth = xScroll; 
     }

     arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)  
     
     return arrayPageSize; 
}