// roularta advertising by adhese.com
var adheseCookie;
var previewMode = false;
var previewCreativeId = undefined;
var previewTemplateId = undefined;

function initPage() {
	//check for preview parameter
	if (location.search.indexOf("adhesePreview")!=-1) {
		var p = location.search.substring(1).split("&");
		for (var x=0; x<p.length; x++) {
			if (p[x].split("=")[0]=="adhesePreviewCreativeId") {
				previewCreativeId = p[x].split("=")[1];
				if (previewTemplateId) break;
			}
			if (p[x].split("=")[0]=="adhesePreviewCreativeTemplate") {
				previewTemplateId = p[x].split("=")[1];
				if (previewTemplateId) break;
			}
		}
		createCookie("adhese_preview",previewCreativeId+"&"+previewTemplateId,0);
		previewCreativeId = unescape(previewCreativeId);
		previewMode = true;
		addLoadEvent(showPreviewSign);
	} else if (readCookie("adhese_preview")) {
		var v = readCookie("adhese_preview").split("&");
		previewCreativeId = unescape(v[0]);
		previewTemplateId = v[1];
		previewMode = true;
		addLoadEvent(showPreviewSign);
	}
	addLoadEvent(articleTrack);
}

function showPreviewSign() {
	var p = document.createElement('DIV');
	var msg = "<div onclick='quitAdhesePreview(); return false;' style='font-family:Helvetica,Verdana; font-size:12px; text-align:center; background-color:#000000; color: #ffffff; position:fixed; top:0px; left:6px; padding:4px; border-style:dashed; border:2px; border-color:#000000;'>";
	msg += "<p><b>adhese<br>preview<br>close</b></p></div>";
	p.innerHTML = msg;
	document.body.appendChild(p);
}

function quitAdhesePreview() {
	eraseCookie("adhese_preview");
	location.reload();
}

