var kSitestatServerUrl = "http://nl.sitestat.com";
var kSitestatClient = "vvk";
var kSitestatProject = "kvk";
var kSitestatClickIn = "clickin";



function ns_onclick (a, url, name, type, winopt)
{
	var ns_l = 'http://nl.sitestat.com/vvk/kvk/s?';
	ns_l += name;
	ns_l += '&ns_type=' + type + '&ns_action=view';
	ns_l += '&ns__t=' + (new Date()).getTime();
	
	//alert("url: " + url);

	if(!url) {
		url = a.href;
	}
	
	var ns_0 = document.referrer;
	
	if(ns_0.lastIndexOf('/') == ns_0.length-1) {
		ns_0=ns_0.substring(ns_0.lastIndexOf('/'),0);
	}
	
	if (ns_0.length>0) {
		ns_l+='&amp;ns_referrer='+escape(ns_0);
	}
	var ns_c=!a.target?"location.href='"+url+"';":"window.open('"+url+"','"+a.target+"','"+winopt+"');";

	var ns_i = new Image();	
	ns_i.src=ns_l;

	var popupURL = document.location.protocol + "//" + document.location.host + "/#";
	//alert(popupURL);
	if (url != popupURL) 
	{

		ns_i.onload=new Function(ns_c);

		if(a.target) {
			ns_i.onload();
		}
		else {
			setTimeout(ns_c, 5000);
		}

	}

	
}


/*
	This function checks if the user regio cookie is not empty and it so it updates the statistics counter with "regio=utrecht"
*/
function UpdateCounterNameWithRegion()
{
	
	var sSelectedRegion;
	sSelectedRegion = "";
	
	if (GetCookie('selectedRegion')) {
		sSelectedRegion = GetCookie('selectedRegion');
		sSelectedRegion = sSelectedRegion.toLowerCase();		
	}
					
	if (sSeletedRegion == "") {
		return;	
	}
	
	document.getElementById('BinaryLinkUrl').href = document.getElementById('BinaryLinkUrl').href + "&regio=" + sSelectedRegion;

}
