-};
-
-// If Mozilla is used
-if ( $.browser == "mozilla" || $.browser == "opera" ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", $.ready, null );
-
-// If IE is used, use the excellent hack by Matthias Miller
-// http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
-} else if ( $.browser == "msie" ) {
-
- // Only works if you document.write() it
- document.write('<scr' + 'ipt id=__ie_init defer=true ' +
- 'src=javascript:void(0)><\/script>');
-
- // Use the defer script hack
- var script = document.getElementById('__ie_init');
- script.onreadystatechange = function() {
- if ( this.readyState == 'complete' ) {
- $.ready();
- }
- };
-
- // Clear from memory
- script = null;
-
-// If Safari is used
-} else if ( $.browser == "safari" ) {
- $.$$timer = setInterval(function(){
- if ( document.readyState == "loaded" ||
- document.readyState == "complete" ) {
-
- clearInterval( $.$$timer );
- $.$$timer = null;
-
- $.ready();
- }
- }, 10);
-}
-
-// A fallback, that will always work, just in case
-$.event.add( window, "load", $.ready );
-
-/**
- * Bind a function to fire when the DOM is ready.
- */
-$.fn.ready = function(f) {
- if ( $.$$isReady ) {
- $.apply( document, f );
- } else {
- if ( ! $.$$ready ) {
- $.$$ready = [];
- }
-
- $.$$ready.push( f );
+});
+
+new function(){
+ /*
+ * Bind a number of event-handling functions, dynamically
+ */
+ var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," +
+ "submit,keydown,keypress,keyup,error").split(",");
+
+ // Go through all the event names, but make sure that
+ // it is enclosed properly
+ for ( var i = 0; i < e.length; i++ ) new function(){
+
+ var o = e[i];
+
+ // Handle event binding
+ jQuery.fn[o] = function(f){
+ return f ? this.bind(o, f) : this.trigger(o);
+ };
+
+ // Handle event unbinding
+ jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };
+
+ // Finally, handle events that only fire once
+ jQuery.fn["one"+o] = function(f){
+ // Attach the event listener
+ return this.each(function(){
+
+ var count = 0;
+
+ // Add the event
+ jQuery.event.add( this, o, function(e){
+ // If this function has already been executed, stop
+ if ( count++ ) return;
+
+ // And execute the bound function
+ return f.apply(this, [e]);
+ });
+ });
+ };
+