replace indexOf by jQuery.inArray method