	Dim aitc_edit_drity
	aitc_edit_drity = false

Sub aitc_edit_FNumber(x,y,y1,curr,dec1,separator)
  dim MyPos(2), i
  minus = 0
  if (left((x),1)) = "," or (left((x),1)) = "." Then x = "0" + x
  if (left((x),1)) = "-" Then x = "-0" + Trim(right(x,len(x)-1))
  dim b, dispfield, hiddfield, Mylen, dec
  Set dispfield = eval("document.all."+y)
  Set hiddfield= eval("document.all."+y1) //hidden
  if isnumeric(x) = True and len(x) > 0 Then
  	  MyPos(2) = InstrRev(x, ",")
   	  MyPos(1) = InstrRev(x, ".")
	  if MyPos(1)>Mypos(2) Then 
		Mypos(0) = Mypos(1)
	  else Mypos(0) = Mypos(2)
	  End if
  	  Mylen = len(Cstr(x))
	  if Mypos(0) > 0 Then 
		Mylen = Mylen - Mypos(0)
	  else Mylen=0
	  End if
   	  x=replace(x, ",", "")
   	  x=replace(x, ".", "")
	  if Mylen > 0 Then
		dec = 1
		For i = 1 to Mylen
			dec = dec * 10
		next
		x=x/dec
	  else Mylen=dec1
	  End if
	  if curr="CUR" Then 
		b = FormatCurrency(x,dec1,-2,-2,-2)
	  else b = FormatNumber(x,dec1,-2,-2,separator)
	  end if
	  if CDbl(x) = 0 then
	  	hiddfield.value = "0" 
	  elseif dec1 > -1 Then 
		valxx = Cstr(FormatNumber(x,Mylen,-1,0,0))
		valxx = replace(valxx,",",".")
		hiddfield.value = replace(valxx," ","")
	  else hiddfield.value = b
	  end if
  	  dispfield.value= b
	  if b<0 Then 
		dispfield.className="minus"
	  else dispfield.className="number"
	  End if
  elseif len(x)>0 then
		MsgBox(msg)
		dispfield.className="number"
		dispfield.focus()
  else 	
  		dispfield.className="number"
		hiddfield.value = ""
  End if
End Sub

Sub aitc_edit_unFNumber(x,y,y1)
 dim txt, txt1, Mypos
 if len(x) > 0 Then
	 Set txt = eval("document.all."+y)
	 Set txt1= eval("document.all."+y1)
	 on error resume next
	 	  b = "100000000000000000000"
		  if InstrRev(txt1.value, ".") > 0 and InstrRev(txt1.value, ".") < len(txt1.value) then 
		  	a = len(txt1.value) - InstrRev(txt1.value, ".")
		  	b1 = replace(Cstr(txt1.value), ".", "")
		  elseif InstrRev(txt1.value, ",") > 0 and InstrRev(txt1.value, ",") < len(txt1.value) then 
		  	a = len(txt1.value) - InstrRev(txt1.value, ",")
		  	b1 = replace(Cstr(txt1.value), ",", "")
		  else 
		  	b1 = txt1.value	
			a = 0
		  end if
		  a1 = int(left(b,a+1))
	 if isnumeric(b1) = True Then
		  b = int(b1) / a1
		  if CDbl(txt.value) = 0 then
		  	txt.value = 0
		  else
		  	txt.value = FormatNumber(b,a,-1,0,0)
		  end if
		  txt.select
	  End if
	  on error goto 0
  End if
End Sub

