function BrowserDetect(){
	this.browser = "";
	this.OS = "";
	this.version = "";
	this.total = "";
	this.thestring = "";	
	this.detect = navigator.userAgent.toLowerCase();
	this.place = "";
}


BrowserDetect.prototype = new Object;

BrowserDetect.prototype.initialize = function()
{

	if (this.checkIt('konqueror'))
	{
		this.browser = "Konqueror";
		this.OS = "Linux";
	}
	else if (this.checkIt('safari')) this.browser = "Safari"
	else if (this.checkIt('omniweb')) this.browser = "OmniWeb"
	else if (this.checkIt('opera')) this.browser = "Opera"
	else if (this.checkIt('webtv')) this.browser = "WebTV";
	else if (this.checkIt('icab')) this.browser = "iCab"
	else if (this.checkIt('msie')) this.browser = "Internet Explorer"
	else if (!this.checkIt('compatible'))
	{
		this.browser = "Netscape Navigator"
		this.version = this.detect.charAt(8);
	}
	else this.browser = "An unknown browser";
	
	this.version = this.detect.charAt(this.place + this.thestring.length);
	
	if (this.checkIt('linux')) this.OS = "Linux";
	else if (this.checkIt('x11')) this.OS = "Unix";
	else if (this.checkIt('mac')) this.OS = "Mac"
	else if (this.checkIt('win')) this.OS = "Windows"
	else this.OS = "an unknown operating system";
	
}

BrowserDetect.prototype.checkIt = function(string)
{
	this.place = this.detect.indexOf(string) + 1;
	this.thestring = string;
	return this.place;
}

var gBrowserDetect = new BrowserDetect();
gBrowserDetect.initialize();


