window.onresize=adjustFullScreen;
function displayFullScreen ()
{
	adjustFullScreen();
	grabobj("fullScreen").style.display="block";
}
function adjustFullScreen ()
{
	if (boxesOpen>0)
	{
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myWidth = document.body.offsetWidth;
			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;
		}
		
		myHeight=document.documentElement.scrollHeight;
		if (myHeight==0) myHeight=document.body.scrollHeight
		
		if (document.body.scrollHeight>myHeight) myHeight=document.body.scrollHeight;
		if (document.body.offsetHeight>myHeight) myHeight=document.body.offsetHeight;
		if (document.clientHeight>myHeight) myHeight=document.clientHeight;
		if (window.innerHeight>myHeight) myHeight=window.innerHeight;
		if (document.documentElement.clientHeight>myHeight) myHeight=document.documentElement.clientHeight;

		grabobj("fullScreen").style.height=myHeight+"px";
		grabobj("fullScreen").style.width=myWidth+"px";
	}
}
function hideFullScreen ()
{
	grabobj("fullScreen").style.display="none";
}
var boxesOpen=0;
var theboxes=new Array();
function displayBox (ref,html)
{
	if (boxesOpen>0)
	{
		grabobj(theboxes[boxesOpen]).style.display="none";
	}
	boxesOpen++;
	displayFullScreen();
	var ndiv=document.createElement("DIV");
	ndiv.className="messageBox"
	ndiv.innerHTML=html;
	ndiv.id="box_"+ref;
	theboxes[boxesOpen]=ndiv.id;
	ndiv.style.top="-9000px";

	ndiv.style.left="50%";
	document.body.appendChild(ndiv);

	ndiv.style.marginLeft="-"+(ndiv.clientWidth/2)+"px";
	ndiv.style.top="75px";
	if (window.pageYOffset) ndiv.style.top=(window.pageYOffset+50)+"px";
	if (document.documentElement.scrollTop) ndiv.style.top=(document.documentElement.scrollTop+50)+"px";
	FSiFrame = document.createElement("iframe");
	FSiFrame.className = "FSiFrame";
	FSiFrame.id = "FSiFrame";
	FSiFrame.style.position = 'absolute';
	FSiFrame.style.width = $("box_"+ref).offsetWidth+'px';
	FSiFrame.style.height = $("box_"+ref).offsetHeight+'px';
	FSiFrame.style.left = $("box_"+ref).offsetLeft+'px';
	FSiFrame.style.top = $("box_"+ref).offsetTop+'px';
	document.body.appendChild(FSiFrame);

	ndiv.style.marginLeft="-"+(ndiv.offsetWidth/2)+"px";
	
	if (window.pageYOffset) 
	{
		ndiv.style.top=(window.pageYOffset+50)+"px";
	} else {
		if (document.body.scrollTop)
		{
			ndiv.style.top=(document.body.scrollTop+50)+"px";
			
		} else {
			ndiv.style.top='50px';
			
		}
	}
	FSiFrame.style.top=ndiv.style.top;
	return ndiv;

}
function clearItem (ref)
{
	if (grabobj("box_"+ref))
	{
		grabobj("box_"+ref).style.display="none";
		grabobj("box_"+ref).outerHTML="";
		removeElementByID('box_'+ref);
		if (grabobj("box_"+ref)) grabobj("box_"+ref).id="";
		
		boxesOpen--;
		if (boxesOpen>0)
		{
			if (grabobj(theboxes[boxesOpen])) grabobj(theboxes[boxesOpen]).style.display="";
		}
		if (boxesOpen==0) hideBox();
	}
	removeElementByID('FSiFrame');
}

function removeElementByID(ID)
{
//	document.body.setAttribute('onmousedown','');
	if(typeof ID== 'string') ID=document.getElementById(ID);
	if(ID && ID.parentNode)ID.parentNode.removeChild(ID);
	return
}

function hideBox ()
{
	hideFullScreen();
}