<!--
function CE_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=CE_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function CE_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=CE_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=CE_findObj(args[i]);
    if (val) { nm=val.getAttribute('cname'); if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- “'+nm+'” 应填写 Email 地址。\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- “'+nm+'” 应填写数字。\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=parseFloat(test.substring(8,p)); max=parseFloat(test.substring(p+1));
          if (val<min || max<val) errors+='- “'+nm+'” 应是 '+min+' 到 '+max+' 之间的数字。\n';
    } } } else if (test.charAt(0) == 'R') errors += '- “'+nm+'” 必须填写内容.\n'; }
  } if (errors) alert('有以下错误:\n'+errors);
  document.CE_returnValue = (errors == '');
}

//ObjectList 对象名字字符串
//ChinaNameList 对象出错信息描术的名字字符串
function CheckChar(ObjectList,ChinaNameList)
{
	var obj;var i;
	var nameaaa;
	var Str=new String();
	if(ObjectList=="" || ChinaNameList=="" ){return false;}
	Str=ObjectList;
	obj=Str.split(',');
	Str=ChinaNameList;
	nameaaa=Str.split(',');
	if(obj.length!=nameaaa.length){return false;}
	
	with(window.document.all)
	{
		for(i=0;i<obj.length;i++)
		{
			try{Str=item(obj[i]).value;}catch(e){alert("错误的参数"+obj[i]);return false;}
			if(Str!=null && Str!="")
			{
			if(Str.indexOf("<")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “<” 请用其它符号代替！");return false;}
			if(Str.indexOf(">")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “>” 请用其它符号代替！");return false;}
			//if(Str.indexOf("@")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “@” 请用其它符号代替！");return false;}
			//if(Str.indexOf(".")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “.” 请用其它符号代替！");return false;}
			//if(Str.indexOf("(")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “(” 请用其它符号代替！");return false;}
			//if(Str.indexOf(")")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “)” 请用其它符号代替！");return false;}
			if(Str.indexOf("'")!=-1){alert("“"+nameaaa[i]+"”中有非法字符 “'” 请用其它符号代替！");return false;}
			}
		}
	}
	return true;
}

function checkString(strName,Str){
	if(Str!=null && Str!="")
	{
		if(Str.indexOf("<")!=-1){alert("“"+strName+"”中有非法字符 “<” 请用其它符号代替！");return false;}
		if(Str.indexOf(">")!=-1){alert("“"+strName+"”中有非法字符 “>” 请用其它符号代替！");return false;}
		//if(Str.indexOf("@")!=-1){alert("“"+strName+"”中有非法字符 “@” 请用其它符号代替！");return false;}
		//if(Str.indexOf("(")!=-1){alert("“"+strName+"”中有非法字符 “(” 请用其它符号代替！");return false;}
		//if(Str.indexOf(")")!=-1){alert("“"+strName+"”中有非法字符 “)” 请用其它符号代替！");return false;}
	    if(Str.indexOf("'")!=-1){alert("“"+strName+"”中有非法字符 “'” 请用其它符号代替！");return false;}
	    //if(Str.indexOf("=")!=-1){alert("“"+strName+"”中有非法字符 “=” 请用其它符号代替！");return false;}
	}
}


function checkEmailString(strName,Str){
	if(Str!=null && Str!="")
	{
		if(Str.indexOf("<")!=-1){alert("“"+strName+"”中有非法字符 “<” 请用其它符号代替！");return false;}
		if(Str.indexOf(">")!=-1){alert("“"+strName+"”中有非法字符 “>” 请用其它符号代替！");return false;}
		if(Str.indexOf("(")!=-1){alert("“"+strName+"”中有非法字符 “(” 请用其它符号代替！");return false;}
		if(Str.indexOf(")")!=-1){alert("“"+strName+"”中有非法字符 “)” 请用其它符号代替！");return false;}
	    if(Str.indexOf("'")!=-1){alert("“"+strName+"”中有非法字符 “'” 请用其它符号代替！");return false;}
	    if(Str.indexOf("=")!=-1){alert("“"+strName+"”中有非法字符 “=” 请用其它符号代替！");return false;}
	}
}

function checkseachstring(objSearch)
{
	 objSearchStatus=objSearch;
     var strseach=objSearch.value;
     if(checkString('检索条件',strseach)==false){
           return false;	
     }
     while(strseach.indexOf(" ") == 0) 
     {
         strseach=strseach.substr(1);
     }
     while((strseach.lastIndexOf(" ")>0) && (strseach.lastIndexOf(" ") == strseach.length-1))
     {
         strseach=strseach.substr(0,strseach.length-1);
     }
    if(strseach=="" || strseach==null) 
      {
        window.alert("请输入要检索的关键词")
        objSearch.value="";
        objSearch.focus()
        return false;
      }
    else
      {
		 window.setTimeout("ShowQueryStatus()",1000);
         return true;
      }
 }
 
 var objSearchStatus
 function ShowQueryStatus()
 {
	objSearchStatus.readOnly=true;
	if (objSearchStatus.value.indexOf("检") == 0)
	    if (objSearchStatus.value.length==1)
			objSearchStatus.value="检索";
	    else if (objSearchStatus.value.length==2)
			objSearchStatus.value="检索中";
		else if (objSearchStatus.value.length>=objSearchStatus.size-1)
			objSearchStatus.value=" ";
		else
			objSearchStatus.value=objSearchStatus.value+".";
	else
		objSearchStatus.value="检";
	objSearchStatus.select();
		
	window.setTimeout("ShowQueryStatus()",100);
 }

function ValidLogIn(theForm)
{
    if(theForm.elements["UserName"].value=="") 
    {
        window.alert("请输入用户名")
        theForm.elements["UserName"].focus()
        return false;
    }
	if(checkString('用户名',theForm.elements["UserName"].value)==false)
	{
		return false;
	}
    if(theForm.elements["Password"].value=="") 
    {
        window.alert("请输入密码")
        theForm.elements["Password"].focus()
        return false;
    }
	if(checkString('密码',theForm.elements["Password"].value)==false)
	{
		return false;
	}
	return true;
}
