//18.小写数字转大写 sLowText:小写栏位   sUpText:大写栏位
function wxf_upcaseamount(sLowText,sUpText)
{
  var sUpcase1= new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖")
  var sUpcase2= new Array("亿","仟","佰","拾","万","仟","佰","拾","元")
  var sNumber
  var sZero = "00"
  var sSign

  fvalue=parseFloat(sLowText.value)
   
  if (isNaN(fvalue))
  {
    alert("金额不正确！")
    sLowText.focus()
    sLowText.select()
    return false
  }
   
  fvalue=Math.round(fvalue*100+0.01)/100
  
  if (fvalue<0)
  {
    sSign='1'
    sUpText.style.color="#FF0000"
  }
  else
  {
    sSign='0'
    sUpText.style.color="#000000"
  }   

  fvalue=Math.abs(fvalue)
   
  if (sSign=='1')
  {
    sLowText.value="-"+fvalue
  }
  else
  {
    sLowText.value=""+fvalue
  }
      
  svalue=""+fvalue

  ipos=svalue.indexOf(".")
  if (ipos<=0)
  {
    svalue1=svalue
    svalue2="00"
  }
  else
  {
    svalue1=svalue.substring(0,ipos)
    svalue2=svalue.substring(ipos+1,svalue.length)
  }
  
  svalue2 = svalue2+sZero.substring(0,2-svalue2.length)
  sNumber="￥"
  for(i=0;i<svalue1.length;i++)
  {
    sNumber = sNumber + sUpcase1[parseInt(svalue1.substring(i,i+1))] + sUpcase2[9-svalue1.length+i] 
  }

  sUpText.value = sNumber + sUpcase1[parseInt(svalue2.substring(0,1))]+"角"+ sUpcase1[parseInt(svalue2.substring(1,2))]+"分"
}

//13.调用日历
function wxf_calendar(current,execfun)
{
  var transcal
  var cdvalue
  try{ cdvalue=current.parentElement.children(0).innerText } catch(e){}
  try{ cdvalue=eval("window.document.all."+current).value } catch(e){}
  transcal=window.showModalDialog("../lib/calendar.aspx?cdvalue=" + cdvalue ,cdvalue,"dialogheight:15.8em;dialogwidth:17.5em;status:no")
  if (transcal!=null)
  {
   try{   current.parentElement.children(0).innerText=transcal   }catch(e){}
   try{   eval("window.document.all."+current).value=transcal
          eval("window.document.all."+current).focus()
   }catch(e){}
   try{eval("window." + execfun) }catch(e){}   //执行后续函数
  }
}

//14.调用计算器
function wxf_calculator(current)
{
  var transval
  var sourcevalue
  sourcevalue=eval("window.document.all."+current).value
  transval=window.showModalDialog("../lib/calculator.aspx",sourcevalue,"dialogheight:15.5em;dialogwidth:15.5em;status:no")
  if (transval!=null)
  {
      eval("window.document.all."+current).value=transval
      eval("window.document.all."+current).focus()
  }
   try{eval("window." + execfun) }catch(e){}
}

//16.调用日历及时间
function wxf_calendartime(current)
{
  var transcaltime
  var cdtimevalue
  cdtimevalue=eval("window.document.all."+current).value
  transcaltime=window.showModalDialog("../lib/calendartime.aspx?cdvalue=" + cdtimevalue,cdtimevalue,"dialogheight:15.8em;dialogwidth:19.2em;status:no")
  if (transcaltime!=null)
  {
      eval("window.document.all."+current).value=transcaltime
      eval("window.document.all."+current).focus()
  }
}

//17.去前后空格
function wxf_trim(thevalue)
{
  var kk
  var ll
  var rrpos
  var iipos
  for (kk=thevalue.length-1;kk>=0;kk--)
  {
    if (thevalue.charAt(kk)!=" ")
    {
      rrpos=kk
      break
    }
  }
  thevalue=thevalue.substring(0,rrpos+1)
  for (ll=0;ll<thevalue.length-1;ll++)
  {
    if (thevalue.charAt(ll)!=" ")
    {
      iipos=ll
      break
    }
  }
  thevalue=thevalue.substring(iipos,thevalue.length)   
  return thevalue
}

