// (c) 2007-2008 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;
	else if (a.indexOf("webkit") != -1)
		this.safari = true;
	else 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.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();