// new Ajax('/_assets/wsdl/php.Search.wsdl', {vars: params, callback: Interface});
Ajax = Class.create();
Ajax.prototype = {

	initialize: function ( url, options, global ) {

		this.__global = global;
		this.__transport = this.__GetTransport();
		this.__vars = options.vars || '';
		this.__method = options.method || 'post';
  this.__callback = options.callback || null;
  this.__request(url);

 },

 __request: function ( url ) {

  this.__transport.open(this.__method, url, true);
  this.__transport.onreadystatechange = this.__onStateChange.bind(this);
  if (this.__method == 'post') {

   this.__transport.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
   if (this.__transport.overrideMimeType) this.__transport.setRequestHeader('Connection', 'close');

  }
  this.__transport.send(this.__vars);

 },

 __onStateChange: function () {

  if (this.__transport.readyState == 4 && this.__transport.status == 200) {

			if (this.__callback) setTimeout(function(){this.__callback(this.__transport, this.__global);}.bind(this), 10);
   this.__transport.onreadystatechange = function(){};

  }

 },

 __GetTransport: function () {

		if (window.XMLHttpRequest) {

   try { return new XMLHttpRequest(); }
   catch (e) { alert('Async.Connection failed to create an XMLHttpRequest object!'); return false; }

		} else if (window.ActiveXObject) {

   try { return new ActiveXObject('Msxml2.XMLHTTP'); }
   catch (e) {

	try { return new ActiveXObject('Microsoft.XMLHTTP'); }
	catch(e) { alert('Async.Connection failed to invoke an MS XMLHttp ActiveXObject!'); return false; }

   }

  } else { alert('Browser does not support the XMLHttpRequest object!'); return false; }

 }

}