// Grab Wordpress stats and send, asynchronously, to server database
function recordPageStats(prevHash, thisHash, dbTable) {
	// Direct information
	currentTime = new Date();
	var stats = {
		tableName: dbTable,
		referrerPage: document.referrer,  		// complete with all GET information so we see Google search terms etc
		prevPage: prevHash,
		currPage: thisHash,
		millisecs: (currentTime.getTime()).toString(),
		browserType: (BrowserDetect.browser).toString(),
		browserVersion: (BrowserDetect.version).toString(),
		opSys: (BrowserDetect.OS).toString(),
		language: (navigator.language || navigator.systemLanguage || navigator.browserLanguage || "unknown language").toString(),
		screenColors: (screen.pixelDepth+" "+screen.colorDepth).toString(),
		screenResolution: (screen.width+'x'+screen.height).toString(),
		connectionSpeed: ""};  					// can't do this without actually sending data and measuring time? 	
	$.ajax({
		url:'../../../../../php/addStats.php',
		type:'POST',
		data:stats,
		dataType:'html'
		//, success: function(r) { alert(r); }
	});
	return true;
}

$(document).ready(function(){
	// Record this page's stats
	recordPageStats("n/a", window.location.href, "PE_pageStats");
});