// This values can be overwritten at affilate script-snippet!!!
// Do not modify anything in this script!!!

var ad_af = ''; // affiliate-id
var ad_baseDomain = ''; // domain for cookie, empty = default, set .domain.tld for all subdomains and domain, too
var ad_last_adServer = '';
var ad_rc = ""; // Region Code, e.g. 7 for NRW (GER)
var ad_cc = "10"; // 10 = Germany
var ad_cc_shortcut = "DE"; // Germany Shortcut
var ad_server_base = "ad.fussball-infoservice.de/js/";
var ad_server = '';
var ad_containerPrefix = 'wac_';
var ad_category = '';
var ad_mark = '';

function ad_init()
{
	now = new Date();
	var cacheBreaker = now.getTime();
	var proto;
	
	if (document.location.protocol=='https:')
	{
		proto = 'https://';
	}
	else
	{
		proto = 'http://';
	}
	ad_server = proto+ad_server_base+"mkad.js.php";
	ad_server += "?af="+ad_af+"";
	ad_server += "&amp;no_cache="+cacheBreaker;
	
//	var cookieVal = ad_readCookie("ad_control_"+ad_af);
//	if (cookieVal != null)
//	{
//		ad_server += "&amp;ad_control="+escape(cookieVal);
//	}
	if (document.referrer)
	{
		ad_server += "&amp;ref="+escape(document.referrer);
	}
	if (ad_baseDomain)
	{
		ad_server += "&amp;base="+escape(ad_baseDomain);
	}

	// new click counter
	var clickCookieVal = ad_readCookie("ad_control_"+ad_af+"_counter");
	if (clickCookieVal != null)
	{
		clickCookieVal++;
		ad_createCookie("ad_control_"+ad_af+"_counter",clickCookieVal,1,'');
		ad_server += "&amp;cc="+escape(clickCookieVal);
	}
	else
	{
		ad_createCookie("ad_control_"+ad_af+"_counter",1,1,'');
		var clickCookieChkVal = ad_readCookie("ad_control_"+ad_af+"_counter");
		if (clickCookieChkVal != null)
		{
			ad_server += "&amp;cc=1";
		}
		else
		{
			// no cookies accepted
			ad_server += "&amp;cc=0";
		}
	}
	// click counter end
	
	var initServer;
	initServer = proto+ad_server_base+"init.js.php";
	initServer += "?af="+ad_af+"";
	if (ad_active == 1)
	{
		document.write('<scr'+'ipt src="'+initServer+'"></scr'+'ipt>');
	}

}

function ad_load_manager()
{
	if (ad_active == 1)
	{
		document.write('<scr'+'ipt type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"><'+'/scr'+'ipt>');
	}
}

function ad_activate(site_id)
{
	if (ad_active == 1)
	{
		GS_googleAddAdSenseService(site_id);
		GS_googleEnableAllServices();
	}
}

function ad_fetch()
{
	if (ad_active == 1)
	{
		GA_googleFetchAds();
	}
}

function ad_fill(ad_id)
{
	if (ad_active == 1)
	{
		GA_googleFillSlot(ad_id);
	}
}

function ad_slot(site_id, ad_id)
{
	if (ad_active == 1)
	{
		GA_googleAddSlot(site_id, ad_id);	
	}
}

function ad_createCookie(name,value,days,domain)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	if (domain)
	{
		var domainAd ="; domain="+domain;
	}
	else var domainAd = "";
	document.cookie = name+"="+value+expires+domainAd+"; path=/";
}

function ad_readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function ad_eraseCookie(name)
{
	ad_createCookie(name,"",-1);
}

function ad_at(ad_id)
{
//	document.write(ad_id);
	if (ad_id > 0)
	{
		var m3_u = (location.protocol=='https:'?'https://ads.clubportal.at/www/delivery/ajs.php':'http://ads.clubportal.at/www/delivery/ajs.php');
		var m3_r = Math.floor(Math.random()*99999999999);
		if (!document.MAX_used) document.MAX_used = ',';
		document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
		document.write ("?zoneid="+ad_id+"&amp;target=_blank");
		document.write ('&amp;cb=' + m3_r);
		if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
		document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
		document.write ("&amp;loc=" + escape(window.location));
		if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
		if (document.context) document.write ("&context=" + escape(document.context));
		if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
		document.write ("'><\/scr"+"ipt>");	
	}
}


