
function ModalDlg(Url, Param, Width, Height)
{
var S="";
window.showModalDialog("QTIME.aspx", "");
}

function QFUNGETTIME(object)
{
if (object == null) return;
var DlgResult = window.showModalDialog("QTIME.aspx", "", "center:yes;help:no;status:no;scroll:no;dialogheight:224px;dialogwidth:320px");
if (DlgResult == null) return;
object.value = DlgResult;
}

function QFUNGETCATA(object1, object2)
{
if (object1 == null) return;
if (object2 == null) return;
var DlgResult = window.showModalDialog("SelProductionCata.aspx?NEWPAGE=Y", "", "center:yes;help:no;status:no;scroll:no;dialogheight:332px;dialogwidth:520px");
if (DlgResult == null) return;
object1.value = DlgResult[0];
object2.value = DlgResult[1];
}

function QFUNGETSJHM(object)
{
if (object == null) return;
var DlgResult = window.showModalDialog("MMS_ADD.aspx", "", "center:yes;help:no;status:no;scroll:yes;dialogheight:490px;dialogwidth:606px");
if (DlgResult == null) return;
object.innerText = DlgResult;
}

function QFUNSET(straddr, strwidth, strheight)
{
	window.showModalDialog(straddr, "", "center:yes;help:no;status:no;scroll:yes;dialogheight:" + strheight + "px;dialogwidth:" + strwidth + "px");
}

function QFUNGETDATA(straddr, strwidth, strheight)
{
	//window.open(straddr);
	var DlgResult = window.showModalDialog(straddr, "", "center:yes;help:no;status:no;scroll:yes;dialogheight:" + strheight + "px;dialogwidth:" + strwidth + "px");
	if (DlgResult == null) return false;
	return DlgResult;
}

function QFUNMODPS(PicObj,NW)
{
  if ( (PicObj != null)&&(PicObj.readyState == "complete") )
  {
	if (PicObj.offsetWidth > NW)
    {
      var W = PicObj.offsetWidth;
      var H = PicObj.offsetHeight;
		PicObj.style.width = NW;
		PicObj.style.height = NW * H / W;
    }
  }
}

function QSEARCHSET(params)
{
	return window.showModalDialog("QSearch.aspx", params, "center:yes;help:no;status:no;scroll:yes;dialogheight:321px;dialogwidth:518px");
}

function QFUNSETVISIBLE(obj)
{
	if (obj != null)
	{
		if (obj.style.display=='none')
		{
			obj.style.display='block';
		}
		else
		{
			obj.style.display='none';
		}
	}
}

function jsOpen(strForm, strID, strOther, strWin)
{
//调用说明：
//1. strForm待打开的页面文件名（不用传.aspx后缀）。
//2. strID用来指定打开的页面将显示哪一条记录。
//3. strID为空时表示进行添加记录的操作。
//4. 在打开的页面，接收Request["ID"]，以于读取记录，或添加记录。
//5. strOther是其它需要传递的参数（一个或多个&key=value）。
    if (strID == null) strID = "";
    if (strOther == null) strOther = "";
    
    var iWidth = screen.availWidth - 12;
    var iHeight = screen.availHeight - 50;
    if (/&w=/i.test(strOther))
    {
        iWidth = strOther.replace(/.*&w=(\d*).*/i, "$1");
        strOther = strOther.replace(/&w=\d*/i, "");
    }
    if (/&h=/i.test(strOther))
    {
        iHeight = strOther.replace(/.*&h=(\d*).*/i, "$1");
        strOther = strOther.replace(/&h=\d*/i, "");
    }

    if (strWin == null)
    {
        strWin = "_self";
        if (/&newwin/i.test(strOther))
        {
            strWin = "_blank";
            strOther = strOther.replace(/&newwin/i, "");
        }
    }

    var iLeft = (screen.availWidth - 12 - iWidth) / 2;
    var iTop = (screen.availHeight - 50 - iHeight)  / 2;
    var strStyle = "toolbar=no,scrollbars=yes,status=no,resizable=yes" +
                   ",width=" + iWidth +
                   ",height=" + iHeight +
                   ",left=" + iLeft +
                   ",top=" + iTop;

    return window.open(strForm + ".aspx?ID=" + strID + strOther, strWin, strStyle);
}

//关闭窗口
function jsClose(strURL)
{
//调用说明：
//1. strURL指定需要定向的页面。
//2. 不传strURL，或strURL为空时，关闭当前窗口。
//3. strURL为"parent"时，重load父窗口后，再关闭当前窗口。
//4. strURL为"parentsubmit"时，刷新父窗口后，再关闭当前窗口。
try
{
    if (strURL == null) strURL = "";
    if (window.opener!=null) 
	{
		if (typeof(window.opener.jsRefreshDGMPHOMEWorkList) == 'function') 
		{
		    window.opener.jsRefreshDGMPHOMEWorkList();
		}
	} 
    switch (strURL)
    {
        case "parent":
            if (parent == self)
            {
                if (window.opener)
                {
                    //var url = window.opener.location.href;
                    //window.opener.location = "about:blank";
                    //window.opener.location = url;
                    //window.opener.focus();
                    ////window.opener.location.reload();
                    window.opener.document.forms[0].submit();
                }
                window.opener = null;
                window.close();
            }
            else
            {
                var url = parent.location.href;
                parent.location = "about:blank";
                parent.location = url;
            }
            break;
        case "parentsubmit":
            if (parent == self)
            {
                if (window.opener)
                {
                    window.opener.document.forms[0].submit();
                    window.opener.focus();
                }
                window.opener = null;
                window.close();
            }
            else
            {
                parent.document.forms[0].submit();
            }
            break;
        case "":
            if (parent == self)
            {
                window.opener = null;
                window.close();
            }
            break;
        default:
            var objLink = document.createElement("A");
            objLink.href = strURL;
            document.body.appendChild(objLink);
            objLink.click();
            //document.location.replace(strURL);
            break;
    }
}
catch (e)
{
}
}