Minor Bug with Math.trunc()

This Javascript function needs to be replaced by Math.floor().
Math.trunc() only works in Firefox.