    /**
	 * Creates a new array with all elements that 
	 * pass the test implemented by the provided function. 
	 * @author Mozilla Developer Center
	 */        
    Array.prototype.filter = function(_callback) {
        var len     = this.length;
        var res     = new Array();
        var thisp   = arguments[1];
        for (var i = 0; i < len; i++) {
            if (i in this) {
                var val = this[i];
                if (_callback.call(thisp, val, i, this)){
                    res.push(val);
                }
            }
        }
        return res;
    };
	
	if (typeof Array.prototype.indexOf == "undefined") {
		Array.prototype.indexOf = function(value) {
			for (var i = 0; i < this.length; i++)
				if (this[i] == value)
					return i;
			return -1;
		}	
	}
        
    /**
	 * Tests whether some element in the array passes 
	 * the test implemented by the provided function. 
	 * @author Mozilla Developer Center
	 */     
    Array.prototype.some = function(_callback) {
        var len     = this.length;
        var thisp   = arguments[1];
        for (var i = 0; i < len; i++) {
            if (i in this && _callback.call(thisp, this[i], i, this))
                return true;
        }       
        return false;
    };
        
    /**
	 * Executes a provided function once per array element.
	 * @author Mozilla Developer Center
	 */    
    Array.prototype.foreach = function(_callback) {
        var len     = this.length;
        var thisp   = arguments[1];
        for (var i = 0; i < len; i++) {
            if (i in this)
                _callback.call(thisp, this[i], i, this);
        }   
    };
