//------- Rounding in javascript --------
//@param: Number, length to round
//@return: Rounded number
function roundNumber(rnum, rlength)
{ // Arguments: number to round, number of decimal places
var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
newNumber = parseFloat(newnumber); // Output the result to the form field (change for your purposes)
return newNumber;
}