	// JavaScript library for form field validation
		
	//****************************** public check method ********************************************	
	function CheckIsAmount( str,maxLen,decLen )
	{	
		//str = trim(str);
		if (CheckExceedMaxLen(str,maxLen)) return false;
		if (!CheckIsFloat(str)) return false;
		if (str<=0) return false;
		if (str.indexOf(".")>0){
			var decStr = str.substring(str.indexOf(".")+1,str.length);
			if (decStr==null||decStr==""||CheckExceedMaxLen(decStr,decLen)) return false;
			var intStr = str.substring(0,str.indexOf("."));			
			if (intStr==null||intStr==""||CheckExceedMaxLen(intStr,maxLen-decLen-1)) return false;
		}else{
			if (CheckExceedMaxLen(str,maxLen-decLen-1)) return false;
		}	
		return true;
	}  
		
	function GetDate(aYear,aMonth,aDay)
	{	
	  var year=aYear;
	  var month="0"+aMonth;
	  var day="0"+aDay;	  
	  month=month.substring(month.length-2,month.length);
	  day=day.substring(day.length-2,day.length);
	  return year+"/"+month+"/"+day;
	  
	}		
	
	//add by coffee
	function CheckDateYMD(val){
    return CheckIsDateTime(val, "YYYY-MM-DD");	    	
  }	
	function CheckDateTimeYMD(val)
    {
    	return CheckIsDateTime(val, "YYYY/MM/DD");	    	
    }
     	
	function CheckDateTimeMDY(val)
    {
    	return CheckIsDateTime(val, "MM/DD/YYYY");	    	
    } 
    
	function CheckDateTimeDMY(val)
    {
    	return CheckIsDateTime(val, "DD/MM/YYYY");	    	
    }         
    
	function CheckExceedMaxLen( str,maxLen )
	{
		if (str.length>maxLen) return true;
	}
	
	function CheckIsEmpty( str )
	{		
		return( (str==null)||(str == "")||(trim(str) == "") )
	}	
	
	function CheckIsChar( str )
	{
		if (null==str || str=="") 
			return false;
		var val="";
		for (var i=0;i<str.length;i++){
         		var ch = str.substring(i,i+1);       
         		if (ch!="\n" && ch!="\r") {      
               		   val=val+ch;
               		}
               }
               
               myRegExp = /^([A-Z0-9a-z]*)$/;
	       return (myRegExp.test(val)) 
	}			

	function CheckSpecChars( str,specChars )
	{
		for (var i=0;i<specChars.length;i++){
			specChar = specChars.charAt(i);
			if (str.indexOf(specChar)>0) return false;
		}
		return true;
	}

	function CheckIsLetter( str )
	{
		Val = str;
		myRegExp = /^([A-z0-9;:!@#%&_=<>,"'\-\/\`\~\$\^\*\(\)\+\|\\\?\.\{\}\[\] ]+)$/;
		return (myRegExp.test(Val)) 
	}	
/**	
	function CheckIsInteger( str )
	{	
		Val = str;
		myRegExp = /^([0-9]+)$/;
		return (myRegExp.test(Val)) 
	}
*/	
	
	function CheckIsInteger( str )
	{	
		Val = str;
		myRegExp = /^(([1-9]([0-9]*))|(0))$/;
		return (myRegExp.test(Val)) 
	}
	
	function CheckIsFloat( str )
	{	
		Val = str;
		myRegExp = /^[-+]?([0-9]+)([.]?[0-9]*)([eE]?[1-9]*)$/;
		return (myRegExp.test(Val)) 
	}	
	
	function CheckIsDigital(str){		
		Val = str;
		myRegExp = /^([0-9]+)$/;
		return (myRegExp.test(Val)) 		
	}	

	function CheckIsFixedLenDigital(str,len){
		Val = str;
		if (Val.length != len) return false;
		myRegExp = /^([0-9]+)$/;
		return (myRegExp.test(Val)) 		
	}
	
	function CheckIsEmail( str )
	{	
		Val = str;
		myRegExp = /^([a-zA-Z0-9_.]+)([@])([a-zA-Z0-9._]+)$/;
		return (myRegExp.test(Val)) 
	}		
	
	function CheckIsValidDate(AYear,AMonth,ADay)  
	{
		if (AYear<="1900") return false;
		var val = AYear + "/" + AMonth + "/" + ADay;
		return CheckIsDateTime(val, "YYYY/MM/DD");
	}
 
	function CheckIsDateTime( ADtStr , FmtStr )
	{
		res=true;
		if ( ADtStr=="" || FmtStr=="")  return false;
		
		fstr = FmtStr.toUpperCase();
		i =0 ; p = 0; Li = 0; Lp = 0;
		y = -1 ; m = -1; d = -1; h= -1; mi= -1; s=-1;
		while( i < fstr.length )
		{
			fmtch = fstr.substring(i,i+1);		// current
			fmtchn = fstr.substring(i+1,i+2);	// next
			adtch = ADtStr.substring(p, p+1);	// current
			adtchn = ADtStr.substring(p+1, p+2);	// next
			if ( fmtch=="Y" )			// get year
			{	
				if ( fmtchn=="Y" )
				{
					y3=fstr.substring(i+2,i+3);	// next
					y4=fstr.substring(i+3,i+4);	// next
					if ( y3 =="Y" && y4 =="Y" ){ Li = 4; Lp = 4; }
					else { Li=2; Lp=2; }
					y = GetIntegerValue( ADtStr, p, Lp );
					if ( !( y>=0 && y<=9999 ) ) res = false;
				}else
				{
					if ( fmtch == adtch ) { Li=1; Lp=1 }
					else{	res =false; }
				}
			}else // get m .d . h .mi s
			{
				if ( fmtchn == fmtch ) Li = 2; else Li = 1;
				if ( IsDigital( adtchn ) ) Lp = 2 ;else Lp = 1;	
				avalue = GetIntegerValue( ADtStr, p, Lp);

				if ( fmtch=="M" )
				{
					if ( fmtchn=="I" )	// Minute
					{
						Li=2;		// special
						mi = avalue;
						if ( !( mi>=0 && mi<=59 ) ) res = false;
					}else // default is as Month 
					{
						m = avalue;
						if ( !( m>=1 && m<=12 ) ) res = false;
					}
				}else
				if ( fmtch=="D" )
				{
					d = avalue;
					if ( !( d>=1 && d<=31 ) ) res = false;
				}else
				if ( fmtch=="H" )
				{
					h = avalue;
					if ( !( h>=0 && h<=23 ) ) res = false;
				}else
				if ( fmtch=="S" )
				{
					s = avalue;
					if ( !( s>=0 && s<=59 ) ) res = false;
				}else
				{
					if ( fmtch == adtch ) { Li=1; Lp=1 }
					else{	res =false; }
				}
			}
			i += Li; p+=Lp;	//==================>>>!!!
			if (! res ) return res;
		}
		if ( res && i != fstr.length || p != ADtStr.length ) res = false;
		if ( ! ( res &&  m!=-1 && d!=-1 && d<=GetDaysOfMonth(m, y ) ) )  res = false;
		return res;
	}

	// compare two String, 
	// @param dt1Str - String
	// @param dt1St2 - String
	// @return int 
	//			0 : equals
	//			1 : dt1 > dt2
	//			-1: dt1 < dt2
	function CompareCheckValue(str,str2)
	{
		var m_str = getInt(str);
		var m_str2 = getInt(str2);
		var res = -2;
		if(m_str > m_str2) res = 1
		else 
		if(m_str == m_str2)  res = 0
		else
			res = -1
		return res;
	}

	// compare two dates, 
	// @param dt1Str - String
	// @param dt1St2 - String
	// @param fmtStr - String -- like "YYYY/MM/DD", "MM/DD/YYYY", "DD/MM/YYYY"
	// @return int 
	//			0 : equals
	//			1 : dt1 > dt2
	//			-1: dt1 < dt2
	function CompareDateTime(dt1Str, dt2Str, fmtStr)
	{
		dt1 = getDateTime(dt1Str , fmtStr )
		dt2 = getDateTime(dt2Str , fmtStr )
		res=-2;
		if (dt1==null && dt2 == null ) res= 0
		else
		if (dt1==null && dt2 != null ) res= -1
		else
		if (dt1!=null && dt2 == null ) res= 1
		else
		if (dt1.getTime()==dt2.getTime()) res=0
		else
		if (dt1.getTime()<dt2.getTime()) res=-1
		else
			res= 1
		return res;
	}	

	function CheckAllOnSubmit( fields )
	{
		for ( var i=0; i < fields.length; i++ )
		{
			afield = fields[i];
			form = document.forms[ afield[0] ];
			field = form[ afield[1] ];
			b = CheckAFiled( field, afield[2], afield[3], afield[4]) ;
			if ( !b ) 
			{
				return false;
			}
		}
		
		return true;
	}
	
	function CheckOnBlur(obj, fields)
	{
		if ( ( obj== null ) || (obj.name=="") )  return false;
		
		StrName = obj.name;
		afield = null;
		for ( var i=0; i < fields.length; i++ )
		{
			afield = fields[i];
			if ( StrName == afield[1]  ) break;
			afield = null;
			continue;
		}
		if ( afield == null) return false;
		bb = CheckAFieldOnBlur( document.forms[ afield[0] ][afield[1]], afield[2], afield[3], afield[4]);
		return bb;
	}


	
	
	//****************************** private method ********************************************
	is = new BrowserCheck();
	function BrowserCheck()
	{
		var b = navigator.appName
		if (b=="Netscape") this.b = "ns"
		else if (b=="Microsoft Internet Explorer") this.b = "ie"
		else this.b = b
		this.v = parseInt(navigator.appVersion)
		this.ns = (this.b=="ns" && this.v>=4)
		this.ns4 = (this.b=="ns" && this.v==4)
		this.ns5 = (this.b=="ns" && this.v==5)
		this.ie = (this.b=="ie" && this.v>=4)
		this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
		this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
		if (this.ie5) this.v = 5
		this.min = (this.ns||this.ie)
	}	
	//   it is a private function invoked by other valid check function to public
	//	 cast off the left and right blank characters of a string
	function trim(p_sValue)
	{
	  var tmp = "";
	  var item_length =p_sValue.length;
	  var item_length_minus_1 =p_sValue.length - 1;
	  for (index = 0; index < item_length; index++)
	  {
	    if (p_sValue.charAt(index) != ' ')
	    {
	      tmp += p_sValue.charAt(index);
	    }
	    else
	    {
	      if (tmp.length > 0)
	      {
	        if (p_sValue.charAt(index+1) != ' ' && index != item_length_minus_1)
	        {
	          tmp += p_sValue.charAt(index);
	        }
	      }
	    }
	  }
	  return tmp
	}
	
	// it is a private function invoked by other valid check function to public
	function GetDaysOfMonth(AMonth,AYear)  
	{
		monthdays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30,31, 30, 31)
		days = -1;
		if ( AMonth>=1 && AMonth<=12 )	days = monthdays[AMonth -1 ];	
		if (AMonth==2 && IsLeapYear(AYear) ) days=29;
		return (days);
	}
	
	// it is a private function invoked by other valid check function to public
	function IsLeapYear(AYear) 
	{
		b = ((AYear % 4)==0) && ((AYear % 100)!=0) || ((AYear % 400)==0) ; 
		return (b); 
	}
	
	// it is a private function invoked by other valid check function to public
	function GetIntegerValue(Str, pos, len )
	{
		result = 0;
		astr = Str.substring(pos, pos+len)
		if ( CheckIsInteger( astr ) )
		{
			result = astr ;
		} else { result = -1 }
		return result;
	}
	
	//   it is a private function invoked by other valid check function to public
	function IsDigital( achar )
	{
		return( achar >="0" && achar <="9")
	}
	
	//   it is a private function invoked by other valid check function to public
	function getDateTime( ADtStr , FmtStr )
	{
		res=true;
		if ( ADtStr=="" || FmtStr=="")  return null
		
		fstr = FmtStr.toUpperCase();
		i =0 ; p = 0; Li = 0; Lp = 0;
		y = -1 ; m = -1; d = -1; h= -1; mi= -1; s=-1;
		while( i < fstr.length )
		{
			fmtch = fstr.substring(i,i+1);		// current
			fmtchn = fstr.substring(i+1,i+2);	// next
			adtch = ADtStr.substring(p, p+1);	// current
			adtchn = ADtStr.substring(p+1, p+2);	// next
			if ( fmtch=="Y" )			// get year
			{	
				if ( fmtchn=="Y" )
				{
					y3=fstr.substring(i+2,i+3);	// next
					y4=fstr.substring(i+3,i+4);	// next
					if ( y3 =="Y" && y4 =="Y" ){ Li = 4; Lp = 4; }
					else { Li=2; Lp=2; }
					y = GetIntegerValue( ADtStr, p, Lp );
					if ( !( y>=0 && y<=9999 ) ) res = false;
				}else
				{
					if ( fmtch == adtch ) { Li=1; Lp=1 }
					else{	res =false; }
				}
			}else // get m .d . h .mi s
			{
				if ( fmtchn == fmtch ) Li = 2; else Li = 1;
				if ( IsDigital( adtchn ) ) Lp = 2 ;else Lp = 1;	
				avalue = GetIntegerValue( ADtStr, p, Lp);

				if ( fmtch=="M" )
				{
					if ( fmtchn=="I" )	// Minute
					{
						Li=2;		// special
						mi = avalue;
						if ( !( mi>=0 && mi<=59 ) ) res = false;
					}else // default is as Month 
					{
						m = avalue;
						if ( !( m>=1 && m<=12 ) ) res = false;
					}
				}else
				if ( fmtch=="D" )
				{
					d = avalue;
					if ( !( d>=1 && d<=31 ) ) res = false;
				}else
				if ( fmtch=="H" )
				{
					h = avalue;
					if ( !( h>=0 && h<=23 ) ) res = false;
				}else
				if ( fmtch=="S" )
				{
					s = avalue;
					if ( !( s>=0 && s<=59 ) ) res = false;
				}else
				{
					if ( fmtch == adtch ) { Li=1; Lp=1 }
					else{	res =false; }
				}
			}
			i += Li; p+=Lp;	//==================>>>!!!
			if (! res ) return null;
		}
		if ( res && i != fstr.length || p != ADtStr.length ) return null;
		if ( ! ( res &&  m!=-1 && d!=-1 && d<=GetDaysOfMonth(m, y ) ) )  return null;
		if (h==-1) h=0;
		if (mi==-1) mi=0;
		if (s==-1) s=0;
		return new Date(y,m-1,d,h,mi,s,0);
	}	
	
	function getInt(tmp)
	{
		  var i,j;
		  var len=tmp.length;
		  var str;
		  j=-1;
		  for(i=0;i<len;i++)
		  {
		    if (tmp.charAt(i) != '0') 
		    {
		     j=i;
		     break;
		    } 
		  }
		  if (j> -1)
		  {
		    str=tmp.substring(j,len)
		  }
		  else
		  {
		    str=tmp;
		  }
		  var _r=parseInt(str)
		  return _r;
	}
	
	function changeDays(m_oYear,m_oMonth,m_oDay)  
	{  
	   var len = m_oDay.length
	   var m_sYear=  m_oYear.options[m_oYear.selectedIndex].value;
	   var m_sMonth = m_oMonth.options[m_oMonth.selectedIndex].value;
	   var i
	   var str
	   for( i=len ; i>0;i-- )
	     m_oDay.options[i-1]=null; 
	        
	   var m_str=GetDaysOfMonth( m_sMonth,m_sYear);	
	   for(var j=1;j<= m_str;j++)
			{
				if ( j < 10) str="0" + j;
				else str=j
				m_oDay.options[j]=new Option(j,str);
				
			}
	//	m_oDay.options[1].selected=true;	
	}  	
	function getDate(m_oYear,m_oMonth,m_oDay)
	{
		var m_sYear  =  "";
	   	var m_sMonth =  "";
	   	var m_sDay   =  "";
	   	
	   	if (m_oYear.selectedIndex > -1)
		    m_sYear  =  m_oYear.options[m_oYear.selectedIndex].value;
		if (m_oMonth.selectedIndex > -1)
	   		m_sMonth =  m_oMonth.options[m_oMonth.selectedIndex].value;
	   	if (m_oDay.selectedIndex > -1)	
	   	 	m_sDay   =  m_oDay.options[m_oDay.selectedIndex].value;
	   	var m_sReuslt="";
	   	if ((m_sYear == "" ) || (m_sMonth == "") || (m_sDay =="") )
	   	{
	   		m_oYear.selectedIndex=0;
	   		m_oMonth.selectedIndex=0;
	   		m_oDay.selectedIndex=0;
	   		return "";
	   	}
	   	
	   	m_sReuslt = m_sYear + "-" + m_sMonth + "-" + m_sDay;
	   	
	   	return m_sReuslt;
	}	

	function CheckAFieldOnBlur( aField , aFlag, aMethod, aMessage )
	{
		var b = CheckIsEmpty( aField.value );
		if ( !b )				// input nothing , but must input at this filed
		{
			str = aField.value;
			aField.value = str.toUpperCase();
			if ( aMethod != null )
			{
				b = eval( aMethod + "('" + aField.value + "' )" );
			} else
			{
				b = true;
			}
		}
		if (!b)
		{
			aField.focus();
			aField.style.background="lime";
			if (!CheckIsEmpty(aMessage)) 	// check if any messge to show.
				alert(aMessage);
			aField.style.background="#CCCCCC";
		}
		return b;
	}	
	


	<!-------------------------Client Input Check-------------------------------->
	// aField	: is the filed name , and is a object
	// aFlag	: true if is the must have avlue , false is not necessary 
	// aMessage	: if not pass then show the message , if you don't want , just only an empty string.
	// aMethod	: the method to test whether the value is right or not .
	//		  and the method must return aboolean value , and the input param is only a string.
			  
	// return	: if ok then return true, else false.
	//
	// NOTE this version surpport Netscape (>4 ) and IE (>4)
	//
	
	<!---------------------------------------------------------------------------->
	
	function CheckAFiled( aField , aFlag, aMethod, aMessage )
	{
		var m_sTmp="";
		var m_sType=aField.type;
		//alert("==========>>"+m_sType + "-----" +m_sType.indexOf('select'))
		if (m_sType.indexOf('text')>=0)
		{
			aField.value=trim(aField.value)
			m_sTmp=aField.value;
		}else
		if (m_sType.indexOf('select')>=0)
		{
			m_sTmp=aField.options[aField.selectedIndex].value;
		}else
		{
			m_sTmp=aField.value;
		}
		var b = CheckIsEmpty( m_sTmp );
		
		if ( b && aFlag )			// input nothing , but must input at this filed
		{
			b = false;
		}else					// chenk the input correctly or not.
		{
			if (!b && aMethod != null  )
			{
				b = eval( aMethod + "('" + m_sTmp + "' )" );
			
			} else
			{
				b = true;
			}
		}
		if (!b)
		{
			if (is.ie)
				aField.style.background="lime";
			else if (is.ns4)
			{
				//aField.style.bgcolor="lime";
			}
			if (m_sType.indexOf('hidden')==-1)
				aField.focus();
			if (!CheckIsEmpty(aMessage)) 	// check if any messge to show.
				alert(aMessage);
		}
		if (is.ie)
			aField.style.background="#CCCCCC";
		return b;
	}
	function FormatAmount(amount){
		var decimal = "";
		if (amount.indexOf(".")>0){
			decimal = amount.substring(amount.indexOf("."),amount.length);
			if (decimal.length==2) decimal = decimal+"0";
			amount=amount.substring(0,amount.indexOf("."));
		}else{
			decimal=".00";
		}
		var len = amount.length;
		var j = amount.length-1;
		var formatedAmount = "";		
		for (var i=1;i<=len;i++){
			formatedAmount = amount.charAt(j)+formatedAmount;
			if ((i%3==0)&&(i>0)&&(i!=len)) formatedAmount = "," + formatedAmount;			
			j=j-1;
		}
		return formatedAmount+decimal;
	}	
	
//add by pamela 20030608 begin
function showStatus(input){
    if (input=="AP"){
        return "PENDING";
    }
    if (input=="NA"){
        return "&nbsp;";
    }
}

function showdatetime(datetime)
{
	if (datetime.length >= 16){
			return(datetime.substr(8,2)+"/"+datetime.substr(5,2)+"/"+datetime.substr(0,4));
	}
	else
		return(datetime);
}
//add by pamela 20030608 end

function checkIsSwiftCode(aStr)
{
	if ((aStr==null)||(aStr == "")||(trim(aStr) == ""))
		return true;
	if (trim(aStr).length<=0) 
		return true;      
	
	aStr=trim(aStr);
	var swift_code = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:().,+'~`\n\r";
	for (var i=0;i<aStr.length;i++){
               var ch = aStr.substring(i,i+1);                       
               if (swift_code.indexOf(ch)<0) {               	
                  if (ch.charAt(0) == " " || ch.charAt(0)=="" || ch.charAt(0)==' ' || ch.charAt(0)=='')                  
                     return true;  
                   else 
                     return false;                   
                }              
        }
        return true;
}


function writeStatus ( status )
{
	if ( status == "AP" )
		document.write("PENDING");
	else if ( status == "AU" )
		document.write("CORP ACCEPT");
	else if ( status == "TR" )
		document.write("CORP REJECT");
	else if ( status == "BS" )
		document.write("BANK ACCEPT");
	else if ( status == "BU" )
		document.write("BANK REJECT");
	else if ( status == "TP" )
		document.write("HOST PROCESS");
	else if ( status == "TS" )
		document.write("HOST ACCEPT");
	else if ( status == "TU" )
		document.write("HOST REJECT");
	else if ( status == "AW" )
		document.write("COPR AUTHORIZE PROCESS");
	else if ( status == "NA" )
		document.write("INCOMPLETE");
	else if ( status == "na" )
		document.write("INCOMPLETE");
	else if ( status == "N/A" )
		document.write("INCOMPLETE");	
	else if ( status == "" )
		document.write("INCOMPLETE");
	else if ( status == " ")
		document.write("INCOMPLETE");
	else
		document.write("N/A");
}		

function textCounter(field, maxlimit) {
     if (field.value.length > maxlimit) 
	field.value = field.value.substring(0, maxlimit);
}

function checkEmail(emailStr) {
     if (emailStr.length == 0) {
         return true;
     }
     var emailPat=/^(.+)@(.+)$/;
     var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
     var validChars="\[^\\s" + specialChars + "\]";
     var quotedUser="(\"[^\"]*\")";
     var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
     var atom=validChars + '+';
     var word="(" + atom + "|" + quotedUser + ")";
     var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
     var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
     var matchArray=emailStr.match(emailPat);
     if (matchArray == null) {
         return false;
     }
     var user=matchArray[1];
     var domain=matchArray[2];
     if (user.match(userPat) == null) {
         return false;
     }
     var IPArray = domain.match(ipDomainPat);
     if (IPArray != null) {
         for (var i = 1; i <= 4; i++) {
            if (IPArray[i] > 255) {
               return false;
            }
         }
         return true;
     }
     var domainArray=domain.match(domainPat);
     if (domainArray == null) {
         return false;
     }
     var atomPat=new RegExp(atom,"g");
     var domArr=domain.match(atomPat);
     var len=domArr.length;
     if ((domArr[domArr.length-1].length < 2) ||
         (domArr[domArr.length-1].length > 3)) {
         return false;
     }
     if (len < 2) {
         return false;
     }
   return true;
}

function replace(string,text,by) {

// Replaces text with by in string

    var strLength = string.length, txtLength = text.length;

    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);

    if ((!i) && (text != string.substring(0,txtLength))) return string;

    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)

        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function getCurrentDate(){
	currDate = new Date();
	s_date = currDate.getYear()+"-";
	if ((currDate.getMonth()+1)<10){
		s_date = s_date + "0" + (currDate.getMonth()+1);
	}else{
		s_date = s_date + (currDate.getMonth()+1);
	}
	s_date = s_date + "-";
	if (currDate.getDate()<10){
		s_date = s_date + "0" + currDate.getDate();
	}else{
		s_date = s_date + currDate.getDate();
	}
	return s_date;
}



	function checkDate(tmp,fieldname){
		if( tmp.value != "" ){
			if( !CheckDateYMD(tmp.value)){
				alert("["+ fieldname + "]格式不对!!例:2004-01-01");
				tmp.select();
				return false;
			}
		}
		return true;
	}


