// wintours.ag / Author Tim Reeves / Stand 2007-06-14

function ctrImage() {
	// The hidden counter which gathers statistics
	// Insert the URL call as the source of an image which is added via DOM
	// alert('Counter-Call');
	var ref = '';
	if (document.images && document.referrer && document.referrer.length>0)
	 { ref += escape(document.referrer); }
	var fbt = '..', cookies = ' U';
	if (screen.colorDepth && screen.colorDepth != null) {
		fbt = screen.colorDepth;
		if (fbt.length == 1) { fbt = '0' + screen.colorDepth; }
		}
	if (typeof navigator.cookieEnabled == 'boolean')
		cookies = navigator.cookieEnabled ? ' J' : ' N';
	ref += '&sh='+screen.height+'&sw='+screen.width+'&user='+fbt+cookies;
	var ctrImg = document.createElement('img');
	ctrImg.width = 1;
	ctrImg.height = 1;
	ctrImg.src = '/cgi-bin/counter.pl?id=1&rl=1800&ref=' + ref;
	// ctrImg.src = '/cgi-bin/counter.pl?id=1&rl=0&ref=' + ref;
	var ctrDiv = document.getElementById('ctrDiv');
	ctrDiv.appendChild(ctrImg);
	return;
}

function initPage() {
	// Set the window name to allow us to know if this is the inital website entry
	var re = /^Wintours_AG/;
	if (! re.test(window.name)) {
		// It IS the initial website entry - set the window name
		window.name = 'Wintours_AG';
		// And call the counter
		ctrImage();
	}
	// Caveat: Since hardly any site sets the window name, it tends to stay this way
	//         meaning that subsequent visits - even hours later - are not noted
	// The alternative is to have the counter called by EVERY page and the data is
	// not recorded by the counter software if the IP address is (time-)locked out.
	// NOTE that the window name is tab-specific in browsers with tabs
	return;
}

