function fnResize(document, window)
{
	var oCancel = document.all.Cancel;
	var trCancel = oCancel.createTextRange();
	var rcBounding = trCancel.getBoundingClientRect();
	var dHeight = parseInt(window.dialogHeight.slice(0, window.dialogHeight.length - 2));
	var dWidth  = parseInt(window.dialogWidth.slice(0, window.dialogWidth.length - 2));
	var dbHeight = document.body.clientHeight + document.body.clientTop;
	var dbWidth  = document.body.clientWidth + document.body.clientLeft;

	if (rcBounding.bottom + 5 > dbHeight) {
		window.dialogHeight = (rcBounding.bottom +  
		    (rcBounding.bottom - rcBounding.top)			
			+ dHeight - dbHeight - 5).toString() + "px";			
	}

	if (rcBounding.right + 5 > dbWidth) {
		window.dialogWidth = (rcBounding.right +
			(rcBounding.bottom - rcBounding.top)
			+ dWidth - dbWidth).toString() + "px";
	}
}