'var' for some variables' declaration to avoid polluting global namespace and for better compatibility with strict mode

Would be good for people who integrate this js with a lot of other js codes :)