//15.数据保存检查
//数据类型设置，例如input type="text" name="DmoNo" size="40" maxlength="20"  datalength="noempty" datatype="number" dataname="合同编号"
//其中datatype设为number则要求为数值型,datalength设为noempty则要求不得为空，dataname为名称
 function wxf_check()
 {
   var formlen
   var ipos,rpos,iipos,rrpos
   if (window.document.forms.length=="0")
   {
       alert("无表格数据！")
       return false
   }
   formlen=window.document.forms(0).all.length
   for (i=0;i<formlen;i++)
   {


   //下拉列表框检查
      if (window.document.forms(0).all(i).tagName=="SELECT")
      {
         if (window.document.forms(0).all(i).type=="select-one")
         {
            if (window.document.forms(0).all(i).datalength=="noempty")
            {
               var thevalue=wxf_trim(window.document.forms(0).all(i).value)
                if (thevalue=="" || thevalue==null)
                {
                   alert(window.document.forms(0).all(i).dataname+"请勿为空！")
                   //window.document.forms(0).all(i).focus()
                   return false
                }
            }
         }
      }
      //文本编辑框检查
      if (window.document.forms(0).all(i).tagName=="TEXTAREA")
      {
          //转化单引号
		while(window.document.forms(0).all(i).value.indexOf("'")>-1){
			window.document.forms(0).all(i).value=window.document.forms(0).all(i).value.replace("'","‘")
		}
         if (window.document.forms(0).all(i).datalength=="noempty")
         {
           var thevalue=wxf_trim(window.document.forms(0).all(i).value)
           if (thevalue=="" || thevalue==null)
           {
             alert(window.document.forms(0).all(i).dataname+"请勿为空！")
             //window.document.forms(0).all(i).focus()
             return false
           }
         }
      }
      
      //text检查
      if (window.document.forms(0).all(i).tagName=="INPUT")
       {
		
        if(window.document.forms(0).all(i).type=="text"||window.document.forms(0).all(i).type=="password")
        {
            //转化单引号
			while(window.document.forms(0).all(i).value.indexOf("'")>-1){
				window.document.forms(0).all(i).value=window.document.forms(0).all(i).value.replace("'","‘")
			}
            //数值型数据的合法性检查
             if (window.document.forms(0).all(i).datatype=="number")
             {  //2004.3.3增加，排除在输入数据出现，号时保存时提示非数值型
								if(window.document.forms(0).all(i).style.behavior.indexOf("WxNumberInput.htc")>0)
								{
									if (isNaN(window.document.forms(0).all(i).getvalue()))
									{
											alert(window.document.forms(0).all(i).dataname+"非数值！")
											try
											{
												window.document.forms(0).all(i).focus()
												window.document.forms(0).all(i).select()
											}catch(e){}
											return false
									}
                }
                else
                {
									if (isNaN(window.document.forms(0).all(i).value))
									{
											alert(window.document.forms(0).all(i).dataname+"非数值！")
											try
											{
												window.document.forms(0).all(i).focus()
												window.document.forms(0).all(i).select()
											}catch(e){}
											return false
									}
                }
             }

             //数值范围的合法性检查,nozero为大于零的正数
             if (window.document.forms(0).all(i).datarange=="nozero")
             {
                if (parseFloat(window.document.forms(0).all(i).value) < 1)
                {
                     alert(window.document.forms(0).all(i).dataname+"为非零的正数！")
											try
											{
												window.document.forms(0).all(i).focus()
												window.document.forms(0).all(i).select()
											}catch(e){}
                     return false
                }
             }

             //数值范围的合法性检查,nominus为非负数
             if (window.document.forms(0).all(i).datarange=="nominus")
             {
                if (parseFloat(window.document.forms(0).all(i).value) < 0)
                {
                  alert(window.document.forms(0).all(i).dataname+"不能为负数！")
									try
									{
										window.document.forms(0).all(i).focus()
										window.document.forms(0).all(i).select()
									}catch(e){}
                  return false
                }
             }
             
             //指定数据不允许为空的合法性检查
             if (window.document.forms(0).all(i).datalength=="noempty")
             {
                   var tervalue=window.document.forms(0).all(i).value
                   obvalue=wxf_trim(tervalue)
                 if (obvalue=="" || obvalue==null)
                 {
                     alert(window.document.forms(0).all(i).dataname+"请勿为空！")
											try
											{
												window.document.forms(0).all(i).focus()
												window.document.forms(0).all(i).select()
											}catch(e){}
                     return false
                 }
             }
           //--日期检查开始--
           //固定日期格式数据的合法性检查，格式为yyyy-mm-dd(年-月-日)
           if (window.document.forms(0).all(i).datatype=="date")
           {
              var thevalue
              thevalue=wxf_trim(window.document.forms(0).all(i).value)
              if (thevalue!="")
              {
                //查询日期格式中"-"的数量
                var signamount
                signamount=0
                var dotsign
                dotsign=0
                var thevaluesplit
                thevaluesplit=thevalue.split("-")
                if (thevaluesplit.length!=3)
                {
                   alert(window.document.forms(0).all(i).dataname+"非日期型数值！")
										try
										{
											window.document.forms(0).all(i).focus()
											window.document.forms(0).all(i).select()
										}catch(e){}
                   return false
                }
                for (ll=0;ll<3;ll++)
                {
                  var thesplitswap
                  thesplitswap=thevaluesplit[ll]
                  for (l=thesplitswap.length-1;l>=0;l--)
                  {
                      if (thesplitswap.charAt(l)!=" ")
                      {
                          rpos=l
                          break  
                      }
                  }
                  thesplitswap=thesplitswap.substring(0,rpos+1)
                  for (m=0;m<thesplitswap.length;m++)
                  {
                      if (thesplitswap.charAt(m)!=" ")
                      {
                         ipos=m
                         break
                      }
                  }
                  thesplitswap=thesplitswap.substring(ipos,thesplitswap.length)                   
                  if (thesplitswap=="" || isNaN(thesplitswap))
                  {
                     alert(window.document.forms(0).all(i).dataname+"非日期型数值！")
											try
											{
												window.document.forms(0).all(i).focus()
												window.document.forms(0).all(i).select()
											}catch(e){}
                     return false
                  }
                }
                
                for (kk=0;kk<thevalue.length;kk++)
                {
                    if (thevalue.charAt(kk)=="+" || thevalue.charAt(kk)==".")
                    {
                       dotsign++
                    }
                }
                if (dotsign>0)
                {
                   alert(window.document.forms(0).all(i).dataname+"非日期型数值！")
										try
										{
											window.document.forms(0).all(i).focus()
											window.document.forms(0).all(i).select()
										}catch(e){}
                   return false
                }
                var firstsign
                var lastsign
                firstsign=thevalue.indexOf("-")
                lastsign =thevalue.lastIndexOf("-")
                var theyear=""
                var themonth=""
                var theday=""
                var errsign=""
                var maxday
                theyear =parseFloat(thevalue.substring(0,firstsign))
                themonth=parseFloat(thevalue.substring(firstsign+1,lastsign))
                theday  =parseFloat(thevalue.substring(lastsign+1,thevalue.length))
                if (theyear<1900)
                {
                   alert(window.document.forms(0).all(i).dataname+"超出系统范围！")
										try
										{
											window.document.forms(0).all(i).focus()
											window.document.forms(0).all(i).select()
										}catch(e){}
                   return false
                }
                //根据月求最大日值
                if (themonth=="1" || themonth=="3" || themonth=="5" || themonth=="7" || themonth=="8" || themonth=="10" || themonth=="12")
                {
                    maxday=31
                }
                else
                {
                    if (themonth=="4" || themonth=="6" || themonth=="9" || themonth=="11")
                    {
                        maxday=30
                    }
                    else
                    {
                      if (themonth=="2")
                      {
                          if (theyear%4==0)
                          {
                              maxday=29
                          }
                          else
                          {
                             maxday=28
                          }
                      }
                      else
                      {
                         errsign="error"
                      }
                  }
                }
                if (errsign=="error")
                {
                   alert(window.document.forms(0).all(i).dataname+"非日期型数值！")
										try
										{
											window.document.forms(0).all(i).focus()
											window.document.forms(0).all(i).select()
										}catch(e){}
                   return false
                }
                if (theday<1 || theday>maxday)
                {
                   alert(window.document.forms(0).all(i).dataname+"非日期型数值！")
										try
										{
											window.document.forms(0).all(i).focus()
											window.document.forms(0).all(i).select()
										}catch(e){}
                   return false
                } 
             }
           }
           //--日期检查结束--
         }
      }
   
   }
   return true
 }


