function ajaxClass () {
	this.xmlHttpObject = null;
	this.method		= "POST";
	this.type		= "Text";
	this.async		= true;
	this.parameter 	= "";
	this.path 		= "";
	this.success 	= function() {}
	this.failure 	= function() {}
	this.preloader 	= function() {}
	this.onTimeout	= function() {}
	this.timeout = 0; 
	
	//////////////////////////////////////////////////////////////////////////////

	var self = this; 
	this.timer;

	this.initXmlHttpObject = function() {
		if (typeof XMLHttpRequest != 'undefined') {
			this.xmlHttpObject = new XMLHttpRequest();
		}
		if (!this.xmlHttpObject) {
			try {
				this.xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e) {
				try {
					this.xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e) {
					this.xmlHttpObject = null;
				}
			}
		}
	}

	this.loadContent = function() {
		this.method = this.method.toLowerCase();
		this.type = this.type.toLowerCase();

		this.initXmlHttpObject();
		this.preloader('init');
		var method 		= this.method;
		var parameter 	= this.parameter + '&ajax_timestamp=' + this.makeTimestamp() + '&content_type=' + (this.type == 'text' ? 'text/plain' : 'text/xml');
		var path 		= this.path + ((method == "get") ? parameter : '');
		if(this.timeout) {
			this.timer = window.setTimeout(
				function() {
					self.xmlHttpObject.abort();
					self.preloader('del');
					self.onTimeout();
				}, 
				this.timeout
			);
		}
		this.xmlHttpObject.onreadystatechange = this.handleContent;
		this.xmlHttpObject.open(method, path, this.async);
		if (method == 'post') {
			this.xmlHttpObject.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
			this.xmlHttpObject.setRequestHeader( 'Content-length', parameter.length );
		}
		this.xmlHttpObject.send((method == "post") ? parameter : null);
		if(!this.async) {
			if (this.type == 'text') {
				this.success(this.xmlHttpObject.responseText);
			}
			else if (this.type == 'xml') {
				this.success(this.xmlHttpObject.responseXML);
			}
		}
	}
	
	this.handleContent = function() { 
		//debug.innerHTML += "xmlHttpObject.readyState = " + self.xmlHttpObject.readyState + (self.xmlHttpObject.readyState >= 3 ? " HTTP-Status = " + self.xmlHttpObject.status : '') + '<br>';
		if (self.xmlHttpObject.readyState == 4) {
			if(self.timeout) {
				window.clearTimeout(self.timer);
			}
			self.preloader('del');
			if (self.xmlHttpObject.status == 200) {
				var type = self.type.toLowerCase();
				if (type == 'text') {
					self.success(self.xmlHttpObject.responseText);
				}
				else if (type == 'xml') {
					self.success(self.xmlHttpObject.responseXML);
				}
				// perfekt!
			} else {
				self.failure();
				//alert(self.xmlHttpObject.status);
				// die Antwort war z.B. 404 (nicht gefunden)
				// oder 500 (interner Server-Fehler)
			}
		}
	}
	
	this.makeTimestamp = function() {
		var now 	= new Date();
		return now.getTime();			
	}
}

/*

++++ Einbinden: ++++

var ajaxObj = new ajaxClass();

//// Erforderliche Parameter /////////////////////////////////////

ajaxObj.parameter 	= 'ajax=content&' + req;
ajaxObj.path 		= 'hauptseite/produkt_navi.inc.php';

ajaxObj.success = function(content) {
	//// Beliebiger Code zum Verarbeiten der Antwort 'content' ////
}

//// Optionale Parameter //////////////////////////////////////////

ajaxObj.method 		= 'get';		// Standard ist 'POST'
ajaxObj.type 		= 'XML';		// Standard ist 'Text'

ajaxObj.failure = function() { 
	// Beliebiger Code bei Fehlschlagen des Requests //
}
ajaxObj.preloader = function(mod) { 
	switch(mod) {
		case 'init':
			//// Beliebiger Code zum Initialisieren des Preloaders ////
			break;
		case 'del':
			//// Beliebiger Code zum Entfernen des Preloaders ////
	}
}
ajaxObj.onTimeout = function() { 
	// Beliebiger Code bei Fehlschlagen des Requests //
}
//////////////////////////////////////////////////////////////////

ajaxObj.loadContent();

*/


