Use $.inArray rather than Array.indexOf.

Array.indexOf breaks IE and possibly mobile browsers too.