// JScript 文件
//ıΪ
function CheckTextBox(CID,HelpStr)
{	
	var Result = true;
	if(CID.value == "")
	{
		Result = false;
		alert(HelpStr);
		CID.focus();
	}
	return Result;
}

//  Add by nj
function CheckEmail(CID,HelpStr)
{
    
	var Reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	var Result = false;
	
	if (Reg.test(CID.value))
	{	    
		Result = true;
	}
	else
	{
	    alert(HelpStr);
	    CID.focus();
		Result = false;
	}
	return Result; 
}

function CheckSelect(CID,Comstr,HelpStr)
{
    var Result = true;
	if(CID.options(CID.selectedIndex).text == Comstr)
	{
		Result = false;
		alert(HelpStr);
	}
	return Result;
}

//ñ༭ؼ

function SetFocus( EdtControl )
{
    if (EdtControl != null)
    {
        EdtControl.focus();
        EdtControl.value += "";
    }
}

function isnum()
{
    
    if(event.keyCode<45 || event.keyCode>57)
    {
        event.keyCode=0;
    }
}

/**********************************************************************
* 功能：打开一个模态窗?
* 参数?
*   url         [string]    窗口显示的文件路?
*   width       [int]       窗口宽度，以px为单?
*   height      [int]       窗口高度，以px为单?
*   howScroll   [bool]      是否显示滚动?
*   showStatus  [bool]      是否显示状态栏
*   allowResize [bool]      是否允许调整窗口大小
*   inArg       [var]       传到新窗口的参数
* 返回值：
*   由窗口调用___SetWindowRreturnValue函数时设置的值?
**********************************************************************/
function ___OpenModalWindow(url,width,height,showScroll,showStatus,allowResize,inArg)
{
    var showStyle = "dialogWidth:415px;dialogHeight:420px;scroll:no;status:no;resizable:no;";
    showStyle += "dialogWidth:" + width + "px;";
    showStyle += "dialogHeight:" + height + "px;";
    showStyle += "scroll:" + (showScroll ? "yes;" : "no;");
    showStyle += "status:" + (showStatus ? "yes;" : "no;");
    showStyle += "resizable:" + (allowResize ? "yes;" : "no;");
    if (url.indexOf("?") >= 0)
        url += "&Temp__Data__=" + String(Math.random());
    else
        url += "?Temp__Data__=" + String(Math.random());
    url = encodeURI(url);
    return window.showModalDialog(url, inArg, showStyle);
}
/**********************************************************************
* 功能：设置模态窗口返回值（此函数一般在窗口关闭之前调用?
* 参数?
*   returnValue     [string]    棋态窗口关闭时的返回?
* 返回值：
*   无?
**********************************************************************/


function ___SetWindowRreturnValue(returnValue)
{
    window.returnValue = returnValue;
}

function ___SelectTabPage(tabHeadBox, tabPageCtr)
{
    if(tabHeadBox.className == "TabItemSelected")return;
    var row = tabHeadBox.parentElement;
    var selectedIndex = -1;
    for(var i=0;i<row.cells.length-1;i++)
    {
        if (row.cells[i].className == "TabItemSelected")
        {
            row.cells[i].className = "TabItem";
            selectedIndex = i;
            break;
        }
    }
    tabHeadBox.className = "TabItemSelected";
    if (selectedIndex != -1)
        tabPageCtr.rows[selectedIndex].style.display = "none";
    tabPageCtr.rows[tabHeadBox.cellIndex].style.display = "";
}

function ___WindowInit()
{
    if (document.readyState=='complete')
    {
        var inCtrs = document.getElementsByTagName("INPUT");
        var arCtrs = document.getElementsByTagName("TEXTAREA");
        if (inCtrs)
        {
            for(var i=0;i<inCtrs.length;i++)
            {
                if (inCtrs[i].type.toLowerCase() == "text" && inCtrs[i].className.toLowerCase() == "notifytextboxcss")
                {
                    inCtrs[i].onfocus = ___NotifyTextBox_OnFocus;
                    inCtrs[i].onblur = ___NotifyTextBox_OnBlur;
                }
            }
        }
        if (arCtrs)
        {
            for(var i=0;i<arCtrs.length;i++)
            {
                if (arCtrs[i].className.toLowerCase() == "notifytextboxcss")
                {
                    arCtrs[i].onfocus = ___NotifyTextBox_OnFocus;
                    arCtrs[i].onblur = ___NotifyTextBox_OnBlur;
                }
            }
        }
        window.focus();
    }
    else
    {
        window.setTimeout(___WindowInit, 200);
    }
}
function ___NotifyTextBox_OnFocus()
{
    var ctr = event.srcElement;
    if (ctr.className.toLowerCase() == "notifytextboxcss" && !ctr.readOnly && !ctr.disabled)
    {
        ctr.className = "NotifyTextBoxSelectedCSS";
    }
}
function ___NotifyTextBox_OnBlur()
{
    var ctr = event.srcElement;
    if (ctr.className.toLowerCase() == "notifytextboxselectedcss" && !ctr.readOnly && !ctr.disabled)
    {
        ctr.className = "NotifyTextBoxCSS";
    }
}




window.onload = ___WindowInit; 

