function sitestat_log(category)
{
    // Only log for users with the cookie set
    if (document.cookie.indexOf('ns_Cfilter') == -1) {
        return;
    }

    var url = "http://nl.sitestat.com/autointeractive/autokopen/s?" + category + "&ns__t=" + (new Date()).getTime();
    var ref = document.referrer;
    ref = (ref.lastIndexOf("/") == ref.length-1) ? ref.substring(ref.lastIndexOf("/"), 0) : ref;
    if (ref.length > 0) {
        url += "&ns_referrer=" + escape(ref);
    }
    var img = new Image();
    img.src = url;
}


function stir_log(path) {

    // comScore Inline Tag 1.1105.27
    function comScore(t){var b="comScore",o=document,f=o.location,a="",e="undefined",g=2048,s,k,p,h,r="characterSet",n="defaultCharset",m=(typeof encodeURIComponent!=e?encodeURIComponent:escape);if(o.cookie.indexOf(b+"=")!=-1){p=o.cookie.split(";");for(h=0,f=p.length;h<f;h++){var q=p[h].indexOf(b+"=");if(q!=-1){a="&"+unescape(p[h].substring(q+b.length+1))}}}t=t+"&ns__t="+(new Date().getTime());t=t+"&ns_c="+(o[r]?o[r]:(o[n]?o[n]:""))+"&c8="+m(o.title)+a+"&c7="+m(f&&f.href?f.href:o.URL)+"&c9="+m(o.referrer);if(t.length>g&&t.indexOf("&")>0){s=t.substr(0,g-8).lastIndexOf("&");t=(t.substring(0,s)+"&ns_cut="+m(t.substring(s+1))).substr(0,g)}if(o.images){k=new Image();if(typeof ns_p==e){ns_p=k}k.src=t}else{o.write(["<","p","><",'img src="',t,'" height="1" width="1" alt="*"',"><","/p",">"].join(""))}};

    var stir_path;
    if (path === null) {
        stir_path = '';

        // Auto-detect stir-path
        var parts = document.location.pathname.substring(1).split(/\//);
        if (parts[0] !== undefined) {

            var stir_mapping = {
                '': 'homepage',
                'tweedehands-auto': 'voorraad-tweedehands',
                'voorraad-nieuw': 'voorraad-nieuw',
                'nieuw': 'nieuwe-auto',
                'autobedrijven': 'autobedrijven',
                'autonieuws': 'redactie',
                'autotests': 'redactie',
                'acties': 'redactie',
                'columns': 'redactie',
                'video': 'redactie',
                'fotoreportage': 'redactie',
                'fun': 'redactie',
                'autoshows': 'redactie',
                'evenementen': 'redactie',
                'merk': 'merkpagina',
                'financieren': 'financieel',
                'verzekeren': 'financieel',
                'diensten': 'b2b'
            };
            stir_path = stir_mapping[parts[0]];
            if (stir_path === undefined) {
                stir_path = '';
            }
        }
    }
    else {
        stir_path = path;
    }
    comScore('http'+(document.location.href.charAt(4)=='s'?'s://sb':'://b')+'.scorecardresearch.com/p?c1=2&c2=12293613&c5=' + stir_path);
}


