// *** BROWSER DETECT CLASS ***
function browser() {
  // convert all characters to lowercase to simplify testing
	this.agt = navigator.userAgent.toLowerCase();

	// *** BROWSER VERSION ***
	// Note: On IE5, these return 4, so use this.is_ie5up to detect IE5.
	this.is_major = parseInt(navigator.appVersion);
	this.is_minor = parseFloat(navigator.appVersion);
	
	// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
	// If you want to allow spoofing, take out the tests for opera and webtv.
	this.is_nav 		= ((this.agt.indexOf('mozilla')!=-1) && (this.agt.indexOf('spoofer')==-1)
  								&& (this.agt.indexOf('compatible') == -1) && (this.agt.indexOf('opera')==-1)
            			&& (this.agt.indexOf('webtv')==-1) && (this.agt.indexOf('hotjava')==-1)
            			&& (this.agt.indexOf('safari')==-1) && (this.agt.indexOf('firefox')==-1));
	this.is_nav2 		= (this.is_nav && (this.is_major == 2));
	this.is_nav3 		= (this.is_nav && (this.is_major == 3));
	this.is_nav4 		= (this.is_nav && (this.is_major == 4));
	this.is_nav4up 	= (this.is_nav && (this.is_major >= 4));
	this.is_nav6 		= (this.is_nav && (this.is_major == 5));
	this.is_nav6up	= (this.is_nav && (this.is_major >= 5));
	this.is_gecko 	= (this.agt.indexOf('gecko') != -1);

	this.is_ie     	= ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1));
	this.is_ie3    	= (this.is_ie && (this.is_major < 4));
	this.is_ie4    	= (this.is_ie && (this.is_major == 4) && (this.agt.indexOf("msie 4")!=-1));
	this.is_ie4up  	= (this.is_ie && (this.is_major >= 4));
	this.is_ie5    	= (this.is_ie && (this.is_major == 4) && (this.agt.indexOf("msie 5.0")!=-1));
	this.is_ie5_5  	= (this.is_ie && (this.is_major == 4) && (this.agt.indexOf("msie 5.5") !=-1));
	this.is_ie5up  	= (this.is_ie && !this.is_ie3 && !this.is_ie4);
	this.is_ie5_5up	= (this.is_ie && !this.is_ie3 && !this.is_ie4 && !this.is_ie5);
	this.is_ie6    	= (this.is_ie && (this.is_major == 4) && (this.agt.indexOf("msie 6.")!=-1));
	this.is_ie6up  	= (this.is_ie && !this.is_ie3 && !this.is_ie4 && !this.is_ie5 && !this.is_ie5_5);
	this.is_ie7    	= (this.is_ie && (this.is_major == 4) && (this.agt.indexOf("msie 7.")!=-1));
	this.is_ie7up  	= (this.is_ie && !this.is_ie3 && !this.is_ie4 && !this.is_ie5 && !this.is_ie5_5 && !this.is_ie6);
	
	this.is_safari 	= (this.agt.indexOf("safari") != -1);
	this.is_firefox = (this.agt.indexOf("firefox") != -1);
	if (this.is_firefox) {
		this.versionindex = this.agt.indexOf("firefox")+8;
		this.is_major = parseInt(this.agt.charAt(this.versionindex));
		this.is_minor = parseInt(this.agt.charAt(this.versionindex+2));
	}
	
	// *** PLATFORM ***
	this.is_win 		= ((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.is_mac 		= (this.agt.indexOf("mac")!=-1);
}
var browser = new browser();