Object.extend(Event, {
   _domReady : function() {
       if (arguments.callee.done) return;
       arguments.callee.done = true;
              if (Event._timer) clearInterval(Event._timer);
              Event._readyCallbacks.each(function(f) { f() });
       Event._readyCallbacks = null;
   },
   onReady : function(f) {
       if (!this._readyCallbacks) {
           var domReady = this._domReady;
                  if (domReady.done) return f();
                  if (document.addEventListener)
           document.addEventListener("DOMContentLoaded", domReady, false);
           if (/WebKit/i.test(navigator.userAgent)) {
               this._timer = setInterval(function() {
                   if (/loaded|complete/.test(document.readyState)) domReady();
               }, 10);
           }
           Event.observe(window, 'load', domReady);
           Event._readyCallbacks = [];
       }
       Event._readyCallbacks.push(f);
   }
}); 

Array.prototype.remove = function(object) {
	var index = this.indexOf(object, 0, this.length);
	if (index == 0) {
		this.shift();
	} else {
		this.splice(index, 1);
	}
}


