// (c) 2007 by Rob Jansman, http://www.xs4all.nl/~rjansman/ict

function CClientInfo()
{
	// convert all characters to lowercase to simplify testing
	var v = navigator.appVersion.toLowerCase();
	var a = navigator.userAgent.toLowerCase();

	this.name = navigator.appName;

	if (a.indexOf("msie") != -1)
	{
		this.ie = true;
		var nIndex = v.indexOf("msie") + 5;
		var sTemp = v.substring(nIndex);
		this.version = parseFloat(sTemp);
	}
	else
		this.version = parseFloat(v);
	if (this.version.toString().indexOf(".") == -1)
		this.version += ".0";

	this.major = parseInt(this.version);

	if (this.ie)
	{
		if (this.major >= 7)
		{
			this.ie7 = true;
			this.png = true;
		}
		else if (this.major == 6)
			this.ie6 = true;
		else if (this.major == 5)
			this.ie5 = true;
		else if (this.major == 4)
		{
			this.ie4 = true;
			if (this.version == 4.5)
				this.ie45 = true;
		}
	}
	else
	{
		if (a.indexOf("opera") != -1)
			this.opera = true;
		if (a.indexOf("firefox") != -1)
			this.firefox = true;
		if (a.indexOf("safari") != -1)
			this.safari = true;

		if ((a.indexOf("mozilla") != -1) && (a.indexOf("spoofer") == -1) && (a.indexOf("compatible") == -1))
		{
			this.ns = true;
			if (this.major >= 5)
			{
				this.gecko = true;
				this.png = true;
			}
			else if (this.version >= 4.03)
				this.ns4 = true;
			if ((this.major == 5) || this.opera)
				this.ns6 = true;
		}
	}

  	if (a.indexOf("macintosh") != -1)
	{
		this.mac = true;
		this.png = true;
	}
  	else if (a.indexOf("win") != -1)
	{
		this.win = true;
		if (this.ie)
		{
			if (this.version >= 5.5)
				this.ie55win = true;
			if (this.version >= 4.0)
				this.ie4win = true;
		}
	}

	if (this.ie)
	{
		if ((this.ie4 && !this.mac) || this.ie45 || this.ie5)
			this.ie4comp = true;
		else if (this.major > 5)	// moet steeds gecontroleerd worden bij nieuwe versies IE
			this.ie4comp = true;
	}
	else if (this.ns4)
		this.ns4comp = true;
	else if (this.gecko || this.ns6)
		this.ns6comp = true;
}

CClientInfo.prototype.PromptToUpgrade = function()
{
	document.write("<h2 align=\"center\"><u>OEPS, DIT LUKT NIET!</u></h2><br />");
	document.write("Je maakt gebruik van versie ");
	document.write(this.version + " van " + this.name);
	document.write(". De website die je nu wilt bekijken vraagt echter om een hogere versie.<br /><br />");
	document.write("Op de websites van ");
	document.write("<a href=\"http://www.microsoft.com/windows/ie_intl/nl/download/\" target=\"_top\">Microsoft</a> ");
	document.write("en <a href=\"http://www.netscape.com/nl/download/\" target=\"_top\">Netscape</a> ");
	document.write(" kun je gratis de laatste browserversies downloaden.");
}

CClientInfo.prototype.Alert = function()
{
	var sAlert = "BROWSER INFORMATION:\n";
	for (var prop in this)
	{
		if  (typeof(this[prop]) != "function")
			sAlert += prop + ": " + this[prop] + "\n";
	}
	alert(sAlert);
}

var browser = new CClientInfo();

//browser.Alert();