

var lboxWidth 	= "";
var lboxHeight 	= "";
var lboxSrc			= "";
var lboxStyle		=	"background:#fff url(/images/grey_bg.gif) repeat-x";

function show_lightbox_with_content(content)
{
  document.getElementById("lbox_content").innerHTML = content;
  document.getElementById("lbox").style.display="block";
  document.getElementById("lbox-bg").style.display="block";
}

function show_lightbox(id)
{
  var scrollTop = 0;
  var scrollLeft = 0;
  if (document.documentElement && document.documentElement.scrollTop)
  {
    // IE6 +4.01 and user has scrolled
    scrollTop = document.documentElement.scrollTop - (document.body.offsetHeight - document.body.clientHeight);
    scrollLeft = document.documentElement.scrollLeft - (document.body.offsetLeft - document.body.clientLeft);
  }
  else if (document.body && document.body.scrollTop)
  {
    // IE5 or DTD 3.2
    scrollTop = document.body.scrollTop;
    scrollLeft = document.body.scrollLeft;
  }

  document.getElementById("lbox-bg").style.width = scrollLeft + ((document.body.clientWidth > document.body.scrollWidth)?document.body.clientWidth:document.body.scrollWidth) + "px";
  document.getElementById("lbox-bg").style.height = scrollTop + ((document.body.clientHeight > document.body.scrollHeight)?document.body.clientHeight:document.body.scrollHeight ) + "px";
  document.getElementById("lbox").style.top = scrollTop + "px";
  document.getElementById("lbox").style.left = scrollLeft + "px";
  document.body.style.overflow = "hidden";
  document.getElementById("lbox").onselectstart = function(){return false;};

  //document.getElementById("lbox_content").innerHTML = document.getElementById(id).innerHTML;
  var contentElement = document.getElementById(id);
  if(!contentElement.offsetParent || contentElement.offsetParent.id != "lbox_content")
  {
    document.getElementById("lbox_content").appendChild(contentElement);
  }
  document.getElementById("lbox").style.display = "block";
  document.getElementById("lbox-bg").style.display = "block";
  
  var c, cid;
  for(c in document.getElementById("lbox_content").childNodes)
  {
    if(!isNaN(c))
    {
      cid = document.getElementById("lbox_content").childNodes[c].id;
      document.getElementById("lbox_content").childNodes[c].style.display = (cid == id) ? "block" : "none";
    }
  }
}

function hide_lightbox()
{
  document.body.style.overflow = "auto";

  document.getElementById("lbox").style.display="none";
  document.getElementById("lbox-bg").style.display="none";
}

function create_lbox()
{
	html = ''+
	'<div id="lbox-bg" style="z-index:100;display:none;position:absolute;filter:alpha(opacity=70);-moz-opacity:.70;opacity:.70;top:0;left:0;width:100%;height:100%;background-color:black">'+
  '<!--IFRAME IE6 HACK to cover SELECT dropdown list boxes.-->'+
  '<iframe src="javascript:false" marginwidth="0" marginheight="0" align="bottom" scrolling="no" frameborder="0" style="width:100%;height:100%;position:absolute;left:0;top:0px;display:block;filter:alpha(opacity=0);-moz-opacity: 0.80;opacity: 0.80;" ></iframe>'+
	'</div>'+
	'<div id="lbox" style="z-index:100;display:none;top:0;left:0;position:absolute;width:100%;height:100%">'+
	'<table border="0" width="100%" height="100%"><tr><td align="center" style="vertical-align:middle"><table border="0" style="margin:0 50px"><tr><td align="left" style="'+lboxStyle+'">'+
	'<div>'+
  '<div id="lbox_content"></div>'+
	'</div>'+
	'</td></tr></table></td></tr></table>'+
	'</div>';
	
	document.write(html);
}


create_lbox();



