function	js_fetch(method) {




	//----------------------------------------------------------------------------
	// Vars
	this.fetcher			= false;
	this.fetch_method		= method;
	this.fetch_url			= false;
	this.error				= '';
	this.result				= '';
	this.httpstatus			= 0;
	
	this._params			= new Array();
	this._events			= new Array();
	this._initialized		= false;
	this._contentBody		= '';
	this._AdditionalURL		= "";


	//----------------------------------------------------------------------------
	// Cross-browser XMLHttpRequest support
	// I'll try to be more portable later
	//----------------------------------------------------------------------------
	if (typeof(XMLHttpRequest) == 'undefined') {
		// IExplore (or any ActiveX browser which does not have a XMLHttpRequest object)
		if (typeof(ActiveXObject) != 'undefined') {
			window.XMLHttpRequest = function () {
				var		ActiveXControl = false;

				/* Using IExplore JScript support if we can use the ActiveX object
				@cc_on
				@if (@_jscript_version >= 5)
				try {
				ActiveXControl = new ActiveXObject("Msxml2.XMLHTTP");
				return (ActiveXControl);
				} catch (e) {
				try {
				ActiveXControl = new ActiveXObject("Microsoft.XMLHTTP");
				return (ActiveXControl);
				} catch (error) {
				ActiveXControl = false;
				this.error = 'Your browser does not support XMLHttpRequest objects or XMLHTTP ActiveX objects';
				return (false);
				}
				}
				@end
				*/
				// No JScript ?
				ActiveXControl = new ActiveXObject("Microsoft.XMLHTTP");
				if (ActiveXControl) {
					return (ActiveXControl);
				} else {
					this.error = 'Please use a JScript compatible version of your browser';
					return (false);
				}

			}

		}
		// Opera
		// This should be fully implemented from Opera 7.60, if lower, no way
		// You can use http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
		// I refuse to use it (very bad license)
		if (window.opera && !window.XMLHttpRequest) {
			window.XMLHttpRequest = function () {
				this.error = 'You need at least Opera 7.60 to use js_fetch library';
				return (false);
			}
		}
		// I'll try to operate on more browser later
	}








	//----------------------------------------------------------------------------
	// Init
	//----------------------------------------------------------------------------
	this.init					= function () {

		if (this._fetch_ctor() != false) {
			return (true);
		} else {
			return (false);
		}
	}
	//----------------------------------------------------------------------------
	// Add post/get element variable
	//----------------------------------------------------------------------------
	this.add_param				= function (Name, Value) {
		if (!this._initialized) {
			this.error = "Object is not Initialized, use init()";
			return (false);
		}
		this._params[Name] = Value;
		return (true);
	}
	//----------------------------------------------------------------------------
	// Send the request
	//----------------------------------------------------------------------------
	this.go						= function (url) {
		if (!this._initialized) {
			this.error = "Object is not Initialized, use fetch_init";
			return (false);
		}
		
		if (this.fetch_method == "POST") {
			this._prepare_post();
			this._go_post(url);
		} else {
			this._prepare_get();
			this._go_get(url);
		}
		return (true);
	}
	//----------------------------------------------------------------------------
	// Set handler
	//----------------------------------------------------------------------------
	this.set_handler			= function (func) {
		if (!this._initialized) {
			this.error = "Object is not Initialized, use fetch_init";
			return (false);
		}
		this.fetcher.onreadystatechange = func;
		return (true);
	}
	//----------------------------------------------------------------------------
	// Get Status (XMLHttpRequest)
	//----------------------------------------------------------------------------
	this.get_state				= function () {
		if (!this._initialized) {
			this.error = "Object is not Initialized, use fetch_init";
			return (-1);
		}
		return (this.fetcher.readyState);
	}
	//----------------------------------------------------------------------------
	// Get Result
	//----------------------------------------------------------------------------
	this.result				= function () {
		if (!this._initialized) {
			this.error = "Object is not Initialized, use fetch_init";
			return (-1);
		}
		if (this.fetcher.readyState == 4) {
			this.result = this.fetcher.responseText;
			this.httpstatus = this.fetcher.status;
			return (this.result);
		} else {
			return ("");
		}
	}















	//----------------------------------------------------------------------------
	// Create the object
	//----------------------------------------------------------------------------
	this._fetch_ctor			= function () {

		if (typeof(XMLHttpRequest) != 'undefined') {
			this.fetcher = new XMLHttpRequest();
			if (this.fetcher) {
				if (this.fetch_method.toLowerCase() == 'post') {
					this.fetch_method = "POST";
				} else {
					this.fetch_method = "GET";
				}
				this._initialized = true;
				return (true);
			} else {
				return (false);
			}
		}
		return (false);
	}
	//----------------------------------------------------------------------------
	// Prepare post
	//----------------------------------------------------------------------------
	this._prepare_post			= function () {

		this._contentBody = '';
		for (i in this._params) {
			this._contentBody += encodeURI(i);
			this._contentBody += '=';
			this._contentBody += encodeURI(this._params[i]);
			this._contentBody += '&';
		}
		if (this._contentBody.substr(this._contentBody.length - 1, 1) == '&') {
			this._contentBody = this._contentBody.substr(0, this._contentBody.length - 1);
		}
		
	}
	//----------------------------------------------------------------------------
	// Go POST
	//----------------------------------------------------------------------------
	this._go_post			= function (url) {
	  if (url) {
		this.fetcher.open("POST", url, true);
		this.fetcher.setRequestHeader("X-Powered-by", "js_fetch Lib");
		this.fetcher.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		this.fetcher.setRequestHeader("Content-Length", this._contentBody.length);
		this.fetcher.send(this._contentBody);
	  }
	}
	//----------------------------------------------------------------------------
	// Prepare Get
	//----------------------------------------------------------------------------
	this._prepare_get			= function () {

		this._AdditionalURL = '';
		for (i in this._params) {
			this._AdditionalURL += encodeURI(i);
			this._AdditionalURL += '=';
			this._AdditionalURL += encodeURI(this._params[i]);
			this._AdditionalURL += '&';
		}
		if (this._AdditionalURL.substr(this._AdditionalURL.length - 1, 1) == '&') {
			this._AdditionalURL = this._AdditionalURL.substr(0, this._AdditionalURL.length - 1);
		}
	}
	//----------------------------------------------------------------------------
	// Go GET page
	//----------------------------------------------------------------------------
	this._go_get			= function (url) {

		if (url.indexOf("?") == -1) {
			url += "?" + this._AdditionalURL;
		} else {
			url += "&" + this._AdditionalURL;
		}
		this.fetcher.open("GET", url, true);
		this.fetcher.setRequestHeader("X-Powered-by", "js_fetch Lib");
		this.fetcher.send("");
	}
















}
