(function(){
Array.prototype._indexOf = Array.prototype.indexOf;
function indexOf(itemIt, i, context){
//not an iterator, uses regular indexOf
if(!Object.isFunction(itemIt)) {
return this._indexOf(itemIt, i);
}
//item as a function is an iterator
//NaN 'i' is the context, nullifies 'i' to initialize it correctly after
if(!Object.isNumber(i)) {
context = i;
i = null;
}
i || (i = 0);
var length = this.length;
if (i < 0) i = length + i;
for (; i < length; i++)
if (itemIt.call(context, this[i], i)) {
return i;
}
return -1;
}
//redefines indexOf
Array.prototype.indexOf = indexOf;
})();