function ed_trafficeAttribution ()
{
    
	
	this.sMyCookieName="ed_trafficAttribution";
	this.sMyCustVarName="firstVisitor";
	this.sMyCustVarSlot=1;
	this.sMyCustVarSeperator="~";
	this.iExpireDate=6 * 30 * 24 * 60 * 60 * 1000;
		
	this.prePageView = function ()
	{
		
		var sHilfsCookie=this.ed_getCookie(this.sMyCookieName);

		
		
		//Ist das Hilfscookie vorhanden?
		if(sHilfsCookie==null)
		{

                    var sUtmz=this.ed_getCookie("__utmz");
                    if(sUtmz==null)
                    {

			//Nein: kein Hilfscookie vorhanden, erster Besuch erste Page
			//UserVar auf undefined setzen
			//var oTracker=_gat._getTracker(this.sGaId);
                        var oTracker=_gat._getTrackerByName();
			oTracker._setCustomVar(
                                                      this.sMyCustVarSlot,           					// This custom var is set to slot #1
                                                      this.sMyCustVarName,           					// The top-level name for your online content categories
                                                      'bouncer',      							// Sets the value of "Section" to "Life & Style" for this particular aricle
                                                      1                    						// Sets the scope to page-level
                                               );
                    }
                    else
                    {
                        //Besucher war bereits auf dieser Seite, für uns ist es aber das erste mal. Besucher ignorieren.
                        var oTracker=_gat._getTrackerByName();
			oTracker._setCustomVar(
                                                  this.sMyCustVarSlot,           					// This custom var is set to slot #1
                                                  this.sMyCustVarName,           					// The top-level name for your online content categories
                                                  'preStart',      							// Sets the value of "Section" to "Life & Style" for this particular aricle
                                                  1                    							// Sets the scope to page-level
                                               );


                        var oExpireDate = new Date();
			var iExpireDate = oExpireDate.getTime() + (this.iExpireDate);
			oExpireDate.setTime(iExpireDate);
			document.cookie = this.sMyCookieName+"=ok; expires=" + oExpireDate.toGMTString();
                    }

		}
		else
		{
		
			//Ja Hilfscookie vorhanden
			
			//Wurde die ganze Aktion bereits abgeschlossen?			
			if(sHilfsCookie!="ok")
			{
				//Nein es wurde noch kein Wert in die UserVar geschrieben
				var sMedium = this.getUtmzVar(sHilfsCookie,"utmcmd");
				var sSource = this.getUtmzVar(sHilfsCookie,"utmcsr");
				
				//Die Informationen aus dem Hilfsccokie in die UserVar schreiben
				//var oTracker=_gat._getTracker(this.sGaId);
                                var oTracker=_gat._getTrackerByName();
				oTracker._setCustomVar(
										  this.sMyCustVarSlot,           					// This custom var is set to slot #1
										  this.sMyCustVarName,           					// The top-level name for your online content categories
										  sMedium+this.sMyCustVarSeperator+sSource,      	// Sets the value of "Section" to "Life & Style" for this particular aricle
										  1                    								// Sets the scope to page-level
									   ); 
				
				
			}
			
			//Das Hilfscookie auf ok setzen -> alles abgeschlossen und das expire auf in 6 Monaten setzen (daher auch setzen wenn schon vorhanden.)
			var oExpireDate = new Date();
			var iExpireDate = oExpireDate.getTime() + (this.iExpireDate);
			oExpireDate.setTime(iExpireDate);
			document.cookie = this.sMyCookieName+"=ok; expires=" + oExpireDate.toGMTString();
			
		}
		
	}
	
	this.postPageView = function ()
	{
	
		var sHilfsCookie=this.ed_getCookie(this.sMyCookieName);
		var sUTMZCookie=this.ed_getCookie("__utmz");
	
		
		//Ist das Hilfscookie vorhanden?
		if(sHilfsCookie==null)
		{
			//Nein: kein Hilfscookie vorhanden, erster Besuch erste Page
			
			//Der Wert aus dem utmz Cookie in das Hilfs Cookie schreiben.
			var oExpireDate = new Date();
			var iExpireDate = oExpireDate.getTime() + (this.iExpireDate);
			oExpireDate.setTime(iExpireDate);
			document.cookie = this.sMyCookieName+"="+sUTMZCookie+"; expires=" + oExpireDate.toGMTString();
		}
	}
	
	/**
	* BLA bla
	*/
	this.ed_getCookie = function (sCookieName)
	{	
		oRegEx = new RegExp(sCookieName+"=([^;]+)");
		if(oRegEx.exec(document.cookie)==null)
		{
			return null
		}
		else
		{
			return oRegEx.exec(document.cookie)[1];
		}
    }

	this.getUtmzVar = function (sUtmz,sVarname)
	{
		oRegEx = new RegExp(sVarname+"=([^\\||;]+)");
		return oRegEx.exec(sUtmz)[1];
	}	
	
}





