window.onload = function () {
	logStats();
};

function logStats() {

	// Prevent logging of stats if this script is being executed on the local server
	if (location.hostname === 'boris') return;

	// Create OneStat URL, using parameters to pass browser/document/OS information
	var accountId		= '538376';
	var newDate			= new Date();
	var oneStatUrl	=
			location.protocol + '//stat.onestat.com/stat.aspx?tagver=2' +
			'&sid=' + accountId +
			'&url=' + escape(document.URL) +
			'&ti='  + escape(document.title) +
			'&rf='  + escape((parent == self) ? document.referrer : top.document.referrer) +
			'&tz='  + escape(newDate.getTimezoneOffset()) +
			'&ch='  + escape(newDate.getHours()) +
			'&ul='  + escape((navigator.appName == 'Netscape') ? navigator.language : navigator.userLanguage) +
			'&jo='  + ((navigator.javaEnabled()) ? 'Yes' : 'No') +
			'&sr='  + screen.width + 'x' + screen.height +
			'&cd='  + screen.colorDepth +
			'&js=1';

	// Create image element which passes statistics to OneStat via a parameterised src attribute.
	// This technique capitalises on browser image caching; although the image is not appended to
	// the DOM, a preemptive request is made by all browsers which allows statistics to be sent
	document.createElement('img').setAttribute('src', oneStatUrl);
}
