Do not use indexOf because it is not available in IE<9

Use jQuery.inArray instead...