// Usage example:  if (Browser.isIE()) -- not:  if (Browser.isIE)
var Browser =
{
	/* Public properties */
	version		: navigator.appVersion.toLowerCase(),
	userAgent	: navigator.userAgent.toLowerCase(),
	platform	: navigator.platform.toLowerCase(),
	
	/* Public methods */
	isOpera		: public_Browser_IsOpera,
	isOpera7	: public_Browser_IsOpera7,
		
	isIE		: public_Browser_IsIE,
	isIE5		: public_Browser_IsIE5,
	isIE55		: public_Browser_IsIE55,
	isIE6		: public_Browser_IsIE6,
	isIE7		: public_Browser_IsIE7,
	isIE8		: public_Browser_IsIE8,
	
	isGecko		: public_Browser_IsGecko,
	isNS		: public_Browser_IsNS,
	isNS6		: public_Browser_IsNS6,
	isNS7		: public_Browser_IsNS7,
	
	isMozilla	: public_Browser_IsMozilla,
	
	isSafari	: public_Browser_IsSafari,
	isFirefox	: public_Browser_IsFirefox,
	isCamino	: public_Browser_IsCamino,
	isChrome	: public_Browser_IsChrome,
	
	isWindows	: public_Browser_IsWindows,
	isMac		: public_Browser_IsMac,
	isLinux		: public_Browser_IsLinux,
	
	addCSS		: public_Browser_AddCSS
}

function public_Browser_IsOpera()	{ return (this.userAgent.indexOf("opera") > -1 ) ? true : false; }
function public_Browser_IsOpera7()	{ return (this.userAgent.indexOf("opera 7") > -1 ) ? true : false; }

function public_Browser_IsIE()		{ return (this.userAgent.indexOf("msie") > -1 && !this.isOpera()) ? true : false; }
function public_Browser_IsIE5()		{ return (this.isIE() && this.userAgent.indexOf("msie 5") > -1 && this.userAgent.indexOf("msie 5.5") == -1) ? true : false; }
function public_Browser_IsIE55()	{ return (this.userAgent.indexOf("msie 5.5") > -1) ? true : false; }
function public_Browser_IsIE6()		{ return (this.userAgent.indexOf("msie 6") > -1) ? true : false; }
function public_Browser_IsIE7()		{ return (this.userAgent.indexOf("msie 7") > -1) ? true : false; }
function public_Browser_IsIE8()		{ return (this.userAgent.indexOf("msie 8") > -1) ? true : false; }

function public_Browser_IsGecko()	{ return (this.userAgent.indexOf("gecko") > -1) ? true : false; }
function public_Browser_IsNS()		{ return (this.userAgent.indexOf("netscape") > -1) ? true : false; }
function public_Browser_IsNS6()		{ return (this.isNS() && this.isGecko() && this.userAgent.indexOf("/2001") > -1) ? true : false; }
function public_Browser_IsNS7()		{ return (this.isNS() && this.isGecko() && (this.userAgent.indexOf("/2002") > -1 || this.userAgent.indexOf("/2003") > -1)) ? true : false; }

function public_Browser_IsMozilla()	{ return (this.isGecko() && !this.isNS() && this.userAgent.indexOf("mozilla/5") > -1 )? true : false; }

function public_Browser_IsSafari()	{ return (this.userAgent.indexOf("safari") > -1 ) ? true : false; }
function public_Browser_IsFirefox()	{ return (this.userAgent.indexOf("firefox") > -1 ) ? true : false; }
function public_Browser_IsCamino()	{ return (this.userAgent.indexOf("camino") > -1 ) ? true : false; }
function public_Browser_IsChrome()	{ return (this.userAgent.indexOf("chrome") > -1 ) ? true : false; }

function public_Browser_IsWindows()	{ return (this.userAgent.indexOf("win") > -1 ) ? true : false; }
function public_Browser_IsMac()		{ return (this.userAgent.indexOf("mac") > -1 ) ? true : false; }
function public_Browser_IsLinux()	{ return (this.userAgent.indexOf("linux") > -1 ) ? true : false; }

function public_Browser_AddCSS()
// Adds browser specific classes to the body element so that browser
// specific CSS rules such as ".Safari > div" can be written.
//
// Parameters:	none
//
// Returns:		null
{
	// Get the body element
	var eBody = document.getElementsByTagName("body")[0];
	
	// Browser
	if (Browser.isIE())
		eBody.className += " IE";
		
	if (Browser.isMozilla())
		eBody.className += " Mozilla";
	
	if (Browser.isSafari())
		eBody.className += " Safari";
	
	if (Browser.isFirefox())
		eBody.className += " Firefox";
	
	if (Browser.isCamino())
		eBody.className += " Camino";
	
	if (Browser.isChrome())
		eBody.className += " Chrome";
	
	// Operating System
	if (Browser.isWindows())
		eBody.className += " Windows";
	
	if (Browser.isMac())
		eBody.className += " Mac";
	
	if (Browser.isLinux())
		eBody.className += " Linux";
	
	// Specific versions
	if (Browser.isIE6())
		eBody.className += " IE6";
	
	if (Browser.isIE7())
		eBody.className += " IE7";
	
	if (Browser.isIE8())
		eBody.className += " IE8";
}