
function doExtStats(statsid, wwwroot) {
	var protocol = getProtocol(document.URL);  
	var temp = window.location.href.split("/");
    var domainandport = temp[2];  
	var rootbase = protocol + '//' + domainandport + wwwroot + 'stats/extstats.php?statsid=' + statsid + '&url=';  
	//alert(rootbase + statsid);
	document.write(  
	        '<img style="display:none;height:1;width:1" src="'+rootbase+escape(location.href)+  
	        '&rf='+escape(document.referrer)+  
	        '&event=load'+  
	        '&e='+getCookiesEnabled()+  
	        '&s='+screen.width+'X'+screen.height+  
	        '&c='+screen.colorDepth+  
	        '&n='+navigator.appName+  
	        '&j='+navigator.javaEnabled()+  
	        '&f='+screen.fontSmoothingEnabled+  
	        '" border="0">'
	);  
}

function getProtocol(url) {  
          if (url.substring(0, 5) == "http:") {  
                return "http:";  
          }  
          else if (url.substring(0, 6) == "https:") {  
                return "https:";  
          }  
          else {  
                return "unknown";  
          }  
  }  

function getCookiesEnabled() {  
        cookievar = "ABC123";  
        SetCookie ('tracker_id', cookievar, 56);  
        if (GetCookie('tracker_id') == cookievar) {  
                return "Y";  
        } else {  
                return "N";  
        }  
}  

function GetCookie(cookieName) {  
        var theCookie=""+document.cookie;  
        var ind=theCookie.indexOf(cookieName);  
        if (ind==-1 || cookieName=="") return null;  
        var ind1=theCookie.indexOf(';',ind);  
        if (ind1==-1) ind1=theCookie.length;  
        return unescape(theCookie.substring(ind+cookieName.length+1,ind1));  
}  

function SetCookie(cookieName,cookieValue,nDays) {  
        var today = new Date();  
        var expire = new Date();  
        if (nDays==null || nDays==0) nDays=1;  
        expire.setTime(today.getTime() + 3600000*24*nDays);  
        document.cookie = cookieName + "=" +escape(cookieValue) + ";expires="+expire.toGMTString();  
}  

