/*
  Lightbox for images 
  (c) 2008-2009 xul.fr
  GPL license
*/  

function viewHeight() 
{
    if(window.innerHeight)return(window.innerHeight);
    if(document.documentElement && document.documentElement.clientHeight) 
         return(document.documentElement.clientHeight);
    if(document.body) return(document.body.clientHeight); 
    return 50;
}

function viewWidth() 
{
    if(window.innerWidth)return(window.innerWidth);
    if(document.documentElement && document.documentElement.clientWidth) 
         return(document.documentElement.clientWidth);
    if(document.body) return(document.body.clientWidth); 
    return 50;
}

function openbox(box_name)
{
	var box = document.getElementById(box_name); 
  	var filter =  document.getElementById('filter');	
	document.getElementById('filter').style.display='block';
	
  if(navigator.appName.substring(0, 3) == "Mic")  // for IE
  {
    box.style.display='block';
    x = document.documentElement.scrollTop + document.body.scrollTop + 
    box.offsetHeight / 4;
    box.style.top = x + "px";
    filter.style.top = document.documentElement.scrollTop + document.body.scrollTop;
	
	y = document.documentElement.scrollLeft + document.body.scrollLeft + 
    box.offsetWidth / 4;
    box.style.left = y + "px";
    filter.style.left = document.documentElement.scrollLeft + document.body.scrollLeft;
  }
  else
  {
    box.style.display='block';
    var top =  (viewHeight() - box.offsetHeight ) / 2;    
    box.style.top = top + 'px';
	
	var left =  (viewWidth() - box.offsetWidth ) / 2;    
    box.style.left = left + 'px';
	
    box.style.position='fixed'; // fixed does not work on IE
    filter.style.position='fixed'; 
  }

}

function closebox(box_name)
{
	document.getElementById('filter').style.display='none';
	document.getElementById(box_name).style.display='none';
}