function FormIstel(tel)
	tel=trim(tel)
	if len(tel)<7 then
		FormIstel=false
		exit function
	end if
	t="0123456789-"
	for i=1 to len(tel)
		if(instr(t,mid(tel,i,1))=0) then
			FormIstel=false
			exit function
		end if
	next
	FormIstel=true
end function

function FormIsaddress(address)
	address=trim(address)
	if len(address)<10 then
		FormIsaddresstel=false
		exit function
	end if
	FormIsaddress=true
end function

Function JsDateValue(thisDate)	
	if not isDate(thisDate) then
		msgbox "[JsDateValue]错误,参数不是一个合法的日期格式!"
		sDate=dateValue(now)
	else
		sDate=dateValue(thisDate)
	end if

	if len(year(sDate))=1 then JsDateValue=JsDateValue & "200"
	if len(year(sDate))=2 then JsDateValue=JsDateValue & "20"
	if len(year(sDate))=3 then JsDateValue=JsDateValue & "2"

	JsDateValue=JsDateValue & year(sDate) & "-"

	if len(month(sDate))=1 then JsDateValue=JsDateValue & "0"
	JsDateValue=JsDateValue & month(sDate) & "-"
	if len(day(sDate))=1 then JsDateValue=JsDateValue & "0"
	JsDateValue=JsDateValue & day(sDate)
End Function

Function JsDateDiff(bDate,eDate,sType)	
	JsDateDiff=datediff(sType,bDate,eDate)
End Function

Function FormIsnumeric(ThisValue)
  FormIsnumeric=IsNumeric(ThisValue)
End Function

Function FormIsage(ThisValue)
	ThisValue=Trim(ThisValue)
	If IsNumeric(ThisValue) Then
		ThisValue=Int(ThisValue)
		If (thisvalue<=0) or (thisvalue>100) Then
			FormIsage=False
		Else
			FormIsage=true						
		End If
	else
  	FormIsage=False
  End If
End Function

Function FormIszipcode(ThisValue)
	ThisValue=Trim(ThisValue)
	If IsNumeric(ThisValue) Then
		ThisValue=Int(ThisValue)
		If Len(thisvalue)<>6 Then
			FormIszipcode=False
		Else
			FormIszipcode=true						
		End If
	else
  		FormIszipcode=False
	End If
End Function

Function FormIsdate(ThisValue)
  FormIsdate=IsDate(ThisValue)
End Function

Function FormIsempty(ThisValue)
  If Trim(ThisValue)="" then
    FormIsempty=true
  Else
    FormIsempty=false
  End if
End Function

Function FormIsemail(ThisValue) 
	thisValue=trim(thisValue)
	if len(ThisValue)<10 then
		FormIsemail=false
		exit function
	end if
	
	on error resume next

	dim ValidFlag,BadFlag,atCount,SpecialFlag,atLoop,atChr,tAry1,DomainName,UserName
	ThisValue=trim(ThisValue)
	ValidFlag = False 
	If (ThisValue <> "") And (InStr(1, ThisValue, "@") > 0) And (InStr(1, ThisValue, ".") > 0) Then 
		atCount = 0 
		SpecialFlag = False 
		For atLoop = 1 To Len(ThisValue) 
			atChr = Mid(ThisValue, atLoop, 1) 
			If atChr = "@" Then atCount = atCount + 1 
			If (atChr >= Chr(32)) And (atChr <= Chr(44)) Then SpecialFlag = True 
			If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True 
			If (atChr >= Chr(58)) And (atChr <= Chr(63)) Then SpecialFlag = True 
			If (atChr >= Chr(91)) And (atChr <= Chr(94)) Then SpecialFlag = True 
		Next 
		If (atCount = 1) And (SpecialFlag = False) Then 
			BadFlag = False 
			tAry1 = Split(ThisValue, "@") 
			UserName = tAry1(0) 
			DomainName = tAry1(1) 
			If (UserName = "") Or (DomainName = "") Then BadFlag = True 
			If Mid(DomainName, 1, 1) = "." then BadFlag = True 
			If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True 
			ValidFlag = True 
		End If 
	End If 
	If BadFlag = True Then ValidFlag = False 
	FormIsemail = ValidFlag 
End Function 

