function valid(theText) {
  var tmp = theText.type
  var vlu = "";
  var errFld = null;
  var errType=0;
  var checkStr="";
  var alias="";
  var minValue,maxValue;
  flag = true;
  for (i=0;i<1;i++) {
    if( tmp=='text' || tmp=='select-one' || tmp=='textarea'||tmp=='password'||tmp=='hidden') {
      theText.value=javaTrim(theText.value);
      vlu = javaTrim(theText.value);
      //检查是否不能为空
      tmp = theText.isNull;
      if(tmp) {
        if(tmp=="true" && vlu=='') {
          flag = true;
          break;
        }
      }
      tmp=theText.type;
      maxLen=theText.maxLength;//检查最大长度
      if(typeof(maxLen)!="undefined"&&javaValidNumber(maxLen+"")) {
        if(theText.value.length>parseInt(maxLen+"")) {
          if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
          alert(alias+"长度错误,最大长度不能超过"+maxLen+"个字符！");
          errFld=theText;

          flag = false;
          break;
        }
      }
      minLen=theText.minLength;//检查最小长度
      if(typeof(minLen)!="undefined"&&javaValidNumber(minLen+"")) {
        if(theText.value.length<parseInt(minLen+"")) {
          if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
          alert(alias+"长度错误,长度不能少于"+minLen+"个字符！");
          errFld=theText;

          flag = false;
          break;
        }
      }
      if(!checkDenyChar(theText)) {//检查不允许输入字符
        checkStr=getCheckStr(theText,"dc")
                 if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
                 alert(alias+"不能包含（    "+checkStr+"    ）字符！");
                 errType=2;
                 errFld = theText;

                 flag = false;
                 break;
      }
      //检查只允许输入字符
      if(!checkAgreeChar(theText)) {
        checkStr=getCheckStr(theText,"ac");
        if(typeof(theText.alias)!='undefined')
          alias=theText.alias+":";
        alert(alias+"只能包含（    "+checkStr+"    ）字符！");
        errType=3;
        errFld = theText;

        flag = false;
        break;
      }
      //检查只允许输入词组,词组之间用逗号","相隔
      if(!checkAgreeChar2(theText)) {
        checkStr=getCheckStr(theText,"ac2");
        if(typeof(theText.alias)!='undefined')
          alias=theText.alias+":";
        alert(alias+"只能包含（    "+checkStr+"    ）中逗号中的词组！");
        errType=3;
        errFld = theText;

        flag = false;
        break;
      }
      //处理引号循环
      /*if( tmp=='text'|| tmp=='textarea'||tmp=='password'||tmp=='hidden')
      {
      theText.value=theText.value.replace(/\'/g,"\'\'");
      }
      */
      //检查数据类型
      tmp = theText.dataType
      if(tmp) {
        tmp=tmp.toLowerCase();
        if('date'==tmp||'datetime'==tmp||'smalldatetime'==tmp) {
          if(!javaValidDate(vlu)) {
            if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
            alert(alias+'请输入一个合法的日期！');
            errFld = theText;

            flag = false;
            break;
          }
        }
        else if('int'==tmp||'smallmoney'==tmp||'money'==tmp||'numeric'==tmp||'bigint'==tmp||'decimal'==tmp||'double'==tmp||'float'==tmp||'real'==tmp||'smallint'==tmp||'tinyint'==tmp||'integer'==tmp) {
          if(!javaValidNumber(vlu)) {
            if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
            alert(alias+'请输入一个合法的数字！');
            errFld = theText;

            flag = false;
            break;
          }
          if('int'==tmp||'integer'==tmp||'bigint'==tmp||'smallint'==tmp||'tinyint'==tmp) {
            if(vlu.indexOf(".")!=-1) {
              if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
              alert(alias+'不能有小数点，请输入一个合法的整数！');
              errFld = theText;

              flag = false;
              break;
            }
          }
          minValue=theText.minValue;
          if(typeof(minValue)!='undefined') {
            minValue=parseFloat(minValue,10);
            if(isNaN(minValue)) {
              if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
              alert(alias+"最小值无效！");

              flag = false;
              break;
            } else {
              if(!isNaN(parseFloat(theText.value,10))&&parseFloat(theText.value,10)<minValue) {
                if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
                alert(alias+"值必须大于等于"+minValue+"！");
                errFld = theText;

                flag = false;
                break;
              }
            }
          }
          maxValue=theText.maxValue;
          if(typeof(maxValue)!='undefined') {
            maxValue=parseFloat(maxValue);
            if(isNaN(maxValue)) {
              if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
              alert(alias+"最大值无效！");

              flag = false;
              break;
            } else {
              if(!isNaN(parseFloat(theText.value,10))&&parseFloat(theText.value,10)>maxValue) {
                if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
                alert(alias+"值必须小于等于"+maxValue+"！");
                errFld = theText;

                flag = false;
                break;
              }
            }
          }

        } else if('email'==tmp) {
          if(!javaValidEmail(vlu)) {
            if(typeof(theText.alias)!='undefined')alias=theText.alias+":";
            alert(alias+'请输入一个合法的Email！');
            errFld = theText;

            flag = false;
            break;
          }
        } else if("idcard"==tmp) {
          if(!javaValidIDCard(vlu)){
            //alert('请输入一个合法的身份证号！');
            errFld = theText;

            flag = false;
            break;

          }
        } else if("post"==tmp) {
          if(!javaValidPost(vlu)){
            //alert('请输入一个合法的邮政编码！');
            errFld = theText;

            flag = false;
            break;

          }
        } else if("char8date"==tmp) {
          if(vlu.length != 0 && validChar8date(vlu) == vlu){
            errFld = theText;

            flag = false;
            break;
          }
        }
      }
    }
    i=100;
  }
  if (!flag) {
     myFocus(theText);
     theText.style.backgroundColor = "red";
     return false;
  } else {
    theText.style.backgroundColor = "";
     return true;
  }
}
function chkValid(fm){
  //var tmp;
    var vlu = "";
    var errFld = null;
    var errType=0;
    var checkStr="";
    var alias="";
    var minValue,maxValue;
    with(fm){
      for(var i=0; i<all.length; i++){
        var tmp = all[i].type
        if( tmp=='text' || tmp=='select-one' || tmp=='textarea'||tmp=='password'||tmp=='hidden'||tmp=='file') {
          all[i].value=javaTrim(all[i].value);
          vlu = all[i].value;
          //检查是否不能为空,缺省为可空
          tmp = all[i].isNull;
          if(tmp) {
            if(tmp=="false" && vlu=='') {
              if(typeof(all[i].alias)!='undefined')alias=all[i].alias+":";
              alert(alias+'请输入数据！');
              errFld = all[i];
              break;
            } else {
              if(javaTrim(vlu)=='') continue;
            }
          } else {
			if(javaTrim(vlu)=='') continue;
		  }
          tmp=all[i].type;
          maxLen=all[i].maxLength;//检查最大长度
          if(maxLen && javaValidNumber(maxLen+"")) {
            if(vlu.length>parseInt(maxLen+"")) {
              if(all[i].alias)alias=all[i].alias+":";
              alert(alias+"长度错误,最大长度不能超过"+maxLen+"个字符！");
              errFld=all[i];
              break;
            }
          }
          minLen=all[i].minLength;//检查最小长度
          if(minLen && javaValidNumber(minLen+"")) {
            if(vlu.length<parseInt(minLen+"")) {
              if(all[i].alias)alias=all[i].alias+":";
              alert(alias+"长度错误,长度不能少于"+minLen+"个字符！");
              errFld=all[i];
              break;
            }
          }
          if(!checkDenyChar(all[i])) {//检查不允许输入字符
            checkStr=getCheckStr(all[i],"dc")
                     if(all[i].alias) alias=all[i].alias+":";
                     alert(alias+"不能包含（    "+checkStr+"    ）字符！");
                     errType=2;
                     errFld = all[i];
                     break;
          }
          //检查只允许输入字符
          if(!checkAgreeChar(all[i])) {
            checkStr=getCheckStr(all[i],"ac");
            if(all[i].alias) alias=all[i].alias+":";
            alert(alias+"只能包含（    "+checkStr+"    ）字符！");
            errType=3;
            errFld = all[i];
            break;
          }
          //检查只允许输入词组,词组之间用逗号","相隔
          if(!checkAgreeChar2(all[i])) {
            checkStr=getCheckStr(all[i],"ac2");
            if(all[i].alias) alias=all[i].alias+":";
            alert(alias+"只能包含（    "+checkStr+"    ）中逗号中的词组！");
            errType=3;
            errFld = all[i];
            break;
          }
          //处理引号循环
          /*if( tmp=='text'|| tmp=='textarea'||tmp=='password'||tmp=='hidden')
          {
          all[i].value=all[i].value.replace(/\'/g,"\'\'");
          }
          */
          //检查数据类型
          tmp = all[i].dataType
          if(tmp) {
            tmp=tmp.toLowerCase();
            if('date'==tmp||'datetime'==tmp) {
              if(!javaValidDate(vlu)) {
                if(typeof(all[i].alias)!='undefined')alias=all[i].alias+":";
                alert(alias+'请输入一个合法的日期！');
                errFld = all[i];
                break;
              }
            }
            else if('int'==tmp||'money'==tmp||'numeric'==tmp||'decimal'==tmp||'double'==tmp||'float'==tmp||'real'==tmp) {
              if(!javaValidNumber(vlu)) {
                if(all[i].alias) alias=all[i].alias+":";
                alert(alias+'请输入一个合法的数字！');
                errFld = all[i];
                break;
              }
              if('int'==tmp) {
                if(vlu.indexOf(".")!=-1) {
                  if(all[i].alias) alias=all[i].alias+":";
                  alert(alias+'不能有小数点，请输入一个合法的整数！');
                  errFld = all[i];
                  break;
                }
              }
              minValue=all[i].minValue;
              if(minValue) {
                minValue=parseFloat(minValue,10);
                if(isNaN(minValue)) {
                  if(all[i].alias) alias=all[i].alias+":";
                  alert(alias+"最小值无效！");
				  errFld = all[i];
                  break;
                } else {
                  if(!isNaN(parseFloat(all[i].value,10))&&parseFloat(all[i].value,10)<minValue) {
                    if(all[i].alias) alias=all[i].alias+":";
                    alert(alias+"值必须大于等于"+minValue+"！");
                    errFld = all[i];
                    break;
                  }
                }
              }
              maxValue=all[i].maxValue;
              if(maxValue) {
                maxValue=parseFloat(maxValue);
                if(isNaN(maxValue)) {
                  if(all[i].alias) alias=all[i].alias+":";
                  alert(alias+"最大值无效！");
				  errFld = all[i];
                  break;
                } else {
                  if(!isNaN(parseFloat(all[i].value,10))&&parseFloat(all[i].value,10)>maxValue) {
                    if(all[i].alias) alias=all[i].alias+":";
                    alert(alias+"值必须小于等于"+maxValue+"！");
                    errFld = all[i];
                    break;
                  }
                }
              }

            } else if('email'==tmp) {
              if(!javaValidEmail(vlu)) {
                if(all[i].alias) alias=all[i].alias+":";
                alert(alias+'请输入一个合法的Email！');
                errFld = all[i];
                break;
              }
            } else if("idcard"==tmp) {
              if(!javaValidIDCard(vlu)){
                //alert('请输入一个合法的身份证号！');
                errFld = all[i];
                break;

              }
            } else if("post"==tmp) {
              if(!javaValidPost(vlu)){
                //alert('请输入一个合法的邮政编码！');
                errFld = all[i];
                break;

              }
            } else if(vlu.length != 0 && "char8date"==tmp) {
              if(validChar8date(vlu) == vlu){
                errFld = all[i];
                break;
              }
            } else if(vlu.length != 0 && "ipaddress"==tmp) {
              if(!javaValidIPAddress(vlu)){
                errFld = all[i];
                break;
              }
            }
          }
        }//for循环
      }//with语句

      if(errFld!=null){
        //如果可设置焦点，则设置焦点，否则返回FIELD对象
        try{
          //errFld.focus();
          //alert(errFld.id);

          if(errFld.style.display!="none"&&errFld.tagName!="HIDDEN") {
            errFld.focus();
            errFld.select();
          }
        }catch(e){
          //return errFld;
          return false;
        }
        return false;
      }
    }
    return true;
  }