function checkInteger(tmp,fieldname){		
		if( tmp.value != "" || tmp.value < 0 ){
			if( !CheckIsDigital(tmp.value)){
				alert("["+ fieldname + "]格式不对,只能为整数!!");
				tmp.select();
				return false;	
			}
		}
		
		return true;
	}
	

	function formatNum(obj,l){		
		
		var deci=0;
		if (l==3) deci=0.0005;
		if (l==2) deci=0.005;
		if (l==1) deci=0.05;
		if (l==0) deci=0.5;
		//obj.value必须是数值类型的数字，不能有逗号
		obj.value=parseFloat(obj.value)+deci
;
		tmp =obj.value ;
		tmp1 = obj.value.length;
		zeroPos = tmp.indexOf(".");
		if (zeroPos==-1){
			obj.value = obj.value+".";
			for (i=0;i<l;i++){
				obj.value = obj.value+"0";
			}
		}
		else{

			decStr = tmp.substring(tmp.indexOf(".")+1,tmp.length);
			intStr = tmp.substring(0,tmp.indexOf("."));

			a = decStr.length;
			if (a<=l){
				for (i=0;i<l-decStr.length;i++){
					obj.value = obj.value+"0";
				}
			}
			else{
				obj.value = intStr+"."+tmp.substring(tmp.indexOf(".")+1,tmp.indexOf(".")+l+1);
				
			}
			
		}
	}


	function checkNumber(tmp,fieldname,maxNum,decLen){		
		if( tmp.value != "" ){
			if( !CheckIsAmount(tmp.value,maxNum,decLen) || tmp.value < 0 ){
				alert("["+ fieldname + "]格式不对,格式：" + maxNum + "," + decLen + ",且不能为负数!!");
				tmp.select();
				return false;
			}else{
				var decLen1 = 0 ;
				var zeroPos = tmp.value.indexOf(".");				
				if( zeroPos != -1 ){					
					decLen1 = decLen - (tmp.value.length - zeroPos ) + 1;					
					if( decLen1 < 0){
						alert("["+ fieldname + "]格式不对,保留" + decLen + "位小数!!");
						tmp.select();
						return false;							
					}
					tmp.value = tmp.value + getZero(decLen1);
				}else{
					decLen1 = decLen;
					tmp.value = tmp.value + "." +  getZero(decLen1);
				}
			}
			
		}
		
		return true;
	}
	
	
	function getZero(num){
	 	var zeroStr = "";
	 	for( var i= 0 ; i < num ; i++){
	 		zeroStr += "0";
	 	}
	 	return zeroStr;
	}


	//按回车键向一个元素
	function tabclick() {
	    if (window.event.keyCode==13) {
	        window.event.keyCode=9
	    }
	}