Use $.inArray instead of indexOf for IE8 compatibility.