working in IE10, not working in IE8/9 (indexOf error)