Ajax = {
	Version: 0.7, 

	httpObject: function() {
		if (typeof(XMLHttpRequest) != 'undefined') { 
			return new XMLHttpRequest(); 
		}
		
		try { 
			return new ActiveXObject('Msxml2.XMLHTTP'); 
		} catch (e) { 
			try { 
				return new ActiveXObject('Microsoft.XMLHTTP'); 
			} catch (e) {}
		}

		return false;
	},

	httpRequest: function(url, RS, method, peram) {
		var http = this.httpObject();
		method = method || 'GET';

		if (method == 'GET') {
			http.open('GET', url, true);
		} else {
			http.open('POST', url, true);
			http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			http.setRequestHeader('Content-length', peram.length);
			http.setRequestHeader('Connection', 'close');
		}

		if (typeof(RS) == 'object') {
			if (typeof(RS.init) == 'function')
				RS.init();

			http.onreadystatechange = function() {
				if (http.readyState == 4 && RS.complete) {
					if (http.status == 200)
						RS.complete(http.responseText);

					if (http.status == 200 && typeof(RS.error) == 'function')
						RS.error();
				}
			}
		}

		http.send((peram) ? peram : null);
	},

	update: function(element, url, ev) {
		element = (typeof(element) == 'object') ? element : document.getElementById(element);

		this.HTTPRequest(url, {
			complete: function(text) {
				element.innerHTML = text;

				if (typeof(ev) == 'function')
					ev();
			}
		});
	}
}
