﻿//**********************************************************
//功能：自定义控件内相关脚本资源
//作者：赵小刚、常文兵、赵德全、张林
//时间：2005-06-02
//备注：
//**********************************************************
  var blnValidate = 0;			//标志是否有输入项未验证 0：否；1：是；
  var objValidate = null;		//当前验证项
 
  var keycode;
  var elementType; 
 
  function OnkeyDown1()
  {
	//得到虚拟键值*/
	keycode = window.event.keyCode; 
	//得到当前焦点对象类型
	elementType = window.event.srcElement.type;
	//如果是回车
	if(keycode == 13)
	{
		//如果不是按钮或submit
		if  (elementType == 'text')
		{    
			event.keyCode=9;
		}
	}
  }
  document.onkeydown = OnkeyDown1;	

  //检验字符串字节长度函数(可识字汉字,.对汉字视为2)
  function strlen(str)
  {
	return str.replace(/[^\x00-\x7f]/g,'**').length;
  }
  

  //限制字符输入数量(区别英文字母和汉字)
  function maxstrlen(theobject,maxlength)
  {
	var len
	var str1
		var strTemp
		len= 0
		str1 = theobject.value 

		if (strlen(theobject.value) > maxlength)
		{ 
			for(i=0;i<theobject.value.length;i++)
			{
			if (theobject.value.charCodeAt(i)>128 || theobject.value.charCodeAt(i)<0 ) 
				{len = len + 2;}
			else
				{len = len + 1;}

				if (len >= maxlength)
				{
					alert("字符超过规定长度"+maxlength+",将被截取！");
					strTemp=str1.substring(0,i +1);
					if (strlen(strTemp)>maxlength)
						theobject.value = str1.substring(0,i);
					else
						theobject.value = str1.substring(0,i +1);
					break;
				} 
			}
		}
	}
	
 //当输入字符超过规定长度则不再接受输入(区别英文字母和汉字)
  function OnKeyPress(theobject,maxlength)
  {
	var len
	var str1
		var strTemp
		len= 0
		str1 = theobject.value 

		if (strlen(theobject.value) > (maxlength*1 -1))
		{ 
			for(i=0;i<theobject.value.length;i++)
			{
				if (theobject.value.charCodeAt(i)>128 || theobject.value.charCodeAt(i)<0 ) 
					{len = len + 2;}
				else
					{len = len + 1;}

				if (len >= (maxlength*1 -1))
				{
					return false;
					break;
				} 
			}
		}
		return true;
	}
	
	//验证数字是否合法函数
	//调用方法：NumberValidate(objText,intTotalLen,intFloatLen)
	//输入参数：objText:对象名，为文本框名称；intTotalLen:数字总长，整型数据；intFloatLen:小数长度，整型数据
	//返回参数：如果输入数字不符合要求，则返回提示信息
	//修改：赵德全
	//修改日期：2005-06-24
	//修改原因：引入动态正则表达式，优化程序实现

	function NumberValidate(objText,intTotalLen,intFloatLen)
	{

		var strINIValue = objText.value;									//原始值
		var intIntegerLen = intTotalLen - intFloatLen;						//整数部分长度
		var strShowMSG = "";												//提示给用户的信息	
		
		if (intIntegerLen < 0 ||  intFloatLen < 0 || (intIntegerLen==0&&intFloatLen==0))
		{
			strShowMSG = "验证格式参数错误!";
			return strShowMSG;
		}

		strINIValue = strINIValue.replace(/\s/g,"");						//替换任何空白，包括空格、制表、换页等
		strINIValue = strINIValue.replace(/\　/g,"");						//替换全角字符，包括数字、空格、标点等
		strINIValue = strINIValue.replace(/\０/g,"0");
		strINIValue = strINIValue.replace(/\１/g,"1");
		strINIValue = strINIValue.replace(/\２/g,"2");
		strINIValue = strINIValue.replace(/\３/g,"3");
		strINIValue = strINIValue.replace(/\４/g,"4");
		strINIValue = strINIValue.replace(/\５/g,"5");
		strINIValue = strINIValue.replace(/\６/g,"6");
		strINIValue = strINIValue.replace(/\７/g,"7");
		strINIValue = strINIValue.replace(/\８/g,"8");
		strINIValue = strINIValue.replace(/\９/g,"9");
		strINIValue = strINIValue.replace(/\。/g,".");	
		strINIValue = strINIValue.replace(/\．/g,".");
		strINIValue = strINIValue.replace(/\，/g,"");
		strINIValue = strINIValue.replace(/\,/g,"");
		
		if (strINIValue == "")
		{
			return strShowMSG;
		}
		
		strINIValue = parseFloat(strINIValue)
		
		if (isNaN(strINIValue))
		{
			strShowMSG = "对不起,该文本框应输入数字内容!";
			return strShowMSG;
		}
		strINIValue = strINIValue.toString(10);
		objText.value = strINIValue;

		var r;											//声明正则表达式对象
		if (intIntegerLen==0&&intFloatLen>0)
		{	
			if (Math.abs(parseFloat(strINIValue))>=1)
			{
				strShowMSG = "对不起,该文本框应输入整数部分数值为0的数字!"
				return strShowMSG;
			}
			r = new RegExp("^[\\+\\-]?\\d{0,1}(\\.\\d{0," + intFloatLen + "})?$");
			strShowMSG = "对不起,该文本框应输入小数部分长度为" + intFloatLen.toString(10) + "位的数字!"
		}
		else if(intIntegerLen>0&&intFloatLen==0)
		{
			r = new RegExp("^[\\+\\-]?\\d{0," + intIntegerLen + "}$");
			strShowMSG = "对不起,该文本框应输入长度在" + intIntegerLen.toString(10) + "位以内的整数!";
		}
		else if(intIntegerLen>0&&intFloatLen>0)
		{
			r = new RegExp("^[\\+\\-]?\\d{0," + intIntegerLen + "}(\\.\\d{0," + intFloatLen + "})?$");
			strShowMSG = "对不起,该文本框应输入整数部分为" + intIntegerLen.toString(10) + "位,小数部分为" + intFloatLen.toString(10) + "位的数字!";
		}

		if (strINIValue.match(r) == null)
		{
			return strShowMSG;
		}
		else
		{
			strShowMSG = "";
			return strShowMSG;
		}	
	}

	//判断查询表单中复选按钮的选择状态
	function IsQueryFormCheck(theobject1,theobject2)
	{
		if (theobject1.value == "")
		{
			theobject2.checked = false
		}
		else
		{
			theobject2.checked = true
		}
	}
	
	//根据输入框对象验证浮点数其值得合法性
	function CustomTextBoxCheckRealThis( objName )
	{	
		var strShowMSG = NumberValidate( objName, parseInt(objName.IntLength,10)+parseInt(objName.DecLength,10), parseInt(objName.DecLength,10))
		if (strShowMSG != '' && strShowMSG != null)
		{
			//如果有输入项未验证，当前项不进行验证
			if (!(blnValidate == 1 && objName != objValidate))
			{
				if (objName.TextRemark!="undefined" && objName.TextRemark!="")
				{strShowMSG = strShowMSG.replace("该文本框",objName.TextRemark+"文本框");}
				
				alert(strShowMSG);
			}
			
			objName.select();
			objName.focus()			
			blnValidate = 1;
			objValidate = objName;
			return false;
		}

		blnValidate = 0;
		objValidate = null; 
		return true;
	}

	//验证某字符串是否为合法的E-mail地址
	//调用方法：CheckEmail(strEmail)
	//输入参数：strEmail，字符串数值，字符串类型
	//返回参数：如果输入数字不符合要求，则返回
	//创建：赵德全
	//创建日期：2005-06-26
	function CheckEmail(strEmail) {
		var supported = 0;
		if (window.RegExp) {
			var tempStr = "a";
			var tempReg = new RegExp(tempStr);
			if (tempReg.test(tempStr)) supported = 1;
		}
		if (!supported)
			return (strEmail.indexOf(".") > 2) && (strEmail.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		return (!r1.test(strEmail) && r2.test(strEmail));
	}	
	
	//利用正则表达式验证是否为整型
	function CustomTextBoxValidateIntegerByObject( objectName )
	{
		var strValue = objectName.value ;
		var strPatternsDict = /^[+\-]?\d+$/ ;
		
		var bIsRight = strPatternsDict.exec( strValue ) ;
		
		return ( !bIsRight ? false : true ) ;
	}
	
	// 利用正则表达式验证是否为浮点型
	function CustomTextBoxValidateRealNumberByObject( objectName )
	{
		var strValue = objectName.value ;
		var strPatternsDict = /^[+\-]?(\d{0,8})(\.\d{0,2})?$/ ;
		
		var bIsRight = strPatternsDict.exec( strValue ) ;
		
		return ( !bIsRight ? false : true ) ;
	}
	
		//利用正则表达式验证是否为整型
	function CustomTextBoxValidateInteger( strValue )
	{
		var strPatternsDict = /^[+\-]?\d+$/ ;
		
		var bIsRight = strPatternsDict.exec( strValue ) ;
		
		return ( !bIsRight ? false : true ) ;
	}
	
	// 利用正则表达式验证是否为浮点型
	function CustomTextBoxValidateRealNumber( strValue )
	{
		var strPatternsDict = /^[+\-]?(\d{0,8})(\.\d{0,2})?$/ ;
		
		var bIsRight = strPatternsDict.exec( strValue ) ;
		
		return ( !bIsRight ? false : true ) ;
	}
	
	//选择月份函数
	function SelDate(theobject,strpath)
	{
		var OldValue = theobject.value
		var strPath = window.location.href

		strPath = strPath.replace("http://","")
		
		var arrPath = strPath.split("/")
		
		strPath = "http://" + arrPath[0].toString() + "/common/month.html"
		
		var Ret = window.showModalDialog(""+strPath,"","dialogWidth=230px;dialogHeight=210px;dialogleft=" + window.event.x + ";dialogtop=" + window.event.y + ";scroll=no;status=no;");
		
		if (Ret)
		{  
			theobject.value = Ret;
			if (theobject.value != OldValue)
			{
				try{theobject.onchange();}
				catch(e){}
			}
		}
	}
	
	//检查输入的内容是否是整数数据
	function CustomTextBoxCheckNumberThis( objName )
	{	
		//如果有输入项未验证，当前项不进行验证
		if (blnValidate == 1 && objName != objValidate)
		{
			return true;
		}

		if (strlen(objName.value) > objName.maxLength)
		{
		    var theTextRemark = "该文本框字符长度超过规定长度！"

			if(objName.TextRemark!="undefined" && objName.TextRemark!="")
			{
				theTextRemark = theTextRemark.replace("该文本框","\""+objName.TextRemark+"\"文本框");
			}

			alert(theTextRemark);
			
			objName.select();
			objName.focus();
			blnValidate = 1;
			objValidate = objName;
			return false;
		}
		
		if (!CustomTextBoxValidateIntegerByObject(objName) && objName.value != '' )
		{
			var theTextRemark = "请正确填写，该文本框只能录入整数型数字！"
			if(objName.TextRemark!="undefined" && objName.TextRemark!="")
			{
				theTextRemark = theTextRemark.replace("该文本框","\""+objName.TextRemark+"\"文本框");
			}
			
			alert(theTextRemark);
			
			objName.select();
			objName.focus();
			blnValidate = 1;
			objValidate = objName;
			return false;
		}
		
		blnValidate = 0;
		objValidate = null; 
		return true;
	}
		
	//////////////////////////////////////////////////////////////////////////////////////////////////
	//*************************************************************************************************
	//CreatedDataGrid控件的js函数列表		
	//************************************************************************************************
	/////////////////////////////////////////////////////////////////////////////////////////////////
	//调整表头和表体的宽度相等
	function CreatedDataGrid_Adjust(objHead,objData)
	{
	try{
			if (document.all[objData] != undefined && document.all[objData].clientWidth * 1 > 300)
			{
				if (document.all[objHead] != undefined && document.all[objData] != undefined && (document.all[objHead].clientWidth != document.all[objData].clientWidth) && (document.all[objData].rows.length > 0))
				{
					document.all[objHead].style.width = (document.all[objData].clientWidth * 1 + 2) + "px";
					if (document.all["tbUnit"] != undefined)
					{
						document.all["tbUnit"].style.width = (document.all[objData].clientWidth * 1 + 2) + "px";
					}
					if (document.all["tbFunction"] != undefined)
					{
						document.all["tbFunction"].style.width = (document.all[objData].clientWidth * 1 + 2) + "px";
					}
				}
			}
		}
		catch(e)
		{}
	}

	//调整表头和表体的宽度相等
	function CustomCreatedDataGrid_Load(i)
	{
		try{
			if (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"] != undefined && document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"].clientWidth * 1 > 300)
			{
				if (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgHead"] != undefined && document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"] != undefined && (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgHead"].clientWidth != document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"].clientWidth) && (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"].rows.length > 0))
				{
					document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgHead"].style.width = (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"].clientWidth * 1 + 2) + "px";
					if (document.all["tbUnit" + i] != undefined)
					{
						document.all["tbUnit" + i].style.width = (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"].clientWidth * 1 + 2) + "px";
					}
					if (document.all["tbFunction"] != undefined)
					{
						document.all["tbFunction"].style.width = (document.all["CreatedDataGrid"+i+"_CreatedDataGrid"+i+"_dgData"].clientWidth * 1 + 2) + "px";
					}
				}
			}
		}
		catch(e)
		{}
	}

	//调整div的滚动高度和屏幕相适应
	function CreatedDataGrid_DivScrollHeight()
	{
		var iTemp = 300;
		iTemp = document.all["div"+m_tbMain.selectedIndex].parentElement.parentElement.clientHeight * 1 - document.all["div"+m_tbMain.selectedIndex].offsetTop * 1;
		document.all["div"+m_tbMain.selectedIndex].style.height = iTemp;
	}

	//调整div的滚动高度和屏幕相适应
	function DivScrollHeight(intHeight,intWidth,obj)
	{
		var iTemp1 = 0;  //用于当页面加上其它控件的时候的微调变量

		if (document.all.tblQuery != undefined)
			iTemp1 = document.all.tblQuery.offsetHeight;
		
		if (document.all.tblPage != undefined)
			iTemp1 += document.all.tblPage.offsetHeight;
			
		if (document.all.lblErrorInfo != undefined)
			iTemp1 += document.all.lblErrorInfo.offsetHeight;	
		
		if (document.all.tblTitleOp != undefined)
			iTemp1 += document.all.tblTitleOp.offsetHeight;
		
		if (document.all.tbManage != undefined)
			iTemp1 += document.all.tbManage.offsetHeight;
			
		if (document.all.tblForSave != undefined)
			iTemp1 += document.all.tblForSave.offsetHeight-50;		
			
		var iHeight = document.body.clientHeight - intHeight - iTemp1;

		obj.style.height = iHeight

		//判断参照控件是否存在，然后调整DataGrid宽度和其相适应
		if( document.all.CustomToolButton_tblStyle != undefined && obj.style.width > 800)
		{
			var iWidth = CustomToolButton_tblStyle.clientWidth
			obj.style.width = iWidth;
		}
	}
	
	//递归查找父控件
	function FindParentToFORM(objTab)
	{
		if(objTab.parentElement.tagName == "FORM")
		{
			m_TopTab = true;
			return;
		}
		if(objTab.parentElement.tagName != "TABLE")
		{
			FindParentToFORM(objTab.parentElement);
		}
		else
		{
			m_TopTab = false;
			return;
		}
	}
	
	//改变DataGrid行的背景色
	function ChangeBgColor( classid, strStyle )
	{
		var iIsHave = classid.className.lastIndexOf( ' ' + strStyle ) ;
		if ( iIsHave == -1 )
			classid.className = classid.className + ' ' + strStyle ;					
	}
	//重置DataGrid行的背景色	
	function ResetBgColor( classid, strStyle )
	{
		var iIsHave = classid.className.lastIndexOf( ' ' + strStyle ) ;
		if ( iIsHave != -1 )
			classid.className = classid.className.substring( 0, classid.className.lastIndexOf( ' ' + strStyle ) )
	}
	
	//验证是否日期格式
	function IsDate(s) 
	{
		var re = /^(\d{4})(\/|-)(\d{1,2})\2(\d{1,2})$/
		var m = re.exec(s);
		if (m == null) return false;
		var d = new Date(m[1],m[3]-1,m[4]);
		
		return d.getFullYear()==m[1] && d.getMonth()==(m[3]-1) && d.getDate()==m[4];
	}
	
	//验证日期格式
	function DataValidate_DateFormat(theObject)
	{
		//如果有输入项未验证，当前项不进行验证
		if (blnValidate == 1 && theObject != objValidate)
		{
				return true;
		}
		
		SetDateReg();//设置日期正则表达式
		if (theObject.value.trim() != "" && (!IsDate(theObject.value) || theObject.value.length < 10))
		{
				var theTextRemark = "该文本框的日期格式有错误，请重新输入！"
				if (theObject.TextRemark!=undefined && theObject.TextRemark!="")
				{
					theTextRemark = theTextRemark.replace("该文本框","\""+theObject.TextRemark+"\"文本框")
				}
				
				alert(theTextRemark);
				
				theObject.select();
				theObject.focus();
				blnValidate = 1;
				objValidate = theObject;
				return false;
		}
		else
		{		
				blnValidate = 0;
				objValidate = null;
				return true;
		}
	}

	//验证月份格式
	function DataValidate_MonthFormat(theObject)
	{
		//如果有输入项未验证，当前项不进行验证
		if (blnValidate == 1 && theObject != objValidate)
		{
				return true;
		}

		if (theObject.value.trim() != "" && (!IsDate(theObject.value+"-01") || theObject.value.length < 7))
		{
				var theTextRemark = "该文本框的月份格式有错误，请重新输入！"
				if (theObject.TextRemark!=undefined && theObject.TextRemark!="")
				{
					theTextRemark = theTextRemark.replace("该文本框","\""+theObject.TextRemark+"\"文本框")
				}
				
				alert(theTextRemark);
				
				theObject.select();
				theObject.focus();
				blnValidate = 1;
				objValidate = theObject;
				return false;
		}
		else
		{		
				blnValidate = 0;
				objValidate = null;
				return true;
		}
	}
	
	//验证必填数据是否为null,以及合法性
	//调用方法：return DataValidate()
	//输入参数：
	//返回参数：如果验证不合格为false，否则为true
	//作者：张林
	//修改日期：2005-06-26
	var IsSubmited = 0;  //是否已经点击提交按钮，0：否；1：是
	function DataValidate()
	{
		//已经触发提交事件后，不允许再次触发
		if (IsSubmited != 0)
		{
			return false;
		}
		var intElementCount=document.Form1.elements.length;
		for (var i = 0;i<intElementCount;i++)
		{
			var theItemType=document.Form1.elements[i].type;
			var theItemTextType=document.Form1.elements[i].TextType;
			var theReadOnly=document.Form1.elements[i].readOnly;
			var theDisabled=document.Form1.elements[i].disabled;
			if(theItemType=="text" && theDisabled!=true)
			{
				if(document.Form1.elements[i].IsNull!="undefined")
				{
					if (document.Form1.elements[i].IsNull=="False" && document.Form1.elements[i].value=="")
					{
						
						var theTextRemark = "该文本框为必填项，请填写！"
						if (document.Form1.elements[i].TextRemark!="undefined" && document.Form1.elements[i].TextRemark!="")
						{
							theTextRemark = theTextRemark.replace("该文本框","\""+document.Form1.elements[i].TextRemark+"\"文本框")
						}
						alert(theTextRemark);
						document.Form1.elements[i].focus();
						return false;
					}
				}
							
				//验证数据合法性
				switch(theItemTextType)
				{
					case "Number":		//整数类型
						if (!CustomTextBoxCheckNumberThis(document.Form1.elements[i]))
							return false;
						break;
					case "Real":		//浮点数类型
						if (!CustomTextBoxCheckRealThis(document.Form1.elements[i]))
							return false;
						break;
					case "Date":		//日期类型
						if (!DataValidate_DateFormat(document.Form1.elements[i]))
							return false;
						break;
					case "Month":
						if (!DataValidate_MonthFormat(document.Form1.elements[i]))
							return false;
						break;						
					default:
						maxstrlen(document.Form1.elements[i],document.Form1.elements[i].MaxLength);
						break;
				}
			}
		}
		
		//触发提交事件后，把标志置为已经触发提交事件的状态
		IsSubmited = 1;
		return true;
	}

	

	//响应数据录入页面的全选按钮函数
	function check_all()
	{
		var objectchk=document.all.item("chkDataRec")
		var objectchkall = document.all.item("chkAllRec")
		if (objectchk!=undefined) 
		{
			if (objectchk.length>0) 
			{
				if (objectchkall.checked==true)
				{
					for(var i=0;i<objectchk.length;i++)
					{
						objectchk[i].checked = true
					}  
				}
				else
				{
					for(var i=0;i<objectchk.length;i++)
					{
						objectchk[i].checked = false
					}  
				}
			}
			else
			{
				if (objectchkall.checked==true)
				{
					objectchk.checked = true
				}
				else
				{
					objectchk.checked = false 
				} 
			}
		} 
	}	
	
	
	
	//*****************************************************************************************

