replace array.indexOf with $.inArray to support IE8