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