var AJAX = {
	getSynch : function(url, command, params){
		return AJAX.request("GET", url, command, params, false);
	},
	
	get : function(url, command, params){
		AJAX.request("GET", url, command, params, true);
	},
	
	post : function(url, command, params){
		AJAX.request("POST", url, command, params, true);
	},
	
	request : function(type, url, command, params, async)
	{
		var http_request = false;
		if(window.XMLHttpRequest) {
			http_request = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					// misschien error ofzo
				}
			}
		}
		
		if (!http_request) {
			// error?
			return false;
		}
		
		if (async){
			http_request.onreadystatechange = function() { 
				AJAX.handle(http_request, command, params); 
			};
		}
		
		http_request.open(type, url, async);
		if(type == "POST") {
			http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		}
		
		http_request.send(null);
		
		if (!async){
			try {
				return http_request.responseText;
			}catch(ex){throw ex;}
		}
	},
	
	handle : function(http_request, command, params)
	{
		if(http_request.readyState == 4){
			if(http_request.status == 200){
				if(http_request.responseText != -1){
					if(command){
						command(http_request.responseText, params);
					}
				}
			} else {
				// error?
			}
		}
	},
	
	show : function(content)
	{
		alert(content);
	},
	
	replaceContent : function(content, params)
	{
		document.getElementById(params.id).innerHTML = content;
	},

	appendContent : function(content, params)
	{
		document.getElementById(params.id).innerHTML = document.getElementById(params.id).innerHTML + content;
	}
}