
	function Ajax($file,$method,$testmode) {
		this.xmlHttp = null;
		this.result = null;
		this.url = typeof($file) != 'undefined' ? server + '/' + $file : '';
		this.method = typeof($method) != 'undefined' ? $method.toUpperCase() : 'GET';
		this.testmode = typeof($testmode) != 'undefined' && $testmode ? true : false;

		try {	// Firefox, Opera 8.0+, Safari
			this.xmlHttp = new XMLHttpRequest();
		}
		catch($e) {
			try {	// Internet Explorer
				this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch($e) {
				try {	// Weitere Browser
					this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch($e) {
					alert('Der Browser unterstützt leider kein Ajax.');
					this.xmlHttp = false;
				}
			}
		}

		this.set_url = function($file) {
			this.url = server + '/' + $file;
		};

		this.set_method = function($method) {
			this.method = $method;
		};

		this.query = function($params,$callback) {
			var $class = this;
			$params = typeof($params) != 'undefined' ? $params : '';
			if($class.url) {
				$class.xmlHttp.onreadystatechange = function() {
					if($class.xmlHttp.readyState == 4) {
						if($class.xmlHttp.responseText) {
							$class.result = $class.xmlHttp.responseText;
							$callback();
						}
					}
				};

				$post_params = '';

				if($params) {
					if($class.method.toLowerCase() == 'post') {
						$post_params = $params;
					}
					else {
						$class.url += '?' + $params;
					}
				}
				if(this.testmode) {
					alert($class.url);
				}
				$class.xmlHttp.open($class.method,$class.url,true);

				if($class.method.toLowerCase() == 'post') {
					$class.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					$class.xmlHttp.setRequestHeader("Content-length", $post_params.length);
					$class.xmlHttp.setRequestHeader("Connection", "close");
				}

				$class.xmlHttp.send($post_params);
			}
		};
	}
