//-----------------------------------------------------------------------//
function roundNumber(dNumber,iPlaces)                                    //
//-----------------------------------------------------------------------//
//          function name: roundNumber()                                 //
//             created by: Dustin Brown                                  //
//             created on: 2/20/2001                                     //
//                purpose: rounds given number to 'iPlaces' decimal      //
//                         places, defaults to 2.                        //
//             parameters: dNumber - the number to be rounded            //
//                         iPlaces - the number of places to round to    //
//                returns: the newly rounded number if 'dNumber' is a    //
//                         valid number; 0 if it is not.                 //
// include files required: none                                          //
//-----------------------------------------------------------------------//
{
	//check for invalid number passed
	if(isNaN(dNumber))return 0;
	
	//if no iPlaces, default to 2
	if(iPlaces==null)iPlaces=2;
	
	//round dNumber to iPlaces places
	dNumber=Math.round(dNumber*Math.pow(10,iPlaces))/Math.pow(10,iPlaces);
	
	//if there are less than iPlaces decimal places, add 0's
	dNumber+="";
	if(iPlaces > 0)
	{
		var pos=dNumber.indexOf(".");
		if(pos>-1){
			var temp=dNumber.substring(pos+1,dNumber.length);
			for(var y=temp.length;y<iPlaces;y++)dNumber+="0";
		}
		else{
			dNumber+=".";
			for(var y=0;y<iPlaces;y++)dNumber+="0";
		}
	}
	
	//return the rounded number
	return dNumber;
}
//End function roundNumber()---------------------------------------------//