function initAdhese(templateId) {
	if(typeof(adheseRand) == 'undefined') {
		adheseRand = Math.round(Math.random()*100);
	}
	var l = location.pathname;
	if (l.charAt(0)=='/') l = l.substring(1,l.length);
	if (l.charAt(l.length-1)=='/') l = l.substring(0,l.length-1);
	else l = l.substring(0,l.lastIndexOf('/'));
	var m = l.split('/');
	var loc = "_";
	var c = m.length-1;
	var iframe = false;
	
	//exceptions
	if (location.pathname.indexOf("/fr/publi-")!=-1) {
		m = new Array("fr",location.pathname.substring(location.pathname.indexOf("publi-"), location.pathname.length));
		c = m.length;
	} else if (location.pathname.indexOf("/nl/publi-")!=-1) {
		m = new Array("nl",location.pathname.substring(location.pathname.indexOf("publi-"), location.pathname.length));
		c = m.length;
	} else if (location.hostname.indexOf("vlan.be")!=-1 || location.hostname.indexOf("stag-job.vlan.roularta.be")!=-1 || location.hostname.indexOf("vlanjobs")!=-1 || location.hostname.indexOf("stag2-job.vlan.roularta.be")!=-1 || location.hostname.indexOf("ontw2-job.vlan.rmg.be")!=-1) {
		if (location.pathname.indexOf("bedrijfsprofiel")!=-1 && templateId == "BPRFL") {
			m = new Array("nl","vlan-job",m[3]);
			iframe = true;
		} else if (location.pathname.indexOf("profil-de-societe")!=-1 && templateId == "BPRFL") {
			m = new Array("fr","vlan-job",m[3]);
			iframe = true;
		} else if (location.pathname.indexOf("/nl/") != -1) {
			m = new Array("nl","vlan-job","werknemer");
		} else if (location.hostname.indexOf("jobs.vlan.be") != -1 || location.hostname.indexOf("jobs.vlanjobs.be") != -1) {
			m = new Array("nl","vlan-job","werknemer");
		} else if (location.pathname.indexOf("/fr/") != -1) {
			m = new Array("fr","vlan-job","werknemer");
		} else if (location.hostname.indexOf("emploi.vlan.be") != -1 || location.hostname.indexOf("emploi.vlanjobs.be") != -1) {
			m = new Array("fr","vlan-job","werknemer");
		}
		c = m.length;
		
	} else if (location.hostname.indexOf("knackweekend")!=-1) {
		if (location.pathname.indexOf("widget")!=-1) {
			m = new Array("nl","weekend",location.pathname.substring(location.pathname.indexOf("widget-"), location.pathname.length));
		} else if (location.pathname.indexOf("/nl/life-and-style/restaurants")!=-1) {
			m = new Array("nl","knackresto","other");
		} else if (location.pathname == "/nl/life-and-style/culinair/") {
			m = new Array("nl","culinair","home");
		} else if (location.pathname.indexOf("/nl/life-and-style/culinair/recepten")!=-1) {
			m = new Array("nl","culinair","recepten");
		} else if (location.pathname.indexOf("/nl/life-and-style/culinair")!=-1) {
			m = new Array("nl","culinair","other");
		//} else 	if (location.pathname == "/nl/life-and-style/reizen/") {
		//	m = new Array("nl","mytrip","home");
		} else 	if (location.pathname.indexOf("/nl/life-and-style/reizen")!=-1) {
			m = new Array("nl","mytrip","other");
		} else 	if (location.pathname.indexOf("/nl/life-and-style/beauty")!=-1) {
			m = new Array("nl","weekend","beauty");
		} else 	if (location.pathname.indexOf("/nl/life-and-style/mode")!=-1) {
			m = new Array("nl","weekend","mode");
		} else 	if (location.pathname.indexOf("/nl/life-and-style/wonen")!=-1) {
			m = new Array("nl","weekend","wonen");
		} else 	if (location.pathname == "/nl/life-and-style/") {
			m = new Array("nl","weekend","home");
		} else {
			m = new Array("nl","weekend","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("vifweekend")!=-1) {
		if (location.pathname.indexOf("widget")!=-1) {
			m = new Array("fr","weekend",location.pathname.substring(location.pathname.indexOf("widget-"), location.pathname.length));
		} else if (location.pathname == "/fr/style-de-vie/restaurants/") {
			m = new Array("fr","knackresto","home");
		} else if (location.pathname.indexOf("/fr/style-de-vie/restaurants")!=-1) {
			m = new Array("fr","knackresto","other");
		} else if (location.pathname == "/fr/style-de-vie/culinair/") {
			m = new Array("fr","culinair","home");
		} else if (location.pathname.indexOf("/fr/style-de-vie/culinair/recettes")!=-1) {
			m = new Array("fr","culinair","recepten");
		} else if (location.pathname.indexOf("/fr/style-de-vie/culinair")!=-1) {
			m = new Array("fr","culinair","other");
		//} else 	if (location.pathname == "/fr/style-de-vie/voyage") {
		//	m = new Array("fr","mytrip","home");
		} else 	if (location.pathname.indexOf("/fr/style-de-vie/beaute")!=-1) {
			m = new Array("fr","weekend","beauty");
		} else 	if (location.pathname.indexOf("/fr/style-de-vie/mode")!=-1) {
			m = new Array("fr","weekend","mode");
		} else 	if (location.pathname.indexOf("/fr/style-de-vie/maison")!=-1 || location.pathname.indexOf("/fr/style-de-vie/design")!=-1) {
			m = new Array("fr","weekend","wonen");
		} else 	if (location.pathname == "/fr/style-de-vie/") {
			m = new Array("fr","weekend","home");
		} else {
			m = new Array("fr","weekend","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("knackresto.rnews.be")!=-1) {
		if (location.pathname.indexOf("partner-informatie/leffe")!=-1) {
			m = new Array("nl","partner-informatie","leffe");
		} else if (location.pathname == "/nl/life-and-style/restaurants/") {
			m = new Array("nl","knackresto","home");
			} else {
			m = new Array("nl","knackresto","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("levifresto.rnews.be")!=-1) {
		if (location.pathname.indexOf("partenariat/leffe")!=-1) {
			m = new Array("fr","partenariat","leffe");
		} else if(location.pathname == '/fr/style-de-vie/restaurants/'){
			m = new Array("fr","levifresto","home");
		} else {
			m = new Array("fr","levifresto","other");
		}
		c = m.length;
		
	} else if (location.hostname.indexOf("telepro.be")!=-1) {
		if (location.pathname == "/" || location.pathname == "/telepro/magazine/Home") {
			m = new Array("fr","telepro","home");
		} else {
			m = new Array("fr","telepro","other");
		}
		c = m.length;
	} else if ((location.hostname.indexOf("rnews.be")!=-1 && location.pathname.indexOf("nl/life-and-style/wonen")!=-1) || location.hostname.indexOf("ikgabouwen.rnews")!=-1) {
		if (location.pathname == "/nl/life-and-style/wonen/")
			m = new Array("nl","wonen","home");
		else if (location.pathname.indexOf("nationale-nieuwbouwdag") != -1)
			m = new Array("nl","wonen","nationale-nieuwbouwdag");
		else
			m = new Array("nl","wonen","other");
		c = m.length;
	} else if ((location.hostname.indexOf("rnews.be")!=-1 && location.pathname.indexOf("fr/style-de-vie/maison")!=-1) || location.hostname.indexOf("jevaisconstruire.rnews")!=-1) {
		if (location.pathname == "/fr/style-de-vie/maison/")
			m = new Array("fr","wonen","home");
		else if (location.pathname.indexOf("journee-nationale-de-la-construction") != -1)
			m = new Array("fr","wonen","journee-nationale-de-la-construction");
		else
			m = new Array("fr","wonen","other");
		c = m.length;
	} else if (location.hostname.indexOf("nest.knack.be")!=-1 || location.hostname.indexOf("nest.rnews")!=-1 || location.hostname.indexOf("nest.knack.rmg.be")!=-1) {
		if (location.pathname == "/nl/index.jsp")
			m = new Array("nl","nest","home");
		else if (location.pathname == "/fr/index.jsp")
			m = new Array("fr","nest","home");
		else if (location.pathname.indexOf("/fr/")!=-1)
			m = new Array("fr","nest","other");
		else
			m = new Array("nl","nest","other");
		c = m.length;
	} else if (location.hostname.indexOf("nest.levif.be")!=-1 || location.hostname.indexOf("nest.levif.rmg.be")!=-1) {
		if (location.pathname == "/fr/index.jsp")
			m = new Array("fr","nest","home");
		else
			m = new Array("fr","nest","other");
		c = m.length;
	
	} else if (location.hostname.indexOf("jobs.challengez.be")!=-1 || location.hostname.indexOf("jobs.challengez.be")!=-1) {
		m = new Array("nl","challengez","home");
		c = m.length;
	
	} else if (location.hostname.indexOf("emploi.challengez.be")!=-1 || location.hostname.indexOf("emploi.challengez.be")!=-1) {
		m = new Array("fr","challengez","home");
		c = m.length;
	
	} else if (location.hostname.indexOf("sport.be")!=-1) {
		if (location.pathname == "/nl/splash/")
			m = new Array("nl","sport","splash");
		else if (location.pathname == "/sportmagazine/nl/")
			m = new Array("nl","sport","home");
		else if (location.pathname.indexOf("/sportmagazine/nl")!=-1)
			m = new Array("nl","sport","other");
		else if (location.pathname == "/fr/splash/")
			m = new Array("fr","sport","splash");
		else if (location.pathname == "/sportmagazine/fr/")
			m = new Array("fr","sport","home");
		else if (location.pathname.indexOf("/sportmagazine/fr")!=-1)
			m = new Array("fr","sport","other");
		c = m.length;
	
	} else if (location.hostname.indexOf("knack.be")!=-1 || location.hostname.indexOf("weekend")!=-1 || location.hostname.indexOf("knack.rmg.be")!=-1 || location.hostname.indexOf("knack.rnews")!=-1) {
		if (location.pathname.indexOf("/publi-")!=-1) {
			m = new Array("nl",location.pathname.substring(location.pathname.indexOf("publi-"), location.pathname.lastIndexOf("/")));
		} else if (m.length == 2 && m[0] == "weekend" && m[1] == "nl") {
			m = new Array("nl","weekend","home");
		} else if (m.length == 2 && m[0] == "weekend" && m[1] == "fr") {
			m = new Array("fr","weekend","home");
		} else 	if (m.length > 2 && m[0] == "weekend" && m[1] == "nl" && m[2] == "dossiers") {
			m = new Array("nl","weekend","dossier-uurwerken");
		} else 	if (location.pathname.indexOf("beauty")!=-1) {
			m = new Array("nl","weekend","beautydossier");
		} else 	if (m.length > 3 && m[0] == "weekend" && m[1] == "nl" && m[2] == "mode" && m[3] == "catwalk") {
			m = new Array("nl","weekend","catwalk");
		} else 	if (m.length > 2 && m[0] == "weekend") {
			m = new Array("nl","weekend","other");
		} else 	if (location.pathname == "/nieuws/economie/") {
			m = new Array("nl","nieuws","economie");
		} else 	if (location.pathname == "/nieuws/sport/") {
			m = new Array("nl","sport","home");
		} else 	if (location.pathname.indexOf("/nieuws/sport")!=-1) {
			m = new Array("nl","sport","other");
		} else 	if (location.pathname.indexOf("/dossiers/auto")!=-1) {
			m = new Array("nl","nieuws","dossier-auto");
		} else 	if (location.pathname.indexOf("/dossiers/milieu")!=-1) {
			m = new Array("nl","nieuws","dossier-milieu");
		} else 	if (location.pathname.indexOf("/dossiers/uw-geld")!=-1) {
			m = new Array("nl","nieuws","dossier-uw-geld");
		//} else 	if (location.pathname.indexOf("/kanaal/bodytalk/")!=-1) {
		//	m = new Array("nl","nieuws","bodytalk");
		} else 	if (location.pathname == "/focus/poplounge/index.jsp") {
			m = new Array("nl","focus","home");
		} else 	if (location.pathname.indexOf("/focus/poplounge/festival")!=-1) {
			m = new Array("nl","focus","poplounge_festival-special");
		} else 	if (location.pathname == "/kanaal/go/") {
			m = new Array("nl","nieuws","go-home");
		} else 	if (location.pathname.indexOf("/kanaal/go")!=-1) {
			m = new Array("nl","nieuws","go-other");
		} else 	if (location.pathname.indexOf("focus")!=-1) {
			m = new Array("nl","focus","other");
		} else if (location.pathname == "/splash.jsp") {
			m = new Array("nl","nieuws","splash");
		} else if (location.pathname == "/index.jsp" || location.pathname == "/") {
			m = new Array("nl","nieuws","home");
		} else {
			m = new Array("nl","nieuws","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("levif.be")!=-1 || location.hostname.indexOf("weekend.rmg.be")!=-1 || location.hostname.indexOf("levif.rmg.be")!=-1 || location.hostname.indexOf("levif.rnews")!=-1) {
		if (location.pathname.indexOf("/publi-")!=-1) {
			m = new Array("fr",location.pathname.substring(location.pathname.indexOf("publi-"), location.pathname.lastIndexOf("/")));
		} else if (m.length == 2 && m[0] == "weekend" && m[1] == "fr") {
			m = new Array("fr","weekend","home");
		} else 	if (m.length > 2 && m[0] == "weekend" && m[1] == "fr" && m[2] == "dossiers") {
			m = new Array("fr","weekend","dossier-montres");
		} else 	if (location.pathname.indexOf("beaute")!=-1) {
			m = new Array("fr","weekend","beautydossier");
		} else if (location.pathname.indexOf("partenariat/Leffe")!=-1) {
			m = new Array("fr","partenariat","leffe");
		} else 	if (m.length > 3 && m[0] == "weekend" && m[1] == "fr" && m[2] == "mode" && m[3] == "catwalk") {
			m = new Array("fr","weekend","catwalk");
		} else 	if (m.length > 2 && m[0] == "weekend") {
			m = new Array("fr","weekend","other");
		} else 	if (location.pathname == "/actualite/economie/") {
			m = new Array("fr","actualite","economie");
		} else 	if (location.pathname == "/actualite/sport/") {
			m = new Array("fr","sport","home");
		} else 	if (location.pathname.indexOf("/actualite/sport")!=-1) {
			m = new Array("fr","sport","other");
		} else if (location.pathname.indexOf("reportages-photo")!=-1) {
			m = new Array("fr","actualite","reportages-photo");
		} else if (location.pathname.indexOf("sante-et-equilibre")!=-1) {
			m = new Array("fr","actualite","sante-et-equilibre");
		} else 	if (location.pathname.indexOf("/dossiers/auto")!=-1) {
			m = new Array("fr","actualite","dossier-auto");
		} else 	if (location.pathname.indexOf("/dossiers/environnement")!=-1) {
			m = new Array("fr","actualite","dossier-milieu");
		} else 	if (location.pathname.indexOf("/dossiers/votre-argent")!=-1) {
			m = new Array("fr","actualite","dossier-votre-argent");			
		} else 	if (location.pathname == "/levif/focus/blog/") {
			m = new Array("fr","focus","home");
		} else 	if (location.pathname.indexOf("focus")!=-1) {
			m = new Array("fr","focus","other");
		} else 	if (location.pathname == "/actualite/go/") {
			m = new Array("fr","actualite","go-home");
		} else 	if (location.pathname.indexOf("/actualite/go")!=-1) {
			m = new Array("fr","actualite","go-other");
		} else if (location.pathname == "/splash.jsp" || location.pathname == "/") {
			m = new Array("fr","actualite","home");
		} else if (location.pathname == "/index.jsp") {
			m = new Array("fr","actualite","home");
		} else {
			m = new Array("fr","actualite","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("kanaalz.trends.be")!=-1 || location.hostname.indexOf("kanaalz.rmg.be")!=-1 || location.hostname.indexOf("kanaalz.rnews")!=-1) {
		if (location.pathname == "/nl/splash.jsp" || location.pathname == "/kanaalz/nl/splash.jsp" || location.pathname == "/kanaalz/") {
			m = new Array("nl","kanaalz","splash");
		} else if (location.pathname == "/nl/index.jsp" || location.pathname == "/nl/" || location.pathname == "/kanaalz/nl/index.jsp" || location.pathname == "/kanaalz/nl/") {
			m = new Array("nl","kanaalz","home");
		} else if (location.pathname.indexOf("golfz") != -1) {
			m = new Array("nl","kanaalz","golfz");
		} else if (location.pathname.indexOf("Groeitips") != -1) {
			m = new Array("nl","kanaalz","groeitips");
		} else if (location.pathname.indexOf("familiezaken") != -1) {
			m = new Array("nl","kanaalz","familiezaken");
		} else if (location.pathname.indexOf("wereldverbeteraar") != -1) {
			m = new Array("nl","kanaalz","dewereldverbeteraars");
		} else if (location.pathname.indexOf("de-beste-stuurlui") != -1) {
			m = new Array("nl","kanaalz","de-beste-stuurlui");
		} else if (location.pathname.indexOf("baas-aan-boord") != -1) {
			m = new Array("nl","kanaalz","baas-aan-boord");
		} else if (location.pathname.indexOf("masterclass") != -1) {
			m = new Array("nl","kanaalz","masterclass");
		} else if (location.pathname.indexOf("mastersoffunds") != -1) {
			m = new Array("nl","kanaalz","mastersoffunds");
		} else if (location.pathname.indexOf("evenwicht-werkt") != -1) {
			m = new Array("nl","kanaalz","evenwicht-werkt");
		} else if (location.pathname.indexOf("newit") != -1) {
			m = new Array("nl","kanaalz","newit");
		} else if (location.pathname.indexOf("gustooldtimers") != -1 || location.pathname.indexOf("nl/stream/48-240-") != -1) {
			m = new Array("nl","kanaalz","gustooldtimers");
		} else if (location.pathname.indexOf("bij-de-notaris") != -1) {
			m = new Array("nl","kanaalz","bij-de-notaris");
		} else if (location.pathname.indexOf("moneytalk") != -1) {
			m = new Array("nl","kanaalz","moneytalk");
		} else if (location.pathname.indexOf("TuinmeestersII") != -1) {
			m = new Array("nl","kanaalz","TuinmeestersII");
		} else {
			m = new Array("nl","kanaalz","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("canalz.trends.be")!=-1 || location.hostname.indexOf("canalz.rnews")!=-1 || location.hostname.indexOf("canalz.rmg.be")!=-1) {
		if (location.pathname == "/fr/splash.jsp" || location.pathname == "/kanaalz/fr/splash.jsp" || location.pathname == "/") {
			m = new Array("fr","kanaalz","splash");
		} else if (location.pathname == "/fr/index.jsp" || location.pathname == "/fr/" || location.pathname == "/kanaalz/fr/index.jsp" || location.pathname == "/kanaalz/fr/") {
			m = new Array("fr","canalz","home");
		} else if (location.pathname.indexOf("masterclass") != -1) {
			m = new Array("fr","canalz","masterclass");
		} else if (location.pathname.indexOf("affairesdefamille") != -1) {
			m = new Array("fr","canalz","affairesdefamille");
		} else if (location.pathname.indexOf("mastersoffunds") != -1) {
			m = new Array("fr","canalz","mastersoffunds");
		} else if (location.pathname.indexOf("newit") != -1) {
			m = new Array("fr","canalz","newit");
		} else if (location.pathname.indexOf("moneytalk") != -1) {
			m = new Array("fr","canalz","moneytalk");
		} else if (location.pathname.indexOf("patron-a-bord") != -1) {
			m = new Array("fr","canalz","patron-a-bord");
		} else {
			m = new Array("fr","canalz","other");
		}		
		c = m.length;
	} else if (location.hostname.indexOf("applications.roularta.be")!=-1) {
		if (location.pathname == "/heatMaps/nl.htm" || location.pathname == "/heatMaps/") {
			m = new Array("nl","trends","heatmaps");
		} else 	if (location.pathname == "/heatMaps/fr.htm") {
			m = new Array("fr","trends","heatmaps");
		}
		c = m.length;
	} else if (location.hostname.indexOf("moneytalk.rnews")!=-1) {
		if (location.pathname.indexOf("/nl/geld-en-beurs/personal-finance/video")!=-1) {
			m = new Array("nl","moneytalk","video");
		} else if (location.pathname == "/nl/geld-en-beurs/personal-finance/") {
			m = new Array("nl","moneytalk","home");
		} else if (location.pathname.substr(0,3) == "/nl") {
			m = new Array("nl","moneytalk","other");
		} else if (location.pathname == "/nl/moneytalk/pensioen") {
			m = new Array("nl","moneytalk","dossier-pensioen");
		} else if (location.pathname == "/fr/argent-et-bourse/finances-personelles/") {
			m = new Array("fr","moneytalk","home");
		} else if (location.pathname.indexOf("/fr/argent-et-bourse/finances-personelles/video")!=-1) {
			m = new Array("fr","moneytalk","video");
		} else if (location.pathname.substr(0,3) == "/fr") {
			m = new Array("fr","moneytalk","other");
		} else if (location.pathname == "/fr/moneytalk/retraite") {
			m = new Array("fr","moneytalk","dossier-retraite");
		}
		c = m.length;
	} else if (location.hostname.indexOf("bizz")!=-1) {
		if (location.pathname.indexOf("/nl/")!=-1) {
			m = new Array("nl","bizz","home");
		} else if (location.pathname.indexOf("/fr/")!=-1) {
			m = new Array("fr","bizz","home");
		}
		c = m.length;
// TRENDS.BE
// ================
	} else if (location.hostname.indexOf("trends.be")!=-1 || location.hostname.indexOf("trends.rnews")!=-1 || location.hostname.indexOf("trends.rmg.be")!=-1) {
		if (location.pathname.indexOf("widget")!=-1 && location.pathname.indexOf("/fr")!=-1) {
			m = new Array("fr","trends",location.pathname.substring(location.pathname.indexOf("widget-"), location.pathname.length));
		} else if (location.pathname.indexOf("widget")!=-1 && location.pathname.indexOf("/nl")!=-1) {
			m = new Array("nl","trends",location.pathname.substring(location.pathname.indexOf("widget-"), location.pathname.length));
		} else if (location.pathname == "/splash_nl.jsp") {
			m = new Array("nl","trends","home");
		} else if (location.pathname.indexOf("streamingArticle")!=-1 && location.search.indexOf("lang=nl")!=-1) {
			m = new Array("nl","trends","other");
		} else if (location.pathname.indexOf("streamingArticle")!=-1 && location.search.indexOf("lang=fr")!=-1) {
			m = new Array("fr","trends","other");
		} else if (location.pathname == "/nl/kanaal/immo/heatmaps") {
			m = new Array("nl","trends","heatmaps");
		} else if (location.pathname == "/fr/economie/immo/heatmaps") {
			m = new Array("fr","trends","heatmaps");
		} else if (location.pathname.indexOf("/nl/kanaal/immo/") != -1 || location.pathname.indexOf("/nl/nieuws/immo/") != -1) {
			m = new Array("nl","trends","immo");
		} else if (location.pathname.indexOf("/nl/economie/nieuws/immo/") != -1){ // aangepast
			m = new Array("nl", "trends", "immo");
		} else if (location.pathname.indexOf("/nl/partner-informatie/ING/") != -1) {
			m = new Array("nl","partner-informatie","ING");
		} else if (location.pathname.indexOf("/fr/partenariat/ING/") != -1) {
			m = new Array("fr","partenariat","ING");
		} else if (location.pathname.indexOf("/fr/economie/immo/") != -1 || location.pathname.indexOf("/fr/economie/actualite/immo/") != -1) {
			m = new Array("fr","trends","immo");
		} else if (location.pathname.indexOf("/nl/economie/actualite/immo/") != -1){ // aangepast
			m = new Array("fr", "trends", "immo");
		} else if (location.pathname.indexOf("gazellen")!=-1) {
			m = new Array("nl","trends","gazellen");
		} else if (location.pathname.indexOf("gazelles")!=-1) {
			m = new Array("fr","trends","gazelles");
		} else if (location.pathname.indexOf("managervanhetjaar")!=-1 || location.pathname.indexOf("manager08/page_NL")!=-1 || location.pathname.indexOf("manager08/NL")!=-1) {
			m = new Array("nl","trends","managervanhetjaar");
		} else if (location.pathname.substr(0,3) == "/nl") {
			if (location.pathname.indexOf("/nl/dossiers/hrm/")!=-1) {
				m = new Array("nl","trends","dossier-hrm");
			} else if (location.pathname == "/nl" || location.pathname == "/nl/" || location.pathname == "/nl/index.jsp#" || location.pathname == "/nl/index.jsp") {
				m = new Array("nl","trends","home");
			} else if (location.pathname == "/nl/moneytalk" || location.pathname == "/nl/moneytalk/") {
				m = new Array("nl","moneytalk","home");
			} else if (location.pathname == "/nl/moneytalk/pensioen") {
				m = new Array("nl","moneytalk","dossier-pensioen");
			} else if (location.pathname.indexOf("mobiel-kantoor")!=-1) {
				m = new Array("nl","trends","dossier-mobiel-kantoor");
			} else if (location.pathname.indexOf("moneytalk")!=-1) {
				m = new Array("nl","moneytalk","other");
			} else if (location.pathname == "/nl/bizz" || location.pathname == "/nl/bizz/") {
				m = new Array("nl","bizz","home");
			} else if (location.pathname.indexOf("bizz/blogs")!=-1) {
				m = new Array("nl","bizz","blogs");
			} else if (location.pathname.indexOf("bizz")!=-1) {
				m = new Array("nl","bizz","other");
			} else {
				m = new Array("nl","trends","other");
			}
		} else if (location.pathname.indexOf("bizz//nl")!=-1) {
			m = new Array("nl","bizz","other");
		} else if (location.pathname.indexOf("bizz//fr")!=-1) {
			m = new Array("fr","bizz","other");
		} else if (location.pathname.substr(0,10) == "/trends/nl") {
			if (m.length >= 3) {
				m = new Array("nl","trends","other");
			} else {
				m = new Array("nl","trends","home");
			}
		} else if (location.pathname.indexOf("managerdelannee")!=-1 || location.pathname.indexOf("manager08/page_FR")!=-1 || location.pathname.indexOf("manager08/FR")!=-1) {
			m = new Array("fr","trends","managerdelannee");
		} else if (location.pathname.substr(0,3) == "/fr") {
			if (location.pathname == "/fr" || location.pathname == "/fr/" || location.pathname == "/fr/index.jsp#" || location.pathname == "/fr/index.jsp") {
				m = new Array("fr","trends","home");
			} else if (location.pathname == "/fr/moneytalk" || location.pathname == "/fr/moneytalk/") {
				m = new Array("fr","moneytalk","home");
			} else if (location.pathname == "/fr/moneytalk/retraite") {
				m = new Array("fr","moneytalk","dossier-retraite");
			} else if (location.pathname.indexOf("dossiers/12-1726")!=-1) {
				m = new Array("fr","dossiers","12-1726-Women-Only-dossiers.html");
			} else if (location.pathname.indexOf("bureau-mobile")!=-1) {
				m = new Array("fr","trends","dossier-bureau-mobile");
			} else if (location.pathname.indexOf("moneytalk")!=-1) {
				m = new Array("fr","moneytalk","other");
			} else if (location.pathname == "/fr/bizz" || location.pathname == "/fr/bizz/") {
				m = new Array("fr","bizz","home");
			} else if (location.pathname.indexOf("bizz/blogs")!=-1) {
				m = new Array("fr","bizz","blogs");
			} else if (location.pathname.indexOf("bizz")!=-1) {
				m = new Array("fr","bizz","other");
			} else {
				m = new Array("fr","trends","other");
			}
		} else if (location.pathname.substr(0,10) == "/trends/fr") {
			if (m.length >= 3) {
				m = new Array("fr","trends","other");
			} else {
				m = new Array("fr","trends","home");
			}
		} else {
			m = new Array("nl","trends","home");
		}
		c = m.length;
	} else if (location.hostname.indexOf("insidebeleggen")!=-1 || location.hostname.indexOf("initiedelabourse") != -1 ) {
		if(typeof(sess_var)!=undefined && sess_var != "") {
			if (sess_var == "HBF")
				m = new Array("fr","insidebeleggen","runof");
			else
				m = new Array("nl","insidebeleggen","runof");
		} else if(location.search.indexOf("lang=3")!=-1) {
			m = new Array("fr","insidebeleggen","runof");
		} else {
			m = new Array("nl","insidebeleggen","runof");
		}
		c = m.length;
	} else if (location.hostname.indexOf("mytrip.be")!=-1) {
		if (location.pathname != "/")
			m = new Array("nl","mytrip","other");
		else
			m = new Array("nl","mytrip","home");
		c = m.length;
	} else if (location.hostname.indexOf("cash")!=-1 ) {
		if (location.pathname == "/nl" || location.pathname == "/cash/nl" || location.pathname == "/nl/index.jsp" || location.pathname == "/splash_nl.jsp" || location.pathname == "/nl/geld-en-beurs/" || location.pathname == "/nl/geld-en-beurs") {
			m = new Array("nl","cash","home");
		} else if (location.pathname.indexOf("/nl/magazine/fondsen") != -1 || location.pathname.indexOf("/nl/geld-en-beurs/fondsen") != -1) {
			m = new Array("nl","cash","fondsen");
		} else if (location.pathname.indexOf("nl/mastersoffunds") != -1) {
			m = new Array("nl","cash","mastersoffunds");
		} else if (location.pathname.indexOf("/nl/geld-en-beurs/cashawards") != -1) {
			m = new Array("nl","cash","cashawards");
		} else if (location.pathname.substr(0,3) == "/nl") {
			m = new Array("nl","cash","other");
		} else if (location.pathname == "/fr" || location.pathname == "/cash/fr" || location.pathname == "/fr/index.jsp" || location.pathname == "/splash_fr.jsp" || location.pathname == "/fr/argent-et-bourse/" || location.pathname == "/fr/argent-et-bourse") {
			m = new Array("fr","cash","home");
		} else if (location.pathname.indexOf("fr/mastersoffunds") != -1) {
			m = new Array("fr","cash","mastersoffunds");
		} else if (location.pathname.indexOf("/fr/magazine/fonds") != -1 || location.pathname.indexOf("/fr/argent-et-bourse/fonds") != -1) {
			m = new Array("fr","cash","fondsen");
		} else if (location.pathname.indexOf("/fr/argent-et-bourse/cashawards") != -1) {
			m = new Array("fr","cash","cashawards");
		} else if (location.pathname.substr(0,3) == "/fr") {
			m = new Array("fr","cash","other");
		} else {
			m = new Array("nl","cash","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("gastronomen.net")!=-1 || location.hostname.indexOf("gastronomen.rmg.be")!=-1) {
		if (location.pathname == "/default.asp")
			m = new Array("nl","gastronomen","home");
		else if (location.pathname.indexOf("partner-informatie/Leffe")!=-1)
			m = new Array("nl","partner-informatie","leffe");
		else if (location.pathname == "/")
			m = new Array("nl","gastronomen","splash");
		else
			m = new Array("nl","gastronomen","other");
		c = m.length;
	} else if (location.hostname.indexOf("gezondheidsnet")!=-1) {
		if (location.pathname == "/")
			m = new Array("nl","gezondheidsnet","home");
		else if (location.pathname.indexOf("/stoppen-met-roken")!=-1)
			m = new Array("nl","gezondheidsnet","stoppen-met-roken");
		else if (location.pathname.indexOf("bodytalk")!=-1)
			m = new Array("nl","nieuws","bodytalk", "home");
		else
			m = new Array("nl","gezondheidsnet","other");			
		c = m.length;
	} else if (location.hostname.indexOf("geheugen.plusmagazine.be")!=-1) {
		m = new Array("nl","plusmagazine","geheugen");
		c = m.length;
	} else if (location.hostname.indexOf("memoire.plusmagazine.be")!=-1) {
		m = new Array("fr","plusmagazine","memoire");
		c = m.length;
	} else if ( (location.hostname.indexOf("plusmagazine.be")!=-1)  || (location.hostname.indexOf("plusmagazine.rnews.be")!=-1) ) {
		if (location.pathname == "/nl")
			m = new Array("nl","plusmagazine","home");
		else if (location.pathname == "/nl/vichy")
			m = new Array("nl","plusmagazine","vichy");
		else if (location.pathname == "/nl/taste-the-world")
			m = new Array("nl","plusmagazine","splash");
		else if (location.pathname.indexOf("/nl/rechtengeld/bij-de-notaris") != -1)
			m = new Array("nl","plusmagazine","bij-de-notaris");
		else if (location.pathname.indexOf("/nl/rechtengeld") != -1)
			m = new Array("nl","plusmagazine","rechtengeld");
		else if (location.pathname.indexOf("/nl/gezondheid/dossier_ogen") != -1)
			m = new Array("nl","plusmagazine","dossier-ogen");
		else if (location.pathname.indexOf("dossier_levenslang_comfortabel_wonen") != -1)
			m = new Array("nl","plusmagazine","dossier-comfortwonen");			
		else if (location.pathname.indexOf("/nl/gezondheid") != -1)
			m = new Array("nl","plusmagazine","gezondheid");
		else if (location.pathname.indexOf("/nl/mensenmening") != -1)
			m = new Array("nl","plusmagazine","mensenmening");
		else if (location.pathname.indexOf("/nl/vrijetijd") != -1)
			m = new Array("nl","plusmagazine","vrijetijd");
		else if (location.pathname.indexOf("/nl/lifestyle") != -1)
			m = new Array("nl","plusmagazine","lifestyle");
		else if (location.pathname.indexOf("/nl/multimedia") != -1)
			m = new Array("nl","plusmagazine","multimedia");
		else if (location.pathname.indexOf("/nl/") != -1)
			m = new Array("nl","plusmagazine","other");
		else if (location.pathname == "/fr")
			m = new Array("fr","plusmagazine","home");
		else if (location.pathname == "/fr/neovadiol")
			m = new Array("fr","plusmagazine","neovadiol");
		else if (location.pathname == "/fr/taste-the-world")
			m = new Array("fr","plusmagazine","splash");
		else if (location.pathname.indexOf("/fr/droitargent") != -1)
			m = new Array("fr","plusmagazine","droitargent");
		else if (location.pathname.indexOf("/fr/sante/dossier_les_yeux") != -1)
			m = new Array("fr","plusmagazine","dossier-les-yeux");
		else if (location.pathname.indexOf("vivre_plus_longtemps_confortablement") != -1)
			m = new Array("fr","plusmagazine","dossier-confortdevie");
		else if (location.pathname.indexOf("/fr/sante") != -1)
			m = new Array("fr","plusmagazine","sante");
		else if (location.pathname.indexOf("/fr/societe") != -1)
			m = new Array("fr","plusmagazine","societe");
		else if (location.pathname.indexOf("/fr/loisirs") != -1)
			m = new Array("fr","plusmagazine","loisirs");
		else if (location.pathname.indexOf("/fr/artdevivre") != -1)
			m = new Array("fr","plusmagazine","artdevivre");
		else if (location.pathname.indexOf("/fr/multimedia") != -1)
			m = new Array("fr","plusmagazine","multimedia");
		else if (location.pathname.indexOf("/fr/") != -1)
			m = new Array("fr","plusmagazine","other");
		c = m.length;
	} else if (location.hostname.indexOf("nl.datanewsjobs.be")!=-1 || location.hostname.indexOf("it-jobs.datanews.be")!=-1) {
		m = new Array("nl","datanews","jobs");
		c = m.length;
	} else if (location.hostname.indexOf("fr.datanewsjobs.be")!=-1 || location.hostname.indexOf("emploi-it.datanews.be")!=-1 ) {
		m = new Array("fr","datanews","jobs");
		c = m.length;
	} else if (location.hostname.indexOf("fr.downloads.datanews.be")!=-1) {
		m = new Array("fr","datanews","downloads");
		c = m.length;
	} else if (location.hostname.indexOf("downloads.datanews.be")!=-1) {
		m = new Array("nl","datanews","downloads");
		c = m.length;
	} else if (location.hostname.indexOf("datanews.be")!=-1 || location.hostname.indexOf("datanews.rmg.be")!=-1 || location.hostname.indexOf("datanews.rnews.be")!=-1) {
		if (location.pathname == "/nl/index.jsp" || location.pathname == "/nl/" || location.pathname == "/datanews/nl/") {
			m = new Array("nl","datanews","home");
		} else if (location.pathname.indexOf("/nl/it-jobs/bedrijfsprofielen")!=-1 && templateId == "BPRFL") {
			m = new Array("nl","datanews-profile",m[3]);
			iframe = true;	
		} else if (location.pathname.indexOf("/fr/emploi-it/profils-entreprises")!=-1 && templateId == "BPRFL") {
			m = new Array("fr","datanews-profile",m[3]);
			iframe = true;		
		} else if (location.pathname.indexOf("/nl/jobs")!=-1) {
			m = new Array("nl","datanews","jobs");
		} else if (location.pathname.indexOf("/fr/jobs")!=-1) {
			m = new Array("fr","datanews","jobs");
		} else if (location.pathname.indexOf("/nl/products")!=-1) {
			m = new Array("nl","datanews","products");
		} else if (location.pathname.indexOf("/fr/products")!=-1) {
			m = new Array("fr","datanews","products");
		} else if (location.pathname.indexOf("/nl/downloads")!=-1) {
			m = new Array("nl","datanews","downloads");
		} else if (location.pathname.indexOf("/fr/downloads")!=-1) {
			m = new Array("fr","datanews","downloads");
		} else if (location.pathname.indexOf("/nl/data-news-tv")!=-1) {
			m = new Array("nl","datanews","data-news-tv-home");
		} else if (location.pathname.indexOf("/fr/data-news-tv")!=-1) {
			m = new Array("fr","datanews","data-news-tv-home");
		} else if ((location.pathname+location.search).indexOf("groepCode=DB&taal=fr")!=-1 || (location.pathname+location.search).indexOf("groepCode=BW&taal=fr")!=-1 ) {
			m = new Array("fr","datanews","other");
		} else if ((location.pathname + location.search).indexOf("groepCode=DA")!=-1 || (location.pathname+location.search).indexOf("groepCode=BV")!=-1 ) {
			m = new Array("nl","datanews","other");
		} else if (location.pathname.substr(0,3) == "/nl" || location.pathname.indexOf("/datanews/nl/datanews-blog")!=-1) {
			m = new Array("nl","datanews","other");
		} else if (location.pathname == "/fr/index.jsp" || location.pathname == "/fr/") {
			m = new Array("fr","datanews","home");
		} else if (location.pathname.substr(0,3) == "/fr") {
			m = new Array("fr","datanews","other");
		} 
		c = m.length;
	
	} else if (location.hostname.indexOf("awards.roulartaprofessional.be")!=-1) {
		if (location.pathname.indexOf("nl")!=-1)
			m = new Array("nl","itm","awards");
		else if (location.pathname.indexOf("fr")!=-1)
			m = new Array("fr","itm","awards");		
		else m = new Array("nl","itm","awards");
		c = m.length;
	} else if (location.hostname.indexOf("roulartaprofessional.be")!=-1 || location.hostname.indexOf("rpi.rmg.be")!=-1 || location.hostname.indexOf("roulartaprofessional.rnews.be")!=-1 ) {
		if (location.pathname == "/rpi/rpi/nl/index.jsp")
			m = new Array("nl","rpi","home");
		else if (location.pathname == "/rpi/rpi/fr/index.jsp")
			m = new Array("fr","rpi","home");
		else if (location.pathname.indexOf("itm")!=-1)
			m = new Array("nl","itm","home");
		else if (location.pathname.indexOf("imt")!=-1)
			m = new Array("fr","imt","home");
		else if (location.pathname == "/grafischnieuws/index.jsp")
			m = new Array("nl","grafischnieuws","home");
		else if (location.pathname == "/nouvellesgraphiques/index.jsp")
			m = new Array("fr","nouvellesgraphiques","home");
		else if (location.pathname.indexOf("businessict/nl") != -1)
			m = new Array("nl","businessict","home");
		else if (location.pathname.indexOf("businessict/fr") != -1)
			m = new Array("fr","businessict","home");
		else if (location.pathname.indexOf("dotgov/nl") != -1)
			m = new Array("nl","dotgov","home");
		else if (location.pathname.indexOf("dotgov/fr") != -1)
			m = new Array("fr","dotgov","home");
		c = m.length;
	} else if (location.hostname.indexOf("dezondag.be")!=-1) {
		if (location.pathname == "/")
			m = new Array("nl","dezondag","home");
		else
			m = new Array("nl","dezondag","other");
		c = m.length;
	} else if (location.hostname.indexOf("wtv.be")!=-1 || location.hostname.indexOf("wtv.rmg.be")!=-1) {
		if (location.pathname == "/indexBovenSnel.jsp")
			m = new Array("nl","wtv","home");
		else
			m = new Array("nl","wtv","other");
		c = m.length;
	} else if (location.hostname.indexOf("topbouw")!=-1 || location.hostname.indexOf("topconstruct")!=-1) {
		if(typeof(Language) != 'undefined' && Language == "NL") {
			if (location.pathname.indexOf("default.aspx") != -1)
				m = new Array("nl","topbouw","home");
			else
				m = new Array("nl","topbouw","other");
		} else if(typeof(Language) != 'undefined' && Language == "FR") {
			if (location.pathname.indexOf("default.aspx") != -1)
				m = new Array("fr","topbouw","home");
			else
				m = new Array("fr","topbouw","other");
		} else if(typeof(Language) != 'undefined' && Language == "EN") {
			if (location.pathname.indexOf("default.aspx") != -1)
				m = new Array("en","topbouw","home");
			else
				m = new Array("en","topbouw","other");
		}
		c = m.length;
	} else if (location.hostname.indexOf("top100000")!=-1 || location.hostname.indexOf("trendstop")!=-1) {
		if(typeof(Language) != 'undefined' && Language == "NL") {
			if (location.pathname.indexOf("default.aspx") != -1 || location.pathname == "/")
				m = new Array("nl","top100k","home");
			else
				m = new Array("nl","top100k","other");
		} else if(typeof(Language) != 'undefined' && Language == "FR") {
			if (location.pathname.indexOf("default.aspx") != -1 || location.pathname == "/")
				m = new Array("fr","top100k","home");
			else
				m = new Array("fr","top100k","other");
		} else if(typeof(Language) != 'undefined' && Language == "EN") {
			if (location.pathname.indexOf("default.aspx") != -1 || location.pathname == "/")
				m = new Array("en","top100k","home");
			else
				m = new Array("en","top100k","other");
		} else {
				m = new Array("nl","top100k","other"); //tmp workaround for splash and layer that can't reach the language var
		}
		c = m.length;
	} else if (location.hostname.indexOf("beleggers.competitie.rnews.be")!=-1 || location.hostname.indexOf("beleggerscompetitie.rnews.be")!=-1) {
		m = new Array("nl","beleggers","other");
		c = m.length;
	} else if (location.hostname.indexOf("concours.investisseurs.rnews.be")!=-1 || location.hostname.indexOf("concoursinvestisseurs.rnews.be")!=-1) {
		m = new Array("fr","beleggers","other");
		c = m.length;	
	} else if (location.hostname.indexOf("rnews.be")!=-1 && location.pathname.indexOf("nl/regio")!=-1 && templateId.indexOf("RBRSP")!=-1) {
		if (m.length>=3) m[2] += "-" + rbrname.toLowerCase().replace(/\s|,|&/g, "");
	}
	
	if (m!=undefined && c>0) {
		for (var x=0; x<c; x++) {
			loc += m[x] + '_';
		}
	} else {
		loc = "_err-"+location.hostname+"_";
	}

	if (iframe) {
		tagAdheseIframe(loc, templateId);
	} else if (previewMode) {
		if (templateId == previewTemplateId){
			tagAdhesePreview(previewCreativeId);
		}/* else if (previewCreativeId==-1){
			tagAdhese2(loc, templateId);
		} else {
			tagAdhese(loc, templateId);
		}*/
	} else {
		tagAdhese(loc, templateId);
	}
	
	//beweb counter
	//if (m!=undefined && m.length>1)
		//bewebCounter(m[0]+"-"+m[1]+"-"+templateId);
}

function tagAdhese(h, t) {
var m = document.getElementsByTagName("META");
var kk = "";
for (var x=0; x<m.length; x++) {
	if (m[x].name == "keywords") {
		kk = m[x].content.replace(/,|\s/gi,'_');
		if (kk.length>30)
			kk = kk.substring(0,30);
	}
}
document.write('<scr' + 'ipt language="JavaScript" type="text/javascript" src="http://ads.adhese.rnews.be/ad/' + h + '/' + t + '/' + adheseRand + '/' + kk + '?t=' + new Date().getTime() + '"><\/scr' + 'ipt>');
}

function tagAdhese2(h, t) {
var kk = "";
document.write('<scr' + 'ipt language="JavaScript" type="text/javascript" src="http://ads2.roularta.adhese.com/ad/' + h + '/' + t + '/' + adheseRand + '/' + kk + '?t=' + new Date().getTime() + '"><\/scr' + 'ipt>');
}

function tagAdheseIframe(h, t) {
document.write('<iframe name="profiel" width="625" height="1400" frameborder="no" border="0" margin="0" src="http://pool.adhese.rnews.be/tag/iframe-tag.html?' + h + '&' + t + '&' + adheseRand + '"></iframe>');
}

function tagAdhesePreview(c) {
document.write('<scr' + 'ipt language="JavaScript" type="text/javascript" src="http://roularta.adhese.org/creatives/preview/tag.do?id=' + c + '"><\/scr' + 'ipt>');
}

function trackAdhese() {

}

function articleTrack() {
	var d = getTrackingData();
	if (d.length>1) {
		var s1 = "";
		var s2 = "";
		var s3 = "";
		var s4 = "";
		for (var x=0; x<d.length; x++) {
			if(d[x][0]=="titel") s1 = d[x][1];
			else if(d[x][0]=="rubriek1") s2 = d[x][1];
			else if(d[x][0]=="rubriek2") s3 = d[x][1];
			else if(d[x][0]=="rubriek3" || d[x][0]=="UID") s4 = d[x][1];
		}
		var img = new Image();
		img.src = "http://track.roularta.adhese.com/log/" + s1 + "/" + s2 + "/" + s3 + "/" + s4 + "/" + location.protocol + "//" + location.hostname + location.pathname;
		img.width=1;
		img.height=1;
		document.getElementsByTagName("BODY")[0].appendChild(img);
	}	
}

function getTrackingData() {
	var m = document.getElementsByTagName("META");
	var kk = new Array();
	for (var x=0; x<m.length; x++) {
		if (m[x].name == "titel") {
			kk.push( new Array(m[x].name, m[x].content) )
		} else if (m[x].name.indexOf("rubriek")!=-1) {
			kk.push( new Array(m[x].name, m[x].content) );
		} else if (m[x].name.indexOf("UID")!=-1) {
			kk.push( new Array(m[x].name, m[x].content) );
		}
	}
	return kk;
}

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 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 eraseCookie(name) {
	createCookie(name,"",-1);
}

function addLoadEvent(func) {
	var ol = window.onload;
	if (typeof window.onload != 'function') {window.onload = func;}
	else {window.onload = function() {ol(); func();}}
}
//init overall / once per page load
initPage();