//16.数据保存检查(检查某个区域)
//数据类型设置，例如input type="text" name="DmoNo" size="40" maxlength="20"  datalength="noempty" datatype="number" dataname="合同编号"
//其中datatype设为number则要求为数值型,datalength设为noempty则要求不得为空，dataname为名称
 function wxf_checkpart(obj)
 {
   var formlen
   var ipos,rpos,iipos,rrpos

   ilen=obj.all.length

   for (i=0;i<ilen;i++)
   {
   //下拉列表框检查
     if (obj.all(i).tagName=="SELECT")
     {
       if(obj.all(i).datalength=="noempty")
       {
         if (obj.all(i).value=="")
         {
          alert(window.document.forms(0).all(i).dataname+"请勿为空！")
          try
          {
						window.document.forms(0).all(i).focus()
          }catch(e){}
          return false
         }
       }
     }
     
     //text检查
      if (obj.all(i).tagName=="INPUT")
      {
        if (obj.all(i).type=="text")
        {
            //转化单引号
			while(obj.all(i).value.indexOf("'")>-1){
				obj.all(i).value=obj.all(i).value.replace("'","‘")
			}
          //数值型数据的合法性检查
          if (obj.all(i).datatype=="number")
          {
						if(obj.all(i).style.behavior.indexOf("WxNumberInput.htc")>0)
						{
							if (isNaN(obj.all(i).getvalue()))
							{
									alert(obj.all(i).dataname+"非数值！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
									return false
							}
            }
            else
            {
							if (isNaN(obj.all(i).value))
							{
									alert(obj.all(i).dataname+"非数值！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
									return false
							}
            }
          }

          //数值范围的合法性检查,nozero为大于零的正数
          if (obj.all(i).datarange=="nozero")
          {
            if (parseFloat(obj.all(i).value) < 1)
            {
              alert(obj.all(i).dataname+"为非零的正数！")
							try
							{
								obj.all(i).focus()
								obj.all(i).select()
							}catch(e){}
              return false
            }
          }

          //指定数据不允许为空的合法性检查
          if (obj.all(i).datalength=="noempty")
          {
            var obvalue=wxf_trim(obj.all(i).value)
            if (obvalue=="" || obvalue==null)
            {
              alert(obj.all(i).dataname+"请勿为空！")
							try
							{
								obj.all(i).focus()
								obj.all(i).select()
							}catch(e){}
              return false
            }
          }
          
           //--日期检查开始--
           //固定日期格式数据的合法性检查，格式为yyyy-mm-dd(年-月-日)
           if (obj.all(i).datatype=="date")
           {
              var thevalue
              thevalue=wxf_trim(obj.all(i).value)
              if (thevalue!="" || thevalue==null)
              {
                //查询日期格式中"-"的数量
                var signamount
                signamount=0
                var dotsign
                dotsign=0
                var thevaluesplit
                thevaluesplit=thevalue.split("-")
                if (thevaluesplit.length!=3)
                {
                  alert(obj.all(i).dataname+"非日期型数值！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
                  return false
                }
                for (ll=0;ll<3;ll++)
                {
                  var thesplitswap
                  thesplitswap=thevaluesplit[ll]
                  for (l=thesplitswap.length-1;l>=0;l--)
                  {
                      if (thesplitswap.charAt(l)!=" ")
                      {
                          rpos=l
                          break  
                      }
                  }
                  thesplitswap=thesplitswap.substring(0,rpos+1)
                  for (m=0;m<thesplitswap.length;m++)
                  {
                      if (thesplitswap.charAt(m)!=" ")
                      {
                         ipos=m
                         break
                      }
                  }
                  thesplitswap=thesplitswap.substring(ipos,thesplitswap.length)                   
                  if (thesplitswap=="" || isNaN(thesplitswap))
                  {
                    alert(obj.all(i).dataname+"非日期型数值！")
										try
										{
											obj.all(i).focus()
											obj.all(i).select()
										}catch(e){}
                    return false
                  }
                }
                
                for (kk=0;kk<thevalue.length;kk++)
                {
                    if (thevalue.charAt(kk)=="+" || thevalue.charAt(kk)==".")
                    {
                       dotsign++
                    }
                }
                if (dotsign>0)
                {
                  alert(obj.all(i).dataname+"非日期型数值！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
                  return false
                }
                var firstsign
                var lastsign
                firstsign=thevalue.indexOf("-")
                lastsign =thevalue.lastIndexOf("-")
                var theyear=""
                var themonth=""
                var theday=""
                var errsign=""
                var maxday
                theyear =parseFloat(thevalue.substring(0,firstsign))
                themonth=parseFloat(thevalue.substring(firstsign+1,lastsign))
                theday  =parseFloat(thevalue.substring(lastsign+1,thevalue.length))
                if (theyear<1900)
                {
                  alert(obj.all(i).dataname+"超出系统范围！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
                  return false
                }
                //根据月求最大日值
                if (themonth=="1" || themonth=="3" || themonth=="5" || themonth=="7" || themonth=="8" || themonth=="10" || themonth=="12")
                {
                    maxday=31
                }
                else
                {
                    if (themonth=="4" || themonth=="6" || themonth=="9" || themonth=="11")
                    {
                        maxday=30
                    }
                    else
                    {
                      if (themonth=="2")
                      {
                          if (theyear%4==0)
                          {
                              maxday=29
                          }
                          else
                          {
                             maxday=28
                          }
                      }
                      else
                      {
                         errsign="error"
                      }
                  }
                }
                if (errsign=="error")
                {
                  alert(obj.all(i).dataname+"非日期型数值！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
                  return false
                }
                if (theday<1 || theday>maxday)
                {
                  alert(obj.all(i).dataname+"非日期型数值！")
									try
									{
										obj.all(i).focus()
										obj.all(i).select()
									}catch(e){}
                  return false
                } 
             } 
           }
           //--日期检查结束--
         }
      }
   }
   return true
 }

//单个数据检查
//数据类型设置，例如input type="text" name="DmoNo" size="40" maxlength="20"  datalength="noempty" datatype="number" dataname="合同编号" 
//其中datatype设为number则要求为数值型,datalength设为noempty则要求不得为空，dataname为名称 
 function wxf_checkone(which,hidden) 
 { 
   var ipos,rpos,iipos,rrpos 

   //下拉列表框检查
   if (which.tagName=="SELECT")
   {
      if (which.type=="select-one")
      {
         if (which.datalength=="noempty")
         {
            var thevalue=which.value
            for (kk=thevalue.length-1;kk>=0;kk--) 
            { 
                if (thevalue.charAt(kk)!=" ") 
                { 
                   rrpos=kk 
                   break 
                } 
            } 
            thevalue=thevalue.substring(0,rrpos+1) 
            for (ll=0;ll<thevalue.length-1;ll++) 
            {
                if (thevalue.charAt(ll)!=" ")
                {
                   iipos=ll
                   break
                }
             }
             thevalue=thevalue.substring(iipos,thevalue.length)   
             if (thevalue=="")
             {
                alert(which.dataname+"请勿为空！")
                if(hidden!="1") which.focus()
                return false
             }
         }
      }
   }
   //text检查
   if (which.tagName=="INPUT")
   {
             //转化单引号
		while(which.value.indexOf("'")>-1){
			which.value=which.value.replace("'","‘")
		}
      if (which.type=="text"||which.type=="password"||which.type=="hidden")
     {
         //数值型数据的合法性检查
          if (which.datatype=="number")
          {
            // shenyong add 2002-07-23 
            if (which.FldType=="FM")
            {
               if (isNaN(which.getvalue()))
              {
                  alert(which.dataname+"非数值！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
              }
            }
            else
            { 
              if (isNaN(which.value))
              {
                  alert(which.dataname+"非数值！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
              }
            }
          }

          //数值范围的合法性检查,nozero为大于零的正数
          if (which.datarange=="nozero")
          {
             if (parseFloat(which.value) < 1)
             {
                  alert(which.dataname+"为非零的正数！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
             }
          }

          //指定数据不允许为空的合法性检查
          if (which.datalength=="noempty")
          {
                var tervalue=which.value
                var obvalue
                var rvalue
                //去右连续空
               for (k=tervalue.length-1;k>=0;k--) 
               { 
                  if (tervalue.charAt(k)!==" ") 
                  { 
                     rpos=k 
                     break 
                  } 
               } 
               rvalue=tervalue.substring(0,rpos+1) 
              //去左连续空 
              for (j=0;j<rvalue.length;j++) 
              {
                   if (rvalue.charAt(j)!=" ")
                   {
                       ipos=j
                       break         
                   }
              }
              obvalue=rvalue.substring(ipos,rvalue.length)
              if (obvalue=="")
              {
                  alert(which.dataname+"请勿为空！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
              }
          }
        //--日期检查开始--
        //固定日期格式数据的合法性检查，格式为yyyy-mm-dd(年-月-日)
        if (which.datatype=="date")
        {
           var thevalue
           thevalue=which.value
           //将数值去左右空格
           for (l=thevalue.length-1;l>=0;l--) 
           { 
               if (thevalue.charAt(l)!=" ") 
               { 
                   rpos=l 
                   break   
               } 
           } 
           thevalue=thevalue.substring(0,rpos+1) 
           for (m=0;m<thevalue.length;m++) 
           {
               if (thevalue.charAt(m)!=" ")
               {
                   ipos=m
                   break
               }
           }
           thevalue=thevalue.substring(ipos,thevalue.length)
           if (thevalue!="")
           {
             //查询日期格式中"-"的数量
             var signamount
             signamount=0
             var dotsign
             dotsign=0
             var thevaluesplit
             thevaluesplit=thevalue.split("-")
             if (thevaluesplit.length!=3)
             {
                alert(which.dataname+"非日期型数值！")
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false
             }
             for (ll=0;ll<3;ll++)
             {
               var thesplitswap
               thesplitswap=thevaluesplit[ll]
               for (l=thesplitswap.length-1;l>=0;l--) 
               { 
                   if (thesplitswap.charAt(l)!=" ") 
                   { 
                       rpos=l 
                       break   
                   } 
               } 
               thesplitswap=thesplitswap.substring(0,rpos+1) 
               for (m=0;m<thesplitswap.length;m++) 
               {
                   if (thesplitswap.charAt(m)!=" ")
                   {
                      ipos=m
                      break
                   }
               }
               thesplitswap=thesplitswap.substring(ipos,thesplitswap.length)                   
               if (thesplitswap=="" || isNaN(thesplitswap))
               {
                  alert(which.dataname+"非日期型数值！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
               }
             }
             
             for (kk=0;kk<thevalue.length;kk++)
             {
                 if (thevalue.charAt(kk)=="+" || thevalue.charAt(kk)==".")
                 {
                    dotsign++
                 }
             }
             if (dotsign>0) 
             { 
                alert(which.dataname+"非日期型数值！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             } 
             var firstsign 
             var lastsign 
             firstsign=thevalue.indexOf("-") 
             lastsign =thevalue.lastIndexOf("-") 
             var theyear="" 
             var themonth="" 
             var theday="" 
             var errsign="" 
             var maxday 
             theyear =parseFloat(thevalue.substring(0,firstsign)) 
             themonth=parseFloat(thevalue.substring(firstsign+1,lastsign)) 
             theday  =parseFloat(thevalue.substring(lastsign+1,thevalue.length)) 
             if (theyear<1900 || theyear>2100) 
             { 
                alert(which.dataname+"超出系统范围！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             } 
             //根据月求最大日值 
             if (themonth=="1" || themonth=="3" || themonth=="5" || themonth=="7" || themonth=="8" || themonth=="10" || themonth=="12") 
             { 
                 maxday=31 
             } 
             else 
             { 
                 if (themonth=="4" || themonth=="6" || themonth=="9" || themonth=="11") 
                 { 
                     maxday=30 
                 } 
                 else 
                 { 
                   if (themonth=="2") 
                   { 
                       if (theyear%4==0) 
                       { 
                           maxday=29 
                       } 
                       else 
                       { 
                          maxday=28 
                       } 
                   } 
                   else 
                   { 
                      errsign="error" 
                   } 
               } 
             } 
             if (errsign=="error") 
             { 
                alert(which.dataname+"非日期型数值！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             } 
             if (theday<1 || theday>maxday) 
             { 
                alert(which.dataname+"非日期型数值！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             }  
          } 
        } 
        //--日期检查结束-- 
      } 
   } 
   return true 
 }
 

//这个函数是否去掉，待考虑
//单个数据检查
//数据类型设置，例如input type="text" name="DmoNo" size="40" maxlength="20"  datalength="noempty" datatype="number" dataname="合同编号" 
//其中datatype设为number则要求为数值型,datalength设为noempty则要求不得为空，dataname为名称 
 function wxf_checkoneold(which,hidden) 
 { 
   var ipos,rpos,iipos,rrpos 

   //下拉列表框检查
   if (which.tagName=="SELECT")
   {
      if (which.type=="select-one")
      {
         if (which.datalength=="noempty")
         {
            var thevalue=which.getvalue()
            for (kk=thevalue.length-1;kk>=0;kk--) 
            { 
                if (thevalue.charAt(kk)!=" ") 
                { 
                   rrpos=kk 
                   break 
                } 
            } 
            thevalue=thevalue.substring(0,rrpos+1) 
            for (ll=0;ll<thevalue.length-1;ll++) 
            {
                if (thevalue.charAt(ll)!=" ")
                {
                   iipos=ll
                   break
                }
             }
             thevalue=thevalue.substring(iipos,thevalue.length)   
             if (thevalue=="")
             {
                alert(which.dataname+"请勿为空！")
                if(hidden!="1") which.focus()
                return false
             }
         }
      }
   }
   //text检查
   if (which.tagName=="INPUT")
   {
      if (which.type=="text"||which.type=="password"||which.type=="hidden")
     {
         //数值型数据的合法性检查
          if (which.datatype=="number")
          {
              if (isNaN(which.getvalue()))
              {
                  alert(which.dataname+"非数值！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
              }
          }

          //数值范围的合法性检查,nozero为大于零的正数
          if (which.datarange=="nozero")
          {
             if (parseFloat(which.getvalue()) < 1)
             {
                  alert(which.dataname+"为非零的正数！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
             }
          }

          //指定数据不允许为空的合法性检查
          if (which.datalength=="noempty")
          {
                var tervalue=which.getvalue()
                var obvalue
                var rvalue
                //去右连续空
               for (k=tervalue.length-1;k>=0;k--) 
               { 
                  if (tervalue.charAt(k)!==" ") 
                  { 
                     rpos=k 
                     break 
                  } 
               } 
               rvalue=tervalue.substring(0,rpos+1) 
              //去左连续空 
              for (j=0;j<rvalue.length;j++) 
              {
                   if (rvalue.charAt(j)!=" ")
                   {
                       ipos=j
                       break         
                   }
              }
              obvalue=rvalue.substring(ipos,rvalue.length)
              if (obvalue=="")
              {
                  alert(which.dataname+"请勿为空！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
              }
          }
        //--日期检查开始--
        //固定日期格式数据的合法性检查，格式为yyyy-mm-dd(年-月-日)
        if (which.datatype=="date")
        {
           var thevalue
           thevalue=which.getvalue()
           //将数值去左右空格
           for (l=thevalue.length-1;l>=0;l--) 
           { 
               if (thevalue.charAt(l)!=" ") 
               { 
                   rpos=l 
                   break   
               } 
           } 
           thevalue=thevalue.substring(0,rpos+1) 
           for (m=0;m<thevalue.length;m++) 
           {
               if (thevalue.charAt(m)!=" ")
               {
                   ipos=m
                   break
               }
           }
           thevalue=thevalue.substring(ipos,thevalue.length)
           if (thevalue!="")
           {
             //查询日期格式中"-"的数量
             var signamount
             signamount=0
             var dotsign
             dotsign=0
             var thevaluesplit
             thevaluesplit=thevalue.split("-")
             if (thevaluesplit.length!=3)
             {
                alert(which.dataname+"非日期型数值！")
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false
             }
             for (ll=0;ll<3;ll++)
             {
               var thesplitswap
               thesplitswap=thevaluesplit[ll]
               for (l=thesplitswap.length-1;l>=0;l--) 
               { 
                   if (thesplitswap.charAt(l)!=" ") 
                   { 
                       rpos=l 
                       break   
                   } 
               } 
               thesplitswap=thesplitswap.substring(0,rpos+1) 
               for (m=0;m<thesplitswap.length;m++) 
               {
                   if (thesplitswap.charAt(m)!=" ")
                   {
                      ipos=m
                      break
                   }
               }
               thesplitswap=thesplitswap.substring(ipos,thesplitswap.length)                   
               if (thesplitswap=="" || isNaN(thesplitswap))
               {
                  alert(which.dataname+"非日期型数值！")
                  if(hidden!="1")
                  {
                    which.focus()
                    which.select()
                  }
                  return false
               }
             }
             
             for (kk=0;kk<thevalue.length;kk++)
             {
                 if (thevalue.charAt(kk)=="+" || thevalue.charAt(kk)==".")
                 {
                    dotsign++
                 }
             }
             if (dotsign>0) 
             { 
                alert(which.dataname+"非日期型数值！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             } 
             var firstsign 
             var lastsign 
             firstsign=thevalue.indexOf("-") 
             lastsign =thevalue.lastIndexOf("-") 
             var theyear="" 
             var themonth="" 
             var theday="" 
             var errsign="" 
             var maxday 
             theyear =parseFloat(thevalue.substring(0,firstsign)) 
             themonth=parseFloat(thevalue.substring(firstsign+1,lastsign)) 
             theday  =parseFloat(thevalue.substring(lastsign+1,thevalue.length)) 
             if (theyear<1900 || theyear>2100) 
             { 
                alert(which.dataname+"超出系统范围！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             } 
             //根据月求最大日值 
             if (themonth=="1" || themonth=="3" || themonth=="5" || themonth=="7" || themonth=="8" || themonth=="10" || themonth=="12") 
             { 
                 maxday=31 
             } 
             else 
             { 
                 if (themonth=="4" || themonth=="6" || themonth=="9" || themonth=="11") 
                 { 
                     maxday=30 
                 } 
                 else 
                 { 
                   if (themonth=="2") 
                   { 
                       if (theyear%4==0) 
                       { 
                           maxday=29 
                       } 
                       else 
                       { 
                          maxday=28 
                       } 
                   } 
                   else 
                   { 
                      errsign="error" 
                   } 
               } 
             } 
             if (errsign=="error") 
             { 
                alert(which.dataname+"非日期型数值！") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             } 
             if (theday<1 || theday>maxday) 
             { 
                alert(which.dataname+"非日期型数值！2") 
                if(hidden!="1")
                {
                  which.focus()
                  which.select()
                }
                return false 
             }  
          } 
        } 
        //--日期检查结束-- 
      } 
   } 
   return true 
 }
 
 //功能：打开颜色选择界面，选取颜色
 //返回：颜色值，=""表示未选值
 //作者：YYG  2002-6-26
 function wxf_color()
 {
   var sColor=window.showModalDialog("../lib/color.htm","","dialogWidth:262px;dialogHeight:250px;center:yes;status:no")
   if (sColor == -1 || sColor == null)
   {
     sColor=""
   }
   return  sColor
 }

 //功能：选取词典内容
 //参数：objname:赋值对象名称,choosemode:默认选择模式，1-单选(默认)、2-多选
 //返回：内容值
 //作者：YYG  2002-7-12
 function wxf_dictionary(objname,choosemode)
 {
   var obj = eval("document.all."+objname)

   var sValue=showModalDialog("../lib/WxDictionary.aspx?DctNo=" + obj.DictionaryNo,choosemode,"dialogWidth:340px;dialogHeight:350px;status:no;scrollbars:no");

   if(typeof(sValue)!="undefined")
   {
     obj.value = sValue
   }
   obj.focus()
 }

 //功能：用字典功能定义类别
 //参数：sDicNo 类别编号
 //返回：没有返回值
 //作者：YYG  2006-7-24
 function wxf_dictionaryedit(sDctNo,sDctName)
 {
   showModalDialog("../lib/WxDictionary.aspx?Edit=true&DctNo=" + sDctNo + "&DctName=" + sDctName,"","dialogWidth:340px;dialogHeight:350px;status:no;scrollbars:no");
 }

//通用选择
//选择单位、人员
//type:emp、dpt(部门、人员),multi:false、true(单选、多选),idFld:ID字段对应的表单域名,nameFld:Name字段对应的表单域名,idValue:ID值,nameValue:Name值
function wxf_selectdptemp(type,multi,idFld,nameFld,idValue,nameValue)
{
  wxf_openchoosewin("../Lib/WxDptEmpSelect.aspx?Select=" + type + "&Multi=" + multi + "&TextName=" + nameFld + "&TextId=" + idFld + "&TextNamevalue=" + nameValue + "&TextIdvalue=" + idValue,400,400,"no")
  //wxf_openchoosewin('../Lib/WxDptEmpSelect.aspx?Select=Emp&Multi=false&TextName=OteEmpName&TextId=&TextNamevalue=&TextIdvalue=',400,400)
}

//选择单位 2006-1-4
//sPrjNo:工程编号，sPrjName:工程名称，sMulSelect:是否多选("yes":"no")
//rPrjId:返回工程ID的表单域名，rPrjName:返回工程名称的表单域名
//sExecute:函数调用后继续执行的函数

//选择合同类别
function wxf_selectcontractclass(rFldId,rFldName)
{
	wxf_opennonamewin("../WorkComm/WxSelectContractClass.aspx?FldId=" + rFldId + "&FldName=" + rFldName,400,400,'no')
}

//选择部门
function wxf_selectdepartment(sName,sMulSelect,rFldId,rFldName)
{
	wxf_opennonamewin("../Lib/WxDptEmpSelect.aspx?Select=Dpt&Multi="+sMulSelect+"&TextName="+rFldName+"&TextId="+rFldId+"&TextNamevalue="+sName+"&TextIdvalue=",400,400,'no')
}

//选择流程字段
function wxf_selectflowfield(rFldId,rFldName,rFblId)
{
  var sUrl = "../Common/WxGeneralSelectItem.aspx?Type=流程字段"
  sUrl += "&MulSelect=";
  sUrl += "&ExeFunc=";
  sUrl += "&FldId=" + rFldId;
  sUrl += "&FldName=" + rFldName;
  sUrl += "&FldNo=";
  sUrl += "&FblId=" + rFblId;
	wxf_openmodalwin(sUrl,600,500,'yes')
}

//选择角色
function wxf_selectrole(rMulSelect,rFldId,rFldName,rExeFunc)
{
  var sUrl = "../Common/WxGeneralSelectItem.aspx?Type=角色"
  sUrl += "&MulSelect=" + rMulSelect;
  if(typeof(rExeFunc)!="undefined")
		sUrl += "&ExeFunc="+rExeFunc;
  else
		sUrl += "&ExeFunc=";
  sUrl += "&FldId=" + rFldId;
  sUrl += "&FldName=" + rFldName;
  sUrl += "&FldNo=";
	wxf_openmodalwin(sUrl,600,500,'no')
}

//选择流程字段
function wxf_selectflownode(rFldId,rFldName,rFlwId)
{
  var sUrl = "../Common/WxGeneralSelectItem.aspx?Type=流程节点"
  sUrl += "&MulSelect=";
  sUrl += "&ExeFunc=";
  sUrl += "&FldId=" + rFldId;
  sUrl += "&FldName=" + rFldName;
  sUrl += "&FldNo=";
  sUrl += "&FlwId=" + rFlwId;
	wxf_openmodalwin(sUrl,500,400,'no')
}
//由于wxinput 的 behavior功能使reset按钮失去作用,增加此函数来替代此功能
//FormName 为Form 的名字
function wxf_reset(FormName)
{
	sForm=FormName
	obj = eval("document.all."+sForm)
	obj = obj.tags("INPUT")
	for(var i=0;i<window.obj.length;i++)
	{  
		obj(i).value = obj(i).defaultValue
	}
	
	obj1=eval("document.all."+sForm).tags("TEXTAREA")
	for(var i=0;i<window.obj1.length;i++)
	{  
		obj1(i).value = obj1(i).defaultValue
	}
	eval("document.all."+FormName).reset()
	try
	{
		bModified = false
	}
	catch(e){}
}	

//对有datalength为noempty的控件在后面增加红色星号
function wxf_noemptysign(curform)
{
	if(typeof(eval("document.all." + curform))=="undefined")
	{
		return;
	}
    var arytag = "input,select,textarea".split(",");
    for(k=0;k<arytag.length;k++)
    {
	    var obj = eval("document.all." + curform).tags(arytag[k]);
	    for(i=0;i<obj.length;i++)
	    {
	    	if(typeof(obj[i].datalength)!="undefined" && obj[i].datalength.toUpperCase() == "NOEMPTY")
	    	{
				obj[i].insertAdjacentHTML("AfterEnd","<font color='#FF0000'>*</font>")
	    	}
	    }
    }
}

function wxf_processbegin()
{
	wxf_openchoosewin("../Flow/WxProcessBegin.aspx",500,200,'no')
}

/*设定附件宽度*/
function wxf_accessorywidth(sWidth)
{
  document.all.UpFile0.style.width = sWidth
  document.all.UpFile1.style.width = sWidth
  document.all.UpFile2.style.width = sWidth
}
