SizeOfPageLayout_MessageBox_Close_Timer_Show = function(div_name){
	try{
		document.getElementById(div_name + '_OK_button_link').innerHTML = 'OK [' + eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name) + ']';
	}catch(e){}
}

SizeOfPageLayout_MessageBox_Close_Timer_Decrement = function(div_name){
	eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + '--;');
	SizeOfPageLayout_MessageBox_Close_Timer_Show(div_name);
	if(eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name) <= 0){
		SizeOfPageLayout_MessageBox_Show(div_name, 'hide');
		clearTimeout(eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + '_Decrement_timeout'));
	}else{
		eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + '_Decrement_timeout = setTimeout(\'SizeOfPageLayout_MessageBox_Close_Timer_Decrement("' + div_name + '")\', 1000);');
	}
}

SizeOfPageLayout_MessageBox_Show = function(div_name, pShow, pTime){
	if((obj = document.getElementById(div_name))){
		var show = pShow == 'show';

		if(!pTime || isNaN(pTime) || pTime < 1) pTime = 15;

		if(show && (eval('typeof SizeOfPageLayout_MessageBox_Close_Timer_' + div_name) == 'undefined' || eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name) <= 0)){
			eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + ' = ' + pTime);
			SizeOfPageLayout_MessageBox_Close_Timer_Show(div_name);
			eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + '_Decrement_timeout = setTimeout(\'SizeOfPageLayout_MessageBox_Close_Timer_Decrement("' + div_name + '")\', 1000);');
		}

		if(show){
			try{
				SizeOfPageLayout_MessageBox_Redim(div_name);
				obj.style.display = 'block';
			}catch(e){}
		}else{
			obj.style.display = 'none';

			try{
				clearTimeout(SizeOfPageLayout_MessageBox_Redim_timeout);
				clearTimeout(eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + '_Decrement_timeout'));
			}catch(e){}

			eval('SizeOfPageLayout_MessageBox_Close_Timer_' + div_name + ' = 0');
		}

		if(navigator.appName.indexOf('Microsoft Internet Explorer') > -1){
			document.body.scroll = show ? 'no' : 'yes';
		}else{
			document.body.style.overflow = show ? 'hidden' : 'auto';
			document.body.style.overflowX = show ? 'hidden' : 'auto';
			document.body.style.overflowY = show ? 'hidden' : 'auto';
		}

		SizeOfShowDIVUnwantedTags(!show, 0, 0, parseInt(obj.style.width), parseInt(obj.style.height));
	}
}

SizeOfPageLayout_MessageBox_Redim = function(div_name){
	try{
		var test1 = getBrowserWindowInternalDimensions(),
			x = test1[0],
			y = test1[1],
			y2 = document.body.scrollHeight,
			s = document.getElementById(div_name).style;

		if(y2 > y) y = y2;

		s.width = x + "px";
		s.height = y + "px";

		if(s.display != 'none'){
			SizeOfShowDIVUnwantedTags(false, 0, 0, x, y);
			SizeOfPageLayout_MessageBox_Redim_timeout = setTimeout("SizeOfPageLayout_MessageBox_Redim('" + div_name + "')", 100);
		}else{
			try{
				SizeOfShowDIVUnwantedTags(true, 0, 0, x, y);
				clearTimeout(SizeOfPageLayout_MessageBox_Redim_timeout);
			}catch(e){}
		}
	}catch(e){}
}





getBrowserWindowInternalDimensions = function(){
  var myWidth = 0, myHeight = 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;
  }
  return new Array(myWidth, myHeight);
}





var HTMLTags_to_show_again = new Array(),
	browserIsMSIE = navigator.appName.indexOf('Microsoft Internet Explorer') > -1;

SizeOfShowObjects = function(objs, show, x, y, w, h){
	try{
		var selx, sely, selw, selh, i, j, l, tagIsIFRAME = false, tagIsSELECT = false, hide = false;

		for(i=0; i<objs.length; i++){
			tagIsSELECT = objs[i].tagName == 'SELECT';
			tagIsIFRAME = objs[i].tagName == 'IFRAME';

			if(!tagIsSELECT || browserIsMSIE){
				selx=0; sely=0; var selp;

				if(objs[i].offsetParent){ selp = objs[i]; while(selp.offsetParent){ selp = selp.offsetParent; selx += selp.offsetLeft; sely += selp.offsetTop; } }

				selx += objs[i].offsetLeft; sely += objs[i].offsetTop;
				selw = objs[i].offsetWidth; selh = objs[i].offsetHeight;

				/*alert((selx+selw) + ' > ' + x + ' = ' + (selx+selw>x ? 'true' : 'false') + ', ' +
					  selx + ' < ' + (x+w) + ' = ' + (selx<x+w ? 'true' : 'false') + ', ' +
					  (sely+selh) + ' > ' + y + ' = ' + (sely+selh>y ? 'true' : 'false') + ', ' +
					  sely + ' < ' + (y+h) + ' = ' + (sely<y+h ? 'true' : 'false'));*/

				if((selx+selw>x && selx<x+w && sely+selh>y && sely<y+h) || (show && tagIsIFRAME && browserIsMSIE)){
					if(!show){
						hide = (tagIsIFRAME && browserIsMSIE && (objs[i].style.display != "block")) || (objs[i].style.visibility != "hidden");
						if(hide){
							HTMLTags_to_show_again[HTMLTags_to_show_again.length] = objs[i];
							if(tagIsIFRAME && browserIsMSIE) objs[i].style.display = "none";
							else objs[i].style.visibility = "hidden";
						}
					}else{
						for(j=0; j<HTMLTags_to_show_again.length; j++){
							if(HTMLTags_to_show_again[j] == objs[i]){
								if(tagIsIFRAME && browserIsMSIE) objs[i].style.display = "block";
								else objs[i].style.visibility = "visible";

								for(l=j+1; l<HTMLTags_to_show_again.length; l++) HTMLTags_to_show_again[l-1] = HTMLTags_to_show_again[l];
								HTMLTags_to_show_again[l] = null;
							}
						}
					}
				}
			}
		}
	}catch(e){
	}
}





SizeOfShowDIVUnwantedTags = function(show, x, y, w, h){
	SizeOfShowObjects(document.getElementsByTagName('IFRAME'), show, x, y, w, h);
	SizeOfShowObjects(document.getElementsByTagName('OBJECT'), show, x, y, w, h);
	SizeOfShowObjects(document.getElementsByTagName('SELECT'), show, x, y, w, h);
	if(window.getRTEs) SizeOfShowObjects(getRTEs(), show, x, y, w, h);
}
