if(!Array.prototype.unshift) { function array_unshift() { this.reverse(); for(var i=arguments.length-1; i>=0; i--){ this[this.length] = arguments[i]; } this.reverse(); return this.length } Array.prototype.unshift = array_unshift; } if(!Array.prototype.shift) { function array_shift() { firstElement = this[0]; this.reverse(); this.length = Math.max(this.length-1,0); this.reverse(); return firstElement; } Array.prototype.shift = array_shift; } if(!Array.prototype.push) { function array_push() { for(var i=arguments.length-1; i>=0; i--){ this[this.length] = arguments[i]; } return this.length } Array.prototype.push = array_push; } if(!Array.prototype.pop) { function array_pop() { lastElement = this[this.length-1]; this.length = Math.max(this.length-1,0); return firstElement; } Array.prototype.pop = array_pop; }