You are missing a function declaration.
In this case toRad()
must be defined first as:
/** Converts numeric degrees to radians */
if (typeof(Number.prototype.toRad) === "undefined") {
Number.prototype.toRad = function() {
return this * Math.PI / 180;
}
}
according to the code segment all at the bottom of the page