im using the below polyfill below in a simple html5 game code but its not working and gives error object expected..please help

Code:
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function()
{callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};