function checkDenyChar(obj)
   {
    var str=obj.dc;
    if(typeof(str)=='undefined'||typeof(str)!='string') return true;
    str=str.replace(/&lt;/,"<");
    str=str.replace(/&gt;/,">");
    str=str.replace(/&amp;/,"&");
    str=str.replace(/&quot;/,"\"");
    str=str.replace(/&apos;/,"\'");
    str=str.replace(/"/,"\"");
    str=str.replace(/'/,"\'");

    var strValue=obj.value;
    var i=0,lenTemp=str.length;
    for(i=0;i<lenTemp;i++)
        {
         if(strValue.indexOf(str.charAt(i))!=-1)
            {
             return false;
            }
        }
    return true;
   }

function checkAgreeChar(obj)
   {
    var str=obj.ac
    if(!str) return true;
    str=str.replace(/&lt;/,"<");
    str=str.replace(/&gt;/,">");
    str=str.replace(/&amp;/,"&");
    str=str.replace(/&quot;/,"\"");
    str=str.replace(/&apos;/,"\'");
    str=str.replace(/"/,"\"");
    str=str.replace(/'/,"\'");

    var strValue=obj.value;
    if (strValue.length == 0) {
      return true;
    }
    var i=0;
    var lenTemp=strValue.length;
    for(i=0;i<lenTemp;i++)
        {
         if(str.indexOf(strValue.charAt(i))==-1)
            {
             return false;
            }
        }
    return true;
   }
function checkAgreeChar2(obj)
   {
    var str=obj.ac2;
    if(!str) return true;
    str=str.replace(/&lt;/,"<");
    str=str.replace(/&gt;/,">");
    str=str.replace(/&amp;/,"&");
    str=str.replace(/&quot;/,"\"");
    str=str.replace(/&apos;/,"\'");
    str=str.replace(/"/,"\"");
    str=str.replace(/'/,"\'");
    str=","+str+",";
    var strValue=obj.value;
    if (strValue.length == 0) {
      return true;
    }
    strValue=","+strValue+",";
    if (str.indexOf(strValue) == -1)
    {
      return false;
    }
    return true;
}
function getCheckStr(obj,flag)
   {
    if(flag.toLowerCase()=="ac")
       var str=obj.ac;
    else if(flag.toLowerCase()=="ac2")
       var str=obj.ac2;
        else if(flag.toLowerCase()=="dc")
       var str=obj.dc;
    if(typeof(str)=='undefined'||typeof(str)!='string') return "";
    str=str.replace(/&lt;/,"<");
    str=str.replace(/&gt;/,">");
    str=str.replace(/&amp;/,"&");
    str=str.replace(/&quot;/,"\"");
    str=str.replace(/&apos;/,"\'");
    str=str.replace(/"/,"\"");
    str=str.replace(/'/,"\'");
    return str;
   }
function GetFormFields(fm){
        var tmp
        var xmlstr = ""

        with(fm){
                for(var i=0; i<elements.length; i++){
                        tmp = elements[i].type
                        if(tmp=='hidden' || tmp=='text' || tmp=='select-one' || tmp=='textarea'){
                                xmlstr = xmlstr + "<" + elements[i].name + ">" + elements[i].value + "</" + elements[i].name + ">"
                        }
                }
                return xmlstr
        }
}

function savebyxmlhttp(acturl, xmlstr){
var xmlobj	= new ActiveXObject("Microsoft.XMLDOM.1.0")
var httpobj = new ActiveXObject("Microsoft.XMLHTTP.1")
var eList, E, Msg
        xmlobj.async=false;
        xmlobj.loadXML(xmlstr);

        httpobj.open("POST", acturl, false);
        httpobj.send(xmlobj);
        var a1 = httpobj.responseText.indexOf("<?xml");
        var a2 = httpobj.responseText.length
        if(!xmlobj.loadXML(httpobj.responseText.substring(a1,a2))){
                alert(httpobj.responseText)
                return 1;
        }
        E	= xmlobj.selectSingleNode("result/err").text ;
        Msg = xmlobj.selectSingleNode("result/msg").text ;
        Msg = unescape(Msg);
        xmlobj = null;
        httpobj= null;
        if(Msg!="") alert(Msg);
        return E;
}

function SetDisabled(fm, flag){
        for(var i=0; i<fm.elements.length; i++){
                if(typeof(fm.elements[i].disabled)=='boolean') fm.elements[i].disabled = flag;
        }
}

function resetForm(fm){
        var tmp='';
        with(fm){
                for(var i=0; i<fm.elements.length; i++){
                        obj = fm.elements[i]
                        if(typeof(obj.value)=='string'){
                                tmp = obj.type;
                                tmp = tmp.toLowerCase();
                                var ro=obj.readOnly;
                                if(typeof(ro)!="undefined")
                                   {
                                    var roFlag=ro;
                                   }
                                else
                                   {
                                    var roFlag=flase;
                                   }
                                if(!roFlag&&tmp!='button' && tmp!='submit' && tmp!='reset' && tmp!='image' &&tmp!="hidden"&&obj.style.display!="none") obj.value = '';
                        }
                        else
                                obj.innerText = '';
                }
        }
}

function openSaveWindow(theFormAction,theForm,windowName)
{
          window.open("",windowName,"toolbar=no,location=no,menubar=no,resizable=yes,status=no,width=400,height=400,left=2000,top=2000");
          theForm.action=theFormAction;
          theForm.target=windowName;
           // theForm.target="_blank";
          theForm.submit();
}




function myPrint(theForm,printFile,title,rows,tableWidth)
{
if(typeof(theForm)=="undefined"||theForm==null) {alert("现在不能打印！");return false;}
if(typeof(printFile)=="undefined") {printFile="printTable.asp";}
if(typeof(title)=="undefined") {title=" ";}
if(typeof(rows)=="undefined") {rows=10000;}
if(typeof(tableWidth)=="undefined") {tableWidth=0;}
var theWindow=window.open(printFile+"?printForm="+theForm.id+"&title="+title+"&rows="+rows+"&tableWidth="+tableWidth,theForm.id,"left=1,top=1,width="+(screen.availWidth-10)+"px,height="+(screen.availHeight-30)+"px,statusbar=no,resizable=no,menubar=no,scrollbars=yes");
theWindow.focus();
}

//filterChar函数适用于onkeypress事件，用于过滤特定字符
function filterChar(strFilter,flagFilter)
{
charCode=event.keyCode;
var theChar=String.fromCharCode(charCode);
//flagFilter缺省为true,代表包含关系
if(typeof(flagFilter)=="undefined"||typeof(flagFilter)!="boolean") flagFilter=true;
var str=""
if(strFilter.indexOf("/z")!=-1||strFilter.indexOf("/Z")!=-1)           //允许字母
   {
   if(str!="")
    str=str+"||(theChar<='z'&&theChar>='a')||(theChar<='Z'&&theChar>='A')"
   else str="(theChar<='z'&&theChar>='a')||(theChar<='Z'&&theChar>='A')"
   }
if(strFilter.indexOf("/l")!=-1||strFilter.indexOf("/L")!=-1)           //允许小写字母
   {
    if(str!="")
    str=str+"||(theChar<='z'&&theChar>='a')"
    else str=str+"(theChar<='z'&&theChar>='a')"
   }
if(strFilter.indexOf("/u")!=-1||strFilter.indexOf("/U")!=-1)           //允许大写字母
   {
   if(str!="")
    str=str+"||(theChar<='Z'&&theChar>='A')"
    else str=str+"(theChar<='Z'&&theChar>='A')"
   }
if(strFilter.indexOf("/n")!=-1||strFilter.indexOf("/N")!=-1)           //允许数字
   {
   if(str!="")
       str=str+"||(theChar<='9'&&theChar>='0')"
   else str=str+"(theChar<='9'&&theChar>='0')"
   }
var reg=/[nzul]/i;
strFilter=strFilter.replace(reg,"");
if(str!="")str=str+"||strFilter.indexOf(theChar)!=-1";
else str="strFilter.indexOf(theChar)!=-1";

if(flagFilter)
{
     if(str=="") str="charCode==8||charCode==13||charCode==38||charCode==39||charCode==40||charCode==37||charCode==46||charCode==45||charCode==35||charCode==36||charCode==9"
     else str=str+"||charCode==8||charCode==13||charCode==38||charCode==39||charCode==40||charCode==37||charCode==46||charCode==45||charCode==35||charCode==36||charCode==9"
     if(eval(str))return true;
}
else
{
if(str!="")
  {
  if(!eval(str)||charCode==8||charCode==13||charCode==38||charCode==39||charCode==40||charCode==37||charCode==46||charCode==45||charCode==35||charCode==36||charCode==9) return true;
  }
else
 {
  if(charCode==8||charCode==13||charCode==38||charCode==39||charCode==40||charCode==37||charCode==46||charCode==45||charCode==35||charCode==36||charCode==9)return true;
  }
}
event.returnValue=false;
event.cancelBubble=true;
}


function myPrompt(str,closeFlag)
{
try
   {
    opener.alert(str);
    if(typeof(closeFlag)=='undefined'||typeof(closeFlag)!='boolean'||!closeFlag){}
    else opener.close();
   }
catch(ee)
   {
    alert(str);
   }
top.close();
}


function restoreForm(theForm)
{
 var activeObj=document.activeElement;
 var elements=theForm.all;
 var lenTemp=elements.length;
 var i;
 var tmp;
 for (i=0;i<lenTemp;i++)
    {
     tmp=elements[i].type;
     if(tmp=='text'|| tmp=='textarea'||tmp=='password'||tmp=='hidden')
        {
         elements[i].value=elements[i].value.replace(/\'\'/g,"\'");
        }
    }
 if(activeObj!=null&&activeObj.type.toLowerCase()!="button"&&activeObj.type.toLowerCase()!="submit"&&activeObj.type.toLowerCase()!="reset"){myFocus(activeObj);}

}
function myPrint2(fileName,windowName)
{
var w="";
if(typeof(fileName)=='undefined'){alert("现在不能打印！");return false;}
if(typeof(windowName)=='undefined'){w=fileName.substring(0,fileName.indexOf("."));}
else w=windowName;
var theWindow=window.open(fileName,w,"left=1px,top=1px,width="+(screen.availWidth-5)+"px,height="+(screen.availHeight-30)+"px,location=no,menubar=no,statusbar=no,resizable=no,toolbar=no");
theWindow.focus();
}

function dateDiff(strDate1,strDate2)
{
 if(!javaValidDate(strDate1)){alert("第一参数日期格式不正确，格式应为：年-月-日或年/月/日！");return false;}
 if(!javaValidDate(strDate2)){alert("第二参数日期格式不正确，格式应为：年-月-日或年/月/日！");return false;}
 var  theChar,i1,i2;
 var str;
 if(strDate1.indexOf("/")!=-1)theChar="/";
 else if(strDate1.indexOf("-")!=-1)theChar="-";
 var myArray1=strDate1.split(theChar);
 var myArray2=strDate2.split(theChar);
 for (var i=0;i<myArray1.length;i++)
    {
     str=myArray1[i]+"";
     i1=parseInt(str,10);
     str=myArray2[i]+"";
     i2=parseInt(str,10);
     if(i1>i2) return 1;
     else if(i1<i2) return -1;
    }
 return 0;
}
function getSubmitFields(fm)
{
        var tmp,define;
        var vlu = "";
        var isSubmit="false";
        var returnStr="";
        var jdbcValueType=",array,bigint,binary,bit,blob,char,clob,date,decimal,distinct,double,float,integer,java_object,longvarbinary,longvarchar,null,numeric,other,real,ref,smallint,struct,time,timestamp,tinyint,varbinary,varchar,money,smallmoney,datetime,smalldatetime,nvarchar,ntext,nchar,int,text";
        with(fm){
                for(var i=0; i<all.length; i++)
                  {
                        tmp = all[i].type;
                        where="";
                        var isSubmit=all[i].isSubmit;
                        if(!isSubmit)isSubmit="false";
                        if(isSubmit!="true")isSubmit="false";
                        define=all[i].define;
                        if(typeof(define)!="undefined")
                          {
                                if(define!="true")define="false";
                          }
                        else define="false";
                        isSubmit=isSubmit.toLowerCase();
                        where=all[i].where;
                        subwhere=all[i].subwhere
                        if( (tmp=='checkbox'||tmp=='text' || tmp=='select-one' || tmp=='textarea'||tmp=='password'||tmp=='hidden'||tmp=='checkbox'||tmp=='radio')&&(isSubmit=="true"||where||subwhere))
                        {
                                vlu = javaTrim(all[i].value)
                fieldName=all[i].name;
                                //检查数据类型
                                tmp = all[i].dataType;

                                if(tmp)
                                  {
                                        tmp=tmp.toLowerCase();

                                        if(isSubmit=="true")
                                          {
                                                if(define=="true")returnStr=returnStr+";"+fieldName+",define";
                                                else
                                                  {
                                                    if(jdbcValueType.indexOf(","+tmp+",")!=-1){returnStr=returnStr+";"+fieldName+","+tmp;}
                                                        else  returnStr=returnStr+";"+fieldName+",text";
                                                        //if(tmp=="numeric")returnStr=returnStr+";"+fieldName+",numeric";
                                                        //else  returnStr=returnStr+";"+fieldName+",text";

                                                  }
                                          }
                                        if(typeof(where)!="undefined"&&where.toLowerCase()=="true")
                                          {
                                                if(define=="true")returnStr=returnStr+";"+fieldName+",wheredefine";
                                                else
                                                  {
                                                        if(jdbcValueType.indexOf(","+tmp+",")!=-1){returnStr=returnStr+";"+fieldName+",where"+tmp;}
                                                        else returnStr=returnStr+";"+fieldName+",wheretext";
                                                        //if(tmp=="numeric")returnStr=returnStr+";"+fieldName+",wherenumeric";
                                                        //else returnStr=returnStr+";"+fieldName+",wheretext";
                                                  }
                                          }
                                        if(typeof(subwhere)!="undefined"&&subwhere=="true")
                                          {
                                                if(define=="true")returnStr=returnStr+";"+fieldName+",subwheredefine";
                                                else
                                                  {
                                                        if(jdbcValueType.indexOf(","+tmp+",")!=-1)returnStr=returnStr+";"+fieldName+",subwhere"+tmp;
                                                        else returnStr=returnStr+";"+fieldName+",subwheretext";
                                                //if(tmp=="numeric")returnStr=returnStr+";"+fieldName+",subwherenumeric";
                                                    //else returnStr=returnStr+";"+fieldName+",subwheretext";
                                                  }
                                          }

                                  }
                else
                                  {
                       myFocus(all[i]);
                                           alert(all[i].alias+"：请输入数据类型");
                                           returnStr=";error";
                                           break;
                                  }


                        }
        }//for(var i=0; i<all.length; i++)
    }//with
    if(returnStr!="")
                {
          returnStr=returnStr.substring(1,returnStr.length);
            }
        return returnStr;
}

function getUniqueStr(fm)
{
        var tmp;
        var vlu = "";
        var returnStr=null;
        var jdbcValueType=",array,bigint,binary,bit,blob,char,clob,date,decimal,distinct,double,float,integer,java_object,longvarbinary,longvarchar,null,numeric,other,real,ref,smallint,struct,time,timestamp,tinyint,varbinary,varchar,money,smallmoney,datetime,smalldatetime,nvarchar,ntext,nchar,int,text";
        with(fm){
                for(var i=0; i<all.length; i++)
                  {
                        tmp = all[i].type;
                        if(tmp=='text' || tmp=='select-one' || tmp=='hidden')
                        {
                                vlu = javaTrim(all[i].value)
                fieldName=all[i].name;
                                tmp = all[i].dataType;
                isUnique=all[i].isUnique;
                                if(isUnique&&isUnique=="true")
                                  {
                                        tmp=tmp.toLowerCase();
                                        tempStr=all[i].name+"$"+tmp;
                                        link=all[i].link;
                                        if(!tmp)
                                          {
                                                myFocus(all[i]);
                                                alert(all[i].alias+"：请输入数据类型");
                                                returnSTr=null;
                                                break;

                                          }
                                        if(link)
                                          {
                                                relation=all[i].relation;
                                                if(!relation)
                                                  {
                                                        myFocus(all[i]);
                                                        alert(all[i].alias+"：请输入唯一检查关系！！！");
                                                        returnStr=null;
                                                        break;
                                                  }
                                                 if(link.indexOf("?")!=-1)
                                                  {
                                                         link1=link.indexOf("?");
                                                         link2=link.indexOf(link1+1,"?");
                                                         field1=link.substring(0,link1);
                                                         field1DT=all(field1).dataType;
                                                         field2=link.substring(link1+1);
                                                         field2DT=all(field2).dataType;
                                                         alert(field2DT);
                                                         field3=null;
                                                         if(link2!=-1)
                                                          {
                                                                 field3=link.substring(link2+1);
                                                                 field3DT=all(field3).dataType;
                                                          }
                                                  }
                                                 else
                                                  {
                                                          field1=link;
                                                          field1DT=all(field1).dataType;
                                                          field2=field3=null;

                                                  }
                                                tempStr=tempStr+","+relation+","+field1+"$"+field1DT;
                                                if(field2!=null)tempStr=tempStr+"?"+field2+"$"+field2DT;
                                                if(field3!=null)tempStr=tempStr+"?"+field3+"$"+field3DT;

                                          }
                                         if(returnStr==null) returnStr=tempStr;
                                         else returnStr=returnStr+";"+tempStr;
                                  }
                        }
        }//for(var i=0; i<all.length; i++)
    }//with
        return returnStr;
}
    function validChar8date(str8) {
          flag = true;
      if (str8 == null) {
                alert("日期格式不正确,请输入日期");
                return str8;
          }
      if (str8.length != 8) {
                alert("日期长度不正确，正确长度为8个数字字符");
                return str8;
          }
          if (!javaValidNumber(str8))
          {
                alert("日期格式不正确,日期包含非数字字符");
                return str8;
          }
          str = str8.substring(0,4);
          year = parseInt(str);
      if (year>2050 || year<1950) {
                alert("日期格式不正确,年度错误，范围为：1950~2050");
                return str8;
      }
      str = str8.substring(4,6);
          month = parseInt(str);
      if (month>12 || month<1) {
                alert("日期格式不正确,月份错误");
                return str8;
      }
      str = str8.substring(6,8);
          day = parseInt(str);
      if (day>31 || day<1) {
                alert("日期格式不正确,日期错误");
                return str8;
      } else {
                if (month == 4 || month == 6 || month == 9 || month == 11) {
                        if (day>30) {
                          alert("日期格式不正确,日期错误");
                          return str8;
                        }
                } else if (month == 2) {
                    if (year%4 == 0) {
                                if (day>29) {
                              alert("日期格式不正确,日期错误");
                                  return str8;
                                }
                    } else {
                                if (day > 28) {
                    alert("日期格式不正确,日期错误");
                                        return str8;
                                }
                        }
                }
          }
      returnStr = str8.substring(0,4) + "-" + str8.substring(4,6) + "-" + str8.substring(6,8);
          return returnStr;
    }
