﻿/* Lynchpin Data Collection JavaScript Library */
/* (c) Lynchpin Analytics Limited 2009, All Rights Reserved */
LYPN = function(hash) { this.hash = hash };
LYPN.prototype.data = new Array();
LYPN.prototype.baseurl = '//trk.lypn.net/exp/';
LYPN.prototype.protocol = document.location.protocol;
LYPN.prototype.random = escape(Math.random());
LYPN.prototype.getcookie = function(cname)
{
    var d = document.cookie;
    var j = d.indexOf(cname + '='); if (j > -1)
    {
        k = d.indexOf(';', j + cname.length + 1);
        return d.substring(j + cname.length + 1, (k > 0) ? k : d.length);
    } else { return ''; } 
}
LYPN.prototype.parameters = function()
{
    var x = ''; for (var i in this.data)
    { x = x + '&' + i + '=' + escape(this.data[i]); } return x + '&rnd=' + this.random;
}
LYPN.prototype.request = function()
{
    return this.protocol + this.baseurl +
'?sid=' + this.hash + this.parameters();
}
LYPN.prototype.log = function() { var i = new Image(1, 1); i.src = this.request(); }
LYPN.prototype.init = function() { this.log(); }
