-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 ) {
- if ( !url ) {
- ret = type.onComplete;
- var onSuccess = type.onSuccess;
- var onError = type.onError;
- data = type.data;
- url = type.url;
- type = type.type;
- }
-
- 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');
-
- /* Borrowed from Prototype:
- * 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
- }
-
- if ( ( xml.status && ( xml.status >= 200 && xml.status < 300 ) || xml.status == 304 ) ||
- !xml.status && location.protocol == 'file:' ) {
- if ( onSuccess )
- onSuccess( xml );
- } else if ( onError ) {
- onError( xml );
- }
-
- // Process result
- if ( ret )
- ret(xml);
- }
- };
-
- xml.send(data)
- }
-};
-
-$.httpData = function(r,type) {
- return r.getResponseHeader("content-type").indexOf("xml") > 0 || type == "xml" ?
- r.responseXML : r.responseText;
-};
-
-$.get = function( url, ret, type ) {
- $.xml( "GET", url, null, function(r) {
- if ( ret ) { ret( $.httpData(r,type) ); }
- });
-};
-
-$.getXML = function( url, ret ) {
- $.get( url, ret, "xml" );
-};
-
-$.post = function( url, data, ret, type ) {
- $.xml( "POST", url, $.param(data), function(r) {
- if ( ret ) { ret( $.httpData(r,type) ); }
- });
-};
-
-$.postXML = function( url, data, ret ) {
- $.post( url, data, ret, "xml" );
-};
-
-$.param = function(a) {
- var s = [];
- if (a && typeof a == 'object' && a.constructor == Array) {
- for ( var i=0; i < a.length; i++ ) {
- s[s.length] = a[i].name + "=" + encodeURIComponent( a[i].value );
- }
- } else {
- for ( var j in a ) {
- s[s.length] = j + "=" + encodeURIComponent( a[j] );
- }
- }
- return s.join("&");
-};
-
-$.fn.load = function(a,o,f) {
- // Arrrrghhhhhhhh!!