Fixed #1183: cc.game.setFrameRate doesn't work

I fixed cc.game.setFrameRate doesn't work on web.

cocos2d/cocos2d-js#1183

I'm sorry for new pull request, because i made some mistakes.

Anyway I tried to write reusable code about restart loops with a frame rate.

If it needs to update, please give me a advice.

It's my pleasure :)
This calculation can be avoid for each frame, it can be stored as a private variable in `cc.game`, and it should be updated in the _setAnimFrame function call