// Verdeelscript t.b.v. Sitestat: Lajos.nl 2010
function NPOmultiStat(){}
NPOmultiStat.prototype.init=function()
{var omroepAr;var verdelingAr;var totPerc;var i;var j;var getal;var omroep;var extraLabels;this.cookienaam='NPOstat_'+this.cookienaam;if(!this.readCookie(this.cookienaam)){omroepAr=this.omroepen.split(',');this.verdeling=this.verdeling.replace(/%/gi,"");verdelingAr=this.verdeling.split(',');totPerc=0;for(i=0;i<omroepAr.length;i++){verdelingAr[i]=totPerc+Math.floor(verdelingAr[i]);totPerc=verdelingAr[i];}
getal=((Math.floor(Math.random()*100)+1));for(j=0;j<verdelingAr.length;j++){if(getal<verdelingAr[j]||getal==verdelingAr[j]){omroep=this.trim(omroepAr[j]).toLowerCase();break;}}
this.createCookie(this.cookienaam,omroep,365);}
else{omroep=this.readCookie(this.cookienaam);this.createCookie(this.cookienaam,omroep,365);}
if(typeof(this.klant)=='undefined'){this.klant='klo';}
if(this.klant==''){this.klant='klo';}
extraLabels=this.extraLabels();this.NPOstatSitestat("http://nl.sitestat.com/"+this.klant+"/"+omroep+"/s?"+this.counter+"&category="+this.category+"&ns_channel="+this.ns_channel+"&ns_webdir="+this.category+"&po_source="+this.po_source+"&po_sitetype="+this.po_sitetype+extraLabels+"&ntr_genre=informatie");}
NPOmultiStat.prototype.trim=function(sString)
{while(sString.substring(0,1)==' ')
{sString=sString.substring(1,sString.length);}
while(sString.substring(sString.length-1,sString.length)==' ')
{sString=sString.substring(0,sString.length-1);}
return sString;}
NPOmultiStat.prototype.readCookie=function(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;}
NPOmultiStat.prototype.createCookie=function(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=/";}
NPOmultiStat.prototype.extraLabels=function()
{var labels='';if(typeof(this.thema)!='undefined'){if(this.thema!=''){labels+='&thema='+this.thema;}}
if(typeof(this.ns_context)!='undefined'){if(this.ns_context!=''){labels+='&ns_context='+this.ns_context;}}
if(typeof(this.ns_auto)!='undefined'){if(this.ns_auto!=''){labels+='&ns_auto='+this.ns_auto;}}
return labels;}
NPOmultiStat.prototype.NPOstatSitestat=function(ns_l){ns_l+='&ns__t='+(new Date()).getTime();ns_pixelUrl=ns_l;ns_0=document.referrer;ns_0=(ns_0.lastIndexOf('/')==ns_0.length-1)?ns_0.substring(ns_0.lastIndexOf('/'),0):ns_0;if(ns_0.length>0)ns_l+='&ns_referrer='+escape(ns_0);if(document.images){ns_1=new Image();ns_1.src=ns_l;}else
document.write('<img src="'+ns_l+'" width="1" height="1" alt="">');}
