IE8 compatibility issue fixed

This provides compatibility with IE8, checks for addEventListener existence and replaces it with attachEvent if it isn't defined.