// Calls a hit counter script on a remote server. The server's address
// is retrieved with serverip.js (which can handle dynamic addresses).
// The calling page's path and name is given as a query string to the
// counter script.

/////////// Configuration ///////////

// Counter script on the remote server (relative web root)
var g_hitCounterScript = "counter/script/one.com/hitcounter.php";

/////////// Do not change anything below this point ///////////

var g_remoteServerAddress = getServerAddress();
var g_page = window.location.pathname;

if (g_remoteServerAddress != "") {

	// If page name consists of just path and no page, extend it with
	// "index". Extension can be disregarded (cut anyway in count script)
	if (g_page.charAt(g_page.length - 1) == "/") {
		g_page = g_page.concat("index");
	}

	// Execute the counting script on remote server by loading an invisible image
	document.write("<img name='dummy' width='0' height='0'>");
	var g_url = g_remoteServerAddress + '/' + g_hitCounterScript + '?page=' + g_page;
	//document.write(g_url);
	document.images['dummy'].src = g_url;
}
else {
	// No address to server, server could be down
}
