function FormatNumber(num, decimalNum, bolLeadingZero, bolParens)
/* IN - num:            the number to be formatted
	   decimalNum:     the number of decimals after the digit
	   bolLeadingZero: true / false to use leading zero
	   bolParens:      true / false to use parenthesis for - num

  RETVAL - formatted number
*/
{
   var tmpNum = num;

   // Return the right number of decimal places
// tmpNum *= Math.pow(10,decimalNum);
//	alert(tmpNum);
// tmpNum = Math.floor(tmpNum);
//	alert(tmpNum);
// tmpNum /= Math.pow(10,decimalNum);


   var tmpStr1 = new String(num);
	var pos_decimal;
	pos_decimal = tmpStr1.indexOf(".");
	if(pos_decimal== -1)
	{
		tmpStr1 = tmpStr1 + ".";
		pos_decimal = tmpStr1.length;
	}
	for(var i=0; i<decimalNum; i++)
	{
		tmpStr1 = tmpStr1 + "0";
	}
	var tmpStr = tmpStr1.substr(0,(parseInt(pos_decimal) + parseInt(decimalNum) + 1 ));
	

   // See if we need to hack off a leading zero or not
   if (!bolLeadingZero && num < 1 && num > -1 && num !=0)
	   if (num > 0)
		   tmpStr = tmpStr.substring(1,tmpStr.length);
	   else
		   // Take out the minus sign out (start at 2)
		   tmpStr = "-" + tmpStr.substring(2,tmpStr.length);


   // See if we need to put parenthesis around the number
   if (bolParens && num < 0)
	   tmpStr = "(" + tmpStr.substring(1,tmpStr.length) + ")";


   return tmpStr;
}