//格式化货币
//number 原数值 
//	pattern 一些说明：
//“,” (半角的豆号) 如果有的话，看豆号到小数点（如果有的话）前有几位，则按几位划分整数部分
//“0”（数字零） 如果该位上没有数字，就补0
//“#”（井号） 如果该位上有数字就输出数字，没有则不输出
	function QformatNumber(number,pattern)
	{
		var str			= number.toString();
		var strInt;
		var strFloat;
		var formatInt;
		var formatFloat;
		if(/\./g.test(pattern))
		{
			formatInt		= pattern.split('.')[0];
			formatFloat		= pattern.split('.')[1];
		}
		else
		{
			formatInt		= pattern;
			formatFloat		= null;
		}

		if(/\./g.test(str))
		{
			if(formatFloat!=null)
			{
				var tempFloat	= Math.round(parseFloat('0.'+str.split('.')[1])*Math.pow(10,formatFloat.length))/Math.pow(10,formatFloat.length);
				strInt		= (Math.floor(number)+Math.floor(tempFloat)).toString();				
				strFloat	= /\./g.test(tempFloat.toString())?tempFloat.toString().split('.')[1]:'0';			
			}
			else
			{
				strInt		= Math.round(number).toString();
				strFloat	= '0';
			}
		}
		else
		{
			strInt		= str;
			strFloat	= '0';
		}
		if(formatInt!=null)
		{
			var outputInt	= '';
			var zero		= formatInt.match(/0*$/)[0].length;
			var comma		= null;
			if(/,/g.test(formatInt))
			{
				comma		= formatInt.match(/,[^,]*/)[0].length-1;
			}
			var newReg		= new RegExp('(\\d{'+comma+'})','g');

			if(strInt.length<zero)
			{
				outputInt		= new Array(zero+1).join('0')+strInt;
				outputInt		= outputInt.substr(outputInt.length-zero,zero)
			}
			else
			{
				outputInt		= strInt;
			}

			var 
			outputInt			= outputInt.substr(0,outputInt.length%comma)+outputInt.substring(outputInt.length%comma).replace(newReg,(comma!=null?',':'')+'$1')
			outputInt			= outputInt.replace(/^,/,'');

			strInt	= outputInt;
		}

		if(formatFloat!=null)
		{
			var outputFloat	= '';
			var zero		= formatFloat.match(/^0*/)[0].length;

			if(strFloat.length<zero)
			{
				outputFloat		= strFloat+new Array(zero+1).join('0');
				//outputFloat		= outputFloat.substring(0,formatFloat.length);
				var outputFloat1	= outputFloat.substring(0,zero);
				var outputFloat2	= outputFloat.substring(zero,formatFloat.length);
				outputFloat		= outputFloat1+outputFloat2.replace(/0*$/,'');
			}
			else
			{
				outputFloat		= strFloat.substring(0,formatFloat.length);
			}

			strFloat	= outputFloat;
		}
		else
		{
			if(pattern!='' || (pattern=='' && strFloat=='0'))
			{
				strFloat	= '';
			}
		}

		return strInt+(strFloat==''?'':'.'+strFloat);
	}
	/*
	alert(formatNumber(0,''));  //0
	alert(formatNumber(12432.21,'#,###'));//12.432
	alert(formatNumber(12432.21,'#,###.000#'));//12.432.210
	alert(formatNumber(12432,'#,###.00'));//12.432.00
	alert(formatNumber(12432.419,'#,###.0#'));//12.432.42
	
	一些说明：
“,” (半角的豆号) 如果有的话，看豆号到小数点（如果有的话）前有几位，则按几位划分整数部分
“0”（数字零） 如果该位上没有数字，就补0
“#”（井号） 如果该位上有数字就输出数字，没有则不输出

*/		

