Replaced indexOf with $.inArray. Not supported by IE.