replacing indexOf with jQuery.inArray in order to support IE8