function trim(strText) {
    // this will get rid of leading spaces
    while (strText.substring(0,1) == ' ')
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);
   return strText;
}

function MoneyFormat(Number)
{
	sNumber = new String(Number*1);
	var PointIndex = sNumber.indexOf(".");
	
	if( PointIndex == -1)
	{ //No decimal point, it's a whole number
		sNumber += ".00";
		return  sNumber;
	}
	var Decimals;
	Decimals = sNumber.length - PointIndex - 1;
		if( Decimals == 0)
	{
		sNumber += "00";
		return  sNumber;
	}
	else if( Decimals == 1)
	{
		sNumber += "0";
		return  sNumber;
	}
	else  if( Decimals == 2)
	{
		return  sNumber;
	}
	else
	{
		return sNumber.substr(0,PointIndex+3);
	}
}
