if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function(item) {
    if (typeof item == 'undefined') return -1;
    for (var i = 0, n = this.length; i < n; i++ ) {
      if (this[i].deentitify() == item.deentitify()) {
        return i;
        break;
      }
    }
  };
}

if (!Array.prototype.foreach) {
  Array.prototype.foreach = function(f) {
    for (var i = 0, n = this.length; i < n; i++) {
      f(this[i], i, this);
    }
  }
}

Array.prototype.remove = function(item) {
  var i = this.indexOf(item);
  if (i >= 0) this.splice(this.indexOf(item),1);
};

Array.prototype.contains = function(item) {
  return this.indexOf(item) >= 0;
};