			var STATE_NONE 		= 0;
			var STATE_LOADING 	= 1;
			var STATE_LOADED	= 2;
			var STATE_PROGRESS 	= 3;
			var STATE_READY		= 4;
			
			var EVENT_START		= 'event_1';
			var EVENT_UPDATE	= 'event_2';
			var EVENT_COMPLETE	= 'event_3';
			var EVENT_ERROR		= 'event_4';
			var EVENT_CHANGE	= 'event_5';
		
			if(!Function.prototype.bind)
			{
				Function.prototype.bind = function()
				{
					var method = this, args = new Array(), object, x;
	
					for(x=0; x < arguments.length; ++x)
					{
						if(x > 0)
						{
							args.push(arguments[x]);
							continue;
						}
						object = arguments[x];
					}
	
					return function()
					{
						return method.apply(object, args);
					};
				};
			}
			
			function AJAXRequest()
			{
				this.objXML 		= null;
				this.intInterval 	= null;
				this.strURL 		= '';
				this.strMethod		= 'GET';
				this.running	 	= false;
				this.objEvents 		= {};
				this.intLastStatus  = STATE_NONE;
				this.timer;
				this.Picture = '';

				this.constructor = function(url, method)
				{
					if(url != undefined && url != '') this.strURL = url;
					if(method != undefined && method != '') this.strMethod = method;
				}

				this.setURL = function(strURL)
				{
					if(strURL != undefined && strURL != '')
					{
						this.strURL = strURL;
					}
				}

				this.load = function()
				{
					if(this.strURL == '') return null;

					this.intInterval = setInterval(this.exec.bind(this), 10);

					if(window.ActiveXObject)
					{
						try
						{
							this.objXML = new ActiveXObject("Msxml2.XMLHTTP");
						}
						catch (e)
						{
							try
							{
								this.objXML = new ActiveXObject("Microsoft.XMLHTTP");
							} catch (e) {}
						}
					}
					else if(window.XMLHttpRequest)
					{
						this.objXML = new XMLHttpRequest();						
					}

					/*
						if(this.objXML.overrideMimeType)
						{
							this.objXML.overrideMimeType('text/xml; charset=ISO-8859-1');
						}
					*/
					try
					{
						this.objXML.open(this.strMethod, this.strURL, true);
//						this.objXML.setRequestHeader("Content-Type", "application/json charset=ISO-8859-1");
						this.objXML.setRequestHeader("Pragma", "no-cache");
 						this.objXML.setRequestHeader("Cache-Control", "must-revalidate");
 						this.objXML.setRequestHeader("If-Modified-Since", 0);
						this.objXML.send(null);
						
						this.dispatchEvent(EVENT_START);

						this.running = true;
						this.timer	 = new Date();
					}
					catch(exception)
					{
						this.stop();
						this.dispatchEvent(EVENT_ERROR, exception);
					}
				};

				this.exec = function()
				{
					try
					{
						if(this.intLastStatus != this.objXML.readyState)
						{
							this.intLastStatus = this.objXML.readyState;

							this.dispatchEvent(EVENT_CHANGE);
						}
						this.dispatchEvent(EVENT_UPDATE);
						this.dispatchEvent(this.objXML.readyState);
	
						if(this.objXML.readyState == STATE_READY)
						{
							this.timer = (new Date()).getTime() - this.timer.getTime();
							this.stop();

							this.dispatchEvent(EVENT_COMPLETE);
						}
					}
					catch(exception)
					{
						this.stop();
						this.dispatchEvent(EVENT_ERROR, exception);
					}
				};

				this.stop = function()
				{
					window.clearInterval(this.intInterval);
					this.objXML.abort();
					this.running = false;
				};
				
				this.addEvent = function(strEvent, objOptions)
				{
					if(strEvent != undefined && strEvent != '' && this.objEvents[strEvent] == null)
					{
						this.objEvents[strEvent] = objOptions;
						this.objEvents[strEvent].params = objOptions.params || [];
						this.objEvents[strEvent].scope  = objOptions.scope || this;
					}
				}

				this.dispatchEvent = function(strEvent, strValue)
				{
					if(strEvent != undefined && strEvent != '' && this.objEvents[strEvent] != null)
					{
						if(this.objEvents[strEvent].func != null)
						{
							if(strValue == undefined) strValue = '';

							this.objEvents[strEvent].params.unshift({value:strValue});

							this.objEvents[strEvent].func.apply(this.objEvents[strEvent].scope, this.objEvents[strEvent].params);
						}
					}
				}

				this.isRequestStatus = function(intStatus)
				{
					return (intStatus >= STATE_NONE && intStatus <= STATE_READY);
				}
				this.constructor.apply(this, arguments);
			};
			
			
		/*
					var ajax = new AJAXRequest();
						ajax.addEvent(STATE_READY, {func:function()
						{
							alert(this.strURL +" Inhalt: "+ this.objXML.responseText);
						}});

						ajax.addEvent(EVENT_ERROR, {func:function(evt)
						{
							alert('Fehler: '+ evt.value);
						}});

						ajax.addEvent(EVENT_UPDATE, {func:function(evt)
						{
							document.getElementById('out').innerHTML = document.getElementById('out').innerHTML + ','+ this.objXML.readyState +'['+this.objXML.responseText+']<br><br>';
						}});

						ajax.addEvent(EVENT_COMPLETE, {func:function(evt)
						{
							alert('Ende, das war`s!');
						}});

						ajax.setURL(strURL);
						ajax.load();		
		
		*/	
		
/*==============================================================================
 AB Tests.
==============================================================================*/
var caAB = {};
caAB.tests = [];
caAB.cookieName = 'ab_tst';                                     // Name des AB Test Master Cookies

caAB.isTest=function(){
  if(caGetCookie(caAB.cookieName)=='0,0' || caGetCookie(caAB.cookieName)==''){return false;}
  return true;  
}
caAB.createScriptNode=function(txt,srce,el){
  var scr = document.createElement('script');  
  if(srce){scr.src = srce;}
  scr.type = 'text/javascript';
  if(txt){
    txt = document.createTextNode(txt);
    scr.appendChild(txt);  
  }    
  el.appendChild(scr); 
};

caAB.addRule=function(css){
  var stil = document.styleSheets[document.styleSheets.length-1];
  if(stil){
    var last = stil.cssRules?stil.cssRules.length:stil.rules.length;
    m = css.match(/([^{]+?)\{([^}]*?)\}\s*/); 
    if(m){
      if(stil.insertRule){stil.insertRule(m[0],last);}
      else if(stil.addRule){stil.addRule(m[1],m[2],last);}
    }
  }
};
caAB.init=function(){  
  if(caAB.isTest()){    
    caAB.createScriptNode('','../HtmlAB/Script/ab_all.js',document.getElementsByTagName("head")[0]);
    //caAB.addRule('#container {visibility:hidden;}');  
  }  
}
caAB.init();				