	if(document.location.search != ''){
	var pURL = document.location.search
	var url = String(window.location);
	//alert('cookie');
}
else {
}

if(!pURL){
	//alert('no cookie');
	}
else {
	var undef = url.split("?");
	
	var args = undef[1].split("&");
	for(i = 0; i<args.length; i++) {
		var a = args[i].split("=");
		if (a[0].toUpperCase() == "SP2ID") {
			createCookie( "_LAST",a[0],60);
			createCookie( "_LASTVALUE",a[1],60);
			createCookie( "_SP2ID",a[1],60);			
			var sp2id = a[1];
			//ZED Digital (Spotlighttag)
		}		
		 if (a[0].toUpperCase() == "AFID") {
			createCookie( "_LAST",a[0],60);
			createCookie( "_LASTVALUE",a[1],60);
			createCookie( "_AFID",a[1],60);			
			var afid = a[1];
			//Affilinet			
		}
		if (a[0].toUpperCase() == "ZXID") {
			createCookie( "_LAST",a[0],60);
			createCookie( "_LASTVALUE",a[1],60);
			createCookie( "_ZXID",a[1],60);
			var zxid = a[1];
			//Zanox				
		}
		if (a[0].toUpperCase() == "MGMREFID") {
			createCookie( "_LAST",a[0],60);
			createCookie( "_LASTVALUE",a[1],60);
			createCookie( "_MGMREFID",a[1],60);			
			var mgm = a[1];
			//MGM-Freundschaftswerbung				
		}
		if (a[0].toUpperCase() == "M1ID") {
			createCookie( "_LAST",a[0],60);
			createCookie( "_LASTVALUE",a[1],60);
			createCookie( "_M1ID",a[1],60);			
			var mgm = a[1];
			//Mission one 1				
		}
		if (a[0].toUpperCase() == "M1LID") {
			createCookie( "_LAST",a[0],60);
			createCookie( "_LASTVALUE",a[1],60);
			createCookie( "_M1LID",a[1],60);			
			var mgm = a[1];
			//Mission one 2				
		}
	}
	
}





function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function find_id(url)
{
		var val = url.split("?");
		var nval = val[1].split("=");
		var value = nval[1];
		return value;
	}