// $Id: site.js,v 1.2 2009/09/20 16:41:07 cmanley Exp $
// Requires:
// CookieJar.js


var Site = new (function() {
})();


// Check if session cookie is present. If not present, then page was loaded from browser or google cache and is probably invalid.
xAddEventListener(this, 'load',
	function() {
		var name = 'pepernoot';
		if (CookieJar.contains('PHPSESSID') || CookieJar.contains(name)) {
			return;
		}
		CookieJar.store(name, 1);
		if (CookieJar.contains(name)) {
			var host = location.hostname.toLowerCase();
			if ((host.indexOf('bewust') >= 0) || (host.indexOf('mosacare') >= 0)) {
				//location.reload(true);
				location.href = '/';
				return;
			}
		}
		else {
			/*
			if (!window.opera && /MSIE (\d+\.\d+)/.test(navigator.userAgent) && (RegExp.$1 < 7)) {
				// Don't show warning in old IE browsers because document.cookie sometimes incorrectly returns an empty string: http://support.microsoft.com/kb/820536
				return;
			}
			*/
			var e = document.getElementById('headerCookieMsg');
			if (e) {
				e.innerHTML = 'Helaas kunt u op dit moment niet inloggen doordat uw browser geen cookies aan heeft staan.';
				e.style.display = '';
			}
		}
	},
	false
);

