var MODAL = null;
window.onfocus = RaiseModal;
document.onclick = RaiseModal;
document.ondblclick = RaiseModal;
function ModalWin(page, name, top, left, width, height, scrollBars, Resizable)
{
	try
	{
		var strParam = ',height=' + height + ',top=' + top + ',left=' + left + 
							',status=yes,toolbar=no,menubar=no,';
		if(Resizable)
		{
			strParam += 'resizable=yes,';
		}else{
			strParam += 'resizable=no,';
		}
		if(scrollBars)
		{
			strParam += 'scrollbars=yes';
		}else{
			strParam += 'scrollbars=no';
		}
		MODAL = window.open(page, name, 'width=' + width + strParam);
		MODAL.onblur = RaiseModal;
	}
	catch(er){}
}
function RaiseModal()
{
	try
	{
		MODAL.focus();
	}
	catch(er){}
}
function GetCenterWidth(inWinW){
	//---get screen width/height
	var sWidth = window.screen.width;
	//---do division to get middle of all windows
	var sMiddleW = sWidth/2;
	var inWinMiddleW = inWinW/2;
	//---do subtraction to know where to place window
	var x = sMiddleW - inWinMiddleW;
	return x;
}
function GetCenterHeight(inWinH){
	//---get screen width/height
	var sHeight = window.screen.height;
	//---do division to get middle of all windows
	var sMiddleH = sHeight/2;
	var inWinMiddleH = inWinH/2;
	//---do subtraction to know where to place window
	var y = sMiddleH - inWinMiddleH;
	return y;
}
function CenterWin(inWinW,inWinH){
	var x = GetCenterWidth(inWinW);
	var y = GetCenterHeight(inWinH);
	//---do the placement
	window.resizeTo(inWinW,inWinH)
	window.moveTo(x,y)
} //end of CenterWin()