/*
From Dynamic Drive & modified to be a class.
The script returns a set of browser variables (Below are live results dependant on your browser type): 

var 	returns 	Description 
   
ie 	1 			Internet Explorer 4+ and IE-based third-party browsers. You can also be more specific:  
ie4 0 ... Internet Explorer 4 only.  
ie5 1 ... Internet Explorer 5 or 6.  
ie6 0 ... Internet Explorer 6 only.  

  
ns4 0 Netscape 4  

  
ns6 0 Gecko and KDE-based browsers - which includes Netscape 6 and 7, Mozilla, Konqueror and Safari. You can also identify smaller groups within this: 
ns7 0 ... Netscape 7.  
mz7 0 ... any gecko browser except Netscape. This is principally designed to identify Mozilla's own builds from Version 0.6 onwards, but it also returns true for any other non-netscape gecko browser.  
kde 0 ... Konqueror, from KDE 2.2 onwards.  
saf 0 ... Safari. This variable will identify Safari irrespective of which browser it's set to identify as.  

  
op5 0 Opera 5  
op6 0 Opera 6  
op7 0 Opera 7 
These variables will identify Opera irrespective of which browser it's set to identify as. 
 

Underpinning these is a safety variable, for protecting legacy browsers:

exclude 0  

There are also three OS variables: 

   
win 1 Windows  
mac 0 Mac OS  
lin 0 Linux, or anything else  

and you can query a lower-case version of the user agent string:

  
agt mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 1.1.4322; infopath.2)  

The sniffer variables are global, and therefore available to any other scripts on the same page.

*/

var ThisBrowser = Class.create();
ThisBrowser.prototype = {
	initialize: function(elt) {
		this.exclude=1;
		this.agt=navigator.userAgent.toLowerCase();
		this.win=0;
		this.mac=0;
		this.lin=1;
		if(this.agt.indexOf('win')!=-1){this.win=1;this.lin=0;}
		if(this.agt.indexOf('mac')!=-1){this.mac=1;this.lin=0;}
		this.lnx=0;if(this.lin){this.lnx=1;}
		this.ice=0;
		this.ie=0;this.ie4=0;this.ie5=0;this.ie6=0;this.com=0;this.dcm;
		this.op5=0;this.op6=0;this.op7=0;
		this.ns4=0;this.ns6=0;this.ns7=0;this.mz7=0;this.kde=0;this.saf=0;
		if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
			this.thisKDE=this.agt;
			this.splitKDE=this.thisKDE.split("konqueror/");
			this.aKDE=this.splitKDE[1].split("; ");
			this.KDEn=parseFloat(this.aKDE[0]);
			if(this.KDEn>=2.2){
				this.kde=1;
				this.ns6=1;
				this.exclude=0;
				}
			}
		else if(this.agt.indexOf('webtv')!=-1){this.exclude=1;}
		else if(typeof window.opera!="undefined"){
			this.exclude=0;
		if(/opera[\/ ][5]/.test(this.agt)){this.op5=1;}
		if(/opera[\/ ][6]/.test(this.agt)){this.op6=1;}
		if(/opera[\/ ][7-9]/.test(this.agt)){this.op7=1;}
		}
	else if(typeof document.all!="undefined"&&!this.kde){
		this.exclude=0;
		this.ie=1;
		if(typeof document.getElementById!="undefined"){
			this.ie5=1;
			if(this.agt.indexOf("msie 6")!=-1){
				this.ie6=1;
				this.dcm=document.compatMode;
				if(this.dcm!="BackCompat"){this.com=1;}
				}
			}
		else{this.ie4=1;}
		}
	else if(typeof document.getElementById!="undefined"){
		this.exclude=0;
		if(this.agt.indexOf("netscape/6")!=-1||this.agt.indexOf("netscape6")!=-1){this.ns6=1;}
		else if(this.agt.indexOf("netscape/7")!=-1||this.agt.indexOf("netscape7")!=-1){this.ns6=1;this.ns7=1;}
		else if(this.agt.indexOf("gecko")!=-1){this.ns6=1;this.mz7=1;}
		if(this.agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){this.mz7=0;this.ns6=1;this.saf=1;}
		}
	else if((this.agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
		this.exclude=0;
		this.ns4=1;
		if(typeof navigator.mimeTypes['*']=="undefined"){
			this.exclude=1;
			this.ns4=0;
			}
		}
	if(this.agt.indexOf('escape')!=-1){this.exclude=1;this.ns4=0;}
	if(typeof navigator.__ice_version!="undefined"){this.exclude=1;this.ie4=0;}
	}
};

var TheBrowser = new ThisBrowser;
