function ASS(charset) {
	this.READY_STATE_UNINITIALIZED=0;
	this.READY_STATE_LOADING=1;
	this.READY_STATE_LOADED=2;
	this.READY_STATE_INTERACTIVE=3;
	this.READY_STATE_COMPLETE=4;
	this.xRequest = null;
	if (window.XMLHttpRequest) {
		this.xRequest = new window.XMLHttpRequest();
	} else if (typeof ActiveXObject != 'undefined') {
		try {
			this.xRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			this.xRequest = new ActiveXObject("Msxml2.DOMDocument");
		}
	}
	this.xRequest.onreadystatechange = onReadyState;
	if (this.xRequest != null) return 1; else return 0;
}


ASS.prototype.sendRequest = function(HTTPMethod, backend, charset, dataArray) {
	if (this.xRequest.readyState>0) this.xRequest.abort();
	if (this.xRequest) {
		var request = '';
		for (i=0; i<dataArray.length; i++) request += dataArray[i][0] + '=' + encodeURIComponent(dataArray[i][1]) + '&';
		if (request) request = request.substring(0, request.length-1);
		if (HTTPMethod=='GET') backend = backend + '?' + request;
		this.xRequest.open(HTTPMethod, backend, true);;
		//this.xRequest.setRequestHeader("Content-Type", "text/html; charset=" + charset);
		if (HTTPMethod == 'POST') {
			this.xRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			this.xRequest.setRequestHeader("Content-Length", request.length);
			this.xRequest.setRequestHeader("Connection", "close");
		}
		this.xRequest.send((HTTPMethod == 'POST')? request: null);
	}
}
