// JavaScript Document

var curr_lb_div;
var is_modal = false;

function hideloadingdiv(divelm)
{
	if (document.getElementById(divelm))
	{
		document.getElementById(divelm).style.display='none';
//		document.getElementById('fade').style.display='none';
//		curr_lb_div = '';
	}
}

function HideLightBox()
{
	if (document.getElementById(curr_lb_div))
	{
		document.getElementById(curr_lb_div).style.display='none';
		document.getElementById('fade').style.display='none';
		curr_lb_div = '';
	}
}

function ShowLightBox(subobjstr, isModal, leftoffSet) {
	var subobjwidth = 0;
	var subobjheight = 0;
		
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrOfY = window.pageYOffset; scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft;
	}
	
	 var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

	
	var subobj=document.getElementById(subobjstr)
	document.getElementById('fade').style.display='block';
	curr_lb_div = subobjstr;
	if (isModal)
		is_modal = true;
		else is_modal = false;

	
//	subobj.style.display=(subobj.style.display!="block")? "block" : "none";
	subobj.style.display='block';
	
	if (document.getElementById(subobjstr)) {
		subobjwidth = document.getElementById(subobjstr).offsetWidth / 2;
	}

	if (document.getElementById(subobjstr)) {
		subobjheight = document.getElementById(subobjstr).offsetHeight / 2;
	}

	var xpos = (myWidth/2)-leftoffSet - subobjwidth;
//	var ypos = (myHeight/2) + subobjheight; //middle of screen
	subobj.style.left=xpos+"px";
	subobj.style.top=scrOfY+"px";
//	subobj.style.top=ypos+"px"; // middle of screen

//	subobj.style.height="200px"; // fixed height
}




