-if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'function') {
- XMLHttpRequest = function() {
- return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') >= 0) ?
- "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
- };
-}
-
-// Counter for holding the active query's
-$.xmlActive=0;
-
-$.xml = function( type, url, data, ret ) {
- var xml = new XMLHttpRequest();
-
- if ( xml ) {
- // Open the socket
- xml.open(type || "GET", url, true);
- if ( data )
- xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
-
- // Set header so calling script knows that it's an XMLHttpRequest
- xml.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
-
- /* Force "Connection: close" for Mozilla browsers to work around
- * a bug where XMLHttpReqeuest sends an incorrect Content-length
- * header. See Mozilla Bugzilla #246651.
- */
- if ( xml.overrideMimeType )
- xml.setRequestHeader('Connection', 'close');
-
- xml.onreadystatechange = function() {
- // Socket is openend
- if ( xml.readyState == 1 ) {
- // Increase counter
- $.xmlActive++;
-
- // Show loader if needed
- if ( ($.xmlActive >= 1) && ($.xmlCreate) )
- $.xmlCreate();
- }
-
- // Socket is closed and data is available
- if ( xml.readyState == 4 ) {
- // Decrease counter
- $.xmlActive--;
-
- // Hide loader if needed
- if ( ($.xmlActive <= 0) && ($.xmlDestroy) ) {
- $.xmlDestroy();
- $.xmlActive = 0
- }
-
- // Process result
- if ( ret )
- ret(xml);
- }
- };
-
- xml.send(data)
+/**
+ * Load HTML from a remote file and inject it into the DOM
+ */
+$.fn.load = function( url, params, callback ) {
+ // I overwrote the event plugin's .load
+ // this won't happen again, I hope -John
+ if ( url && url.constructor == Function )
+ return this.bind("load", url);
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params ) {
+ // If it's a function
+ if ( params.constructor == Function ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else {
+ params = $.param( params );
+ type = "POST";
+ }