function removeCommas( strValue ) 
{
	var objRegExp = /,/g; //search for commas globally
	//replace all matches with empty strings
	return strValue.replace(objRegExp,'');
}
function formatNumber2 (value, decimal) {
	if(value != '' && value != '0')
		anynum = removeCommas(value);
	anynum=eval(anynum);
	
	switch(decimal)
	{
		case 0:
		divider =1;
		break;
		case 1:
		divider =10;
		break;
		case 2:
		divider =100;
		break;
		default:  	 //for 3 decimal places
		divider =1000;
	}
	workNum=Math.abs((Math.round(anynum*divider)/divider));

	workStr=""+workNum

	if (workStr.indexOf(".")==-1){workStr+="="}

	dStr=workStr.substr(0,workStr.indexOf("="));dNum=dStr-0
	pStr=workStr.substr(workStr.indexOf("="))

	while (pStr.length-1< decimal){pStr+="0"}

	if(pStr =='=') pStr ='';

	//--- Adds a comma in the thousands place.    
	if (dNum>=1000) {
		dLen=dStr.length
		dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
	}
	//-- Adds a comma in the lacs place.
	if (dNum>=100000) {
		//alert(dNum);
		dLen=dStr.length
		dStr=parseInt(""+(dNum/100000))+","+dStr.substring(dLen-6,dLen)
	}
	if (dNum>=10000000) {
		//alert(dNum);
		dLen=dStr.length
		dStr=parseInt(""+(dNum/10000000))+","+dStr.substring(dLen-9,dLen)
	}
	if (dNum>=1000000000) {
		//alert(dNum);
		dLen=dStr.length
		dStr=parseInt(""+(dNum/1000000000))+","+dStr.substring(dLen-11,dLen)
	}
	// retval = dStr + pStr
	retval = dStr 
	//-- Put numbers in parentheses if negative.
	if (anynum<0) {retval="("+retval+")";}
	return retval;
}
function update_value(value,obj)
{
	
	if(value != '0' && value != '')
	{
		if(value.substr(0,1) == '0')
			value = value.substr(1);
		var	val = formatNumber2(value,'3');
		document.getElementById(obj).innerHTML=val + ".00";
	}
}