Fixes compatibility with IE<9

Fixes compatibility with IE<9: replaces indexOf with inArray