'数字转换成大写金额的函数
Function getCnMoney(num) 
  dim n,m_hj,s,ch,ch2,ch3
  num=Replace(num,",","",1,-1,1)

  if num="" then
    getCnMoney= "您还没有输入金额！"
    Exit Function
  End If

  '判断是否为负数
  isFs=false
  if IsNumeric(num)=False then
    getCnMoney= "您输入的不是金额！"
    Exit Function
  else
    if num<0 then isFs=true
    num=abs(num)
  End If
  n=FormatNumber(num,2,-1)
  num=n
  n=Replace(n,",","",1,-1,1)
  If len(n)>15 Then
     getCnMoney= "金额必须小于千亿！"
    Exit Function
  End If
  hj=space(0)
  s="840"
  ch="壹贰叁肆伍陆柒捌玖"
  ch2="仟佰拾  "
  ch3="亿万元"
  for x=1 to 3
    m=cstr(int(n/10^FormatNumber(mid(s,x,1),0,-1)))
    m=space(4-len(m))+m
    m_hj=space(0)
    if m<>"   0" then
       for y=1 to 4
           if mid(m,y,1)<>space(1) and mid(m,y,1)<>"0" then
              m_hj=trim(m_hj+mid(ch,FormatNumber(mid(m,y,1),0,-1),1)+mid(ch2,y,1))
           else
              if mid(m,y,1)=space(1) or mid(m,y,1)="0" then
                 m_hj=m_hj
                 if right(m_hj,1)="零" then
                    m_hj=m_hj+space(0)
                 else
                    m_hj=m_hj+"零"
                 end if
              else
                 m_hj=m_hj
              end if
           end if   
       next
       if right(m_hj,1)="零" then
          m_hj=mid(m_hj,1,len(m_hj)-1)+mid(ch3,x,1)
          if x=3 then
             m_hj=m_hj+space(0)
          else
             m_hj=m_hj+"零"
          end if
       else
          m_hj=m_hj+mid(ch3,x,1)
       end if 
       if right(hj,1)="零" and mid(m_hj,1,1)="零" then
          hj=hj+mid(m_hj,2,len(m_hj)-1)
       else
          hj=hj+m_hj
       end if
    else 
       if x=3 then
          if right(hj,1)="零" then
             if trim(hj)="零" then
                hj=hj+space(0)
             else
                hj=mid(hj,1,len(hj)-1)+"元"
             end if
          else
             if trim(hj)="零" then
                hj=hj+space(0)
             else
                hj=hj+"元"
             end if
          end if
       else
          if right(hj,1)="零" then
             hj=hj+space(0)
          else
             hj=hj+"零"
          end if   
       end if   
    end if
    if n-int(n)=0 then
       n=n-int(FormatNumber(m,0,-1))*10^int(FormatNumber(mid(s,x,1),0,-1))
    else
       tt=FormatNumber("0."+mid(cstr(n),Instr(1,n,".")+1,2),2)
       n=int(n) 
       n=n-int(FormatNumber(m,0,-1))*10^int(FormatNumber(mid(s,x,1),0,-1))
       n=n+tt
    end if
  next
  m=mid(cstr(n),2,2)
  if trim(len(m))<>2 then
     m=m+"0"
  end if
  if n*100=0 then
     if left(hj,1)="零" then
        if right(hj,1)="零" then
           hj=hj+"元整"
        else
           hj=mid(hj,2,len(hj)-1)+"整"
        end if
     else
        if right(hj,1)="零" then
           hj=mid(hj,1,len(hj)-1)+"整"
        else
           hj=hj+"整"
        end if
     end if
  else
     if right(hj,1)="零" then
        hj=mid(hj,1,len(hj)-1)
     else
        hj=hj
     end if
     if mid(m,1,1)="0" or mid(m,1,1)=space(1) then
        hj=hj+"零"
     else
        hj=hj+mid(ch,FormatNumber(mid(m,1,1),0,-1),1)+"角"
     end if
     if mid(hj,1,1)="零" then
        hj=mid(hj,2,len(hj)-1)
     else
        hj=hj
     end if
     if mid(m,2,1)="0" then
        hj=hj+"整"
     else
        hj=hj+mid(ch,FormatNumber(mid(m,2,1),0,-1),1)+"分"
     end if   
  end if


  if isFs then hj="<font color=red>" & hj & "</font>"

  getCnMoney=hj  
End Function

'js trim
function FormTrim(thisValue)
  FormTrim=trim(thisValue)
End function

'js fomatDate
function jsFormatDate(sDate)
	if not isdate(sDate) then sdate=date
	jsFormatDate=jsFormatDate & year(sDate) & "-" & month(sDate) & "-" & day(sDate)	
end function