var lgtoday = new Date(); 
var lgzero_date = new Date(0,0,0); 
lgtoday.setTime(lgtoday.getTime() - lgzero_date.getTime()); 
var cookie_expire_date = new Date(lgtoday.getTime() + (8 * 7 * 86400000));

function lgGet_Cookie(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
   if (start == -1) return null; 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length; 
   return unescape(document.cookie.substring(len,end)); 
}
function lgSet_Cookie(name,value,expires,path,domain,secure) { 
    var cookieString = name + "=" +escape(value) + ";path=/" +
       ( (expires) ? ";expires=" + expires.toGMTString() : "") + 
       ( (domain) ? ";domain=" + domain : "") + 
       ( (secure) ? ";secure" : ""); 
    document.cookie = cookieString; 
}
function lggetVisitorID() { 
   if (!lgGet_Cookie('NewLogaholic_VID')) {
       var lgvid = Math.floor(Math.random() * (navigator.userAgent.length * 1000000000));
       lgSet_Cookie('NewLogaholic_VID',lgvid,cookie_expire_date);        
   }
   return lgGet_Cookie('NewLogaholic_VID'); 
}
function lggetSessionID() { 
   if (!lgGet_Cookie('NewLogaholic_SESSION')) {
       var lgses = Math.floor(Math.random() * (navigator.userAgent.length * 1000000000));
       lgSet_Cookie('NewLogaholic_SESSION',lgses);
       return lgGet_Cookie('NewLogaholic_SESSION') + "&newses=1";        
   } else {
       return lgGet_Cookie('NewLogaholic_SESSION');
   } 
}
function trackPage() {
    var logaholic = "";
    logaholic = "referrer=" + escape(window.document.referrer) + "&visitorid=" + lggetVisitorID() + "&sessionid=" + lggetSessionID();
    if(window.screen) {  logaholic +="&w=" + window.screen.width + "&h=" + window.screen.height + "&cd=" + window.screen.colorDepth;  }
    if(document.title) {  logaholic +="&docTitle=" + escape(document.title);  }
    var logatr = new Image();
    logatr.src = lwa_server + 'includes/trackPage.php?conf=' + lwa_profile + '&' + logaholic;
}

