var bodyDir;
var bodyObj;
if (document.body) {bodyDir=document.body.dir;bodyObj=document.body;}
else if (document.getElementById('body')) {bodyDir=document.getElementById('body').dir;bodyObj=document.getElementById('body');}
document.write('<iframe id="hideAllDIV" style="display: none; position: absolute; top: 0px; left: 0px; background: #000; opacity: 0.4; -moz-opacity: 0.4; -khtml-opacity: 0.4; filter: alpha(opacity=40); width: 100%; height: 100%;"></iframe><!-- is for IE5,6 -->');
//document.write('<div id="winBox" style="direction: '+bodyDir+'; display: none; position: absolute; background: #b9e77b; color: #333; border: 1px solid #636D61; top: 70px; z-index: 100; width: 70%;"><div id="winBoxTitle" style="width: 70%; border: 1px solid #0f0;"></div><div style="width: auto; border: 1px solid #f00; padding:2px; cursor: pointer; " onclick="hideWinBox();">x</div><br/><div style="margin:2px; height: 100%; width: 100%;" id="winBoxMain"></div></div>');
document.write('<div id="winBox" style="direction: '+bodyDir+'; display: none; position: absolute; background: #FAFAFA; color: #333; border: 1px solid #636D61; top: 70px; z-index: 100; width: 650px; "><table style="width: 100%;" border="0"><tr><td id="winBoxTitle" style="border: 0px solid #0f0;"> </td><td style="width: 10px;"><img src="/htm-webaxy/select/close.gif" style="cursor:pointer;"  onclick="hideWinBox();"></td></tr></table><div style="margin:2px; height: 100%; width: 100%;" id="winBoxMain"></div></div>');
var hideAllDIV=document.getElementById('hideAllDIV');
var winBox=document.getElementById('winBox');

function getWinBoxTitle(){
	return document.getElementById('winBoxTitle');
}
function getWinBoxContent(){
	return document.getElementById('winBoxMain');
}
function showWinBox(){
//	alert('offsetHeight='+document.body.offsetHeight+'; clientHeight=' +document.body.clientHeight+'; scrollHeight'+document.body.parentNode.scrollHeight+';');
	if (document.documentElement && document.documentElement.scrollTop)
		theTop = document.documentElement.scrollTop;
	else if (document.body)
		theTop = document.body.scrollTop
	hideAllDIV.style.display='block';
	hideAllDIV.style.height=document.body.scrollHeight+theTop+'px';
	winBox.style.display='block';
	winBox.style.left= parseInt((document.body.clientWidth-winBox.offsetWidth)/2)+'px';
	winBox.style.top=(50+theTop)+'px';
	winBox.focus();
	
}
function hideWinBox(){
	hideAllDIV.style.display='none';
	winBox.style.display='none';
	var winBoxTitle=getWinBoxTitle();
	while (winBoxTitle.childNodes[0]){
	    winBoxTitle.removeChild(winBoxTitle.childNodes[0]);
	}
	var winBoxContent=getWinBoxContent();
	while (winBoxContent.childNodes[0]){
	    winBoxContent.removeChild(winBoxContent.childNodes[0]);
	}
	
}
function getBounds(el){ // return absolute left top width height of object
	var Left = el.offsetLeft;
	var Top = el.offsetTop;
	var parent = el;
	while (parent = parent.offsetParent){
		Left += parent.offsetLeft;
		Top += parent.offsetTop;
	}
//	alert('left: '+Left+', top: '+Top+', width: '+el.offsetWidth+', height: '+el.offsetHeight);
	return {left: Left, top: Top, width: el.offsetWidth, height: el.offsetHeight};
}

