/******************************************************************
 Description:	弹出一个模态对话框
 Parameters:		
	sUrl		表示准备弹出的页面，该Url必须是相对于/Root目录的相对位置
	sTitle		弹出页面的Title
	nWidth, nHeight		弹出窗口的宽、高
 eg:
		ShowModal("../Test_Js/CheckForm.htm", "测试", 800, 600);
		ShowModal("../Task/Assignment/ViewStandardAnswer.asp?AssignId=1", "测试");
		ShowModal("../Default.asp", "测试");
******************************************************************/
function ShowModal(sUrl, sTitle, nWidth, nHeight, oArguments)
{
	var sRelativePath = GetRelativePath();
	return window.showModalDialog(sRelativePath + "Root/ShowModalFrame.asp?Url=" + escape(sUrl) + "&Title=" + escape(sTitle), oArguments, "help:no;status:yes;dialogWidth:" + nWidth + "px;dialogHeight:" + nHeight + "px");
}

function GetRelativePath()
{
	var nPos = -1;
	for (var i=0; i < document.scripts.length; ++i)
	{
		var sSrc = document.scripts[i].src;
		nPos = sSrc.toLowerCase().indexOf("js/openwindow.js");
		if (nPos >= 0) break;
	}

	return sSrc.substr(0, nPos);
}


// 弹出一个非模态对话框
function OpenWindow(sUrl, nWidth, nHeight)
{
	window.open(sUrl, "", "resizable=no,width=" + nWidth + ",height=" + nHeight);
}