window.UserAgent = new function() {

	var FALSE = false, SPACE = ' ', TRUE = true,
		cls = [],
		fp = navigator.plugins['Shockwave Flash'],
		fv = fp ? parseInt( fp.description.replace( /\D*(\d+)\s*/, '$1' ) ) : 0,
		k, o = this,
		ua = navigator.userAgent.toLowerCase();

	function test( re ) { return re.test( ua ); }

	o.secure = location.protocol.toLowerCase() == 'https:';
	o.strict = document.compatMode == "CSS1Compat";
	o.quirks = !o.strict;
	o.opera = test( /opera/ );
	o.chrome = test( /chrome/ );
	o.webkit = test( /webkit/ );
	o.win = test( /windows|win32/ );
	o.mac = test( /macintosh|mac os x/ );
	o.air = test( /adobeair/ );
	o.linux = test( /linux/ );
	o.safari = !this.chrome && test( /safari/ );
	o.safari3 = this.safari && test( /version\/3/ );
	o.safari4 = this.safari && test( /version\/4/ );
	o.ie = /*@cc_on!@*/FALSE;
	o.ie6 = this.ie && test( /msie 6/ );
	o.ie7 = this.ie && test( /msie 7/ );
	o.ie8 = this.ie && test( /msie 8/ );
	o.gecko = !this.webkit && test( /gecko/ );
	o.gecko3 = this.gecko && test( /rv:1\.9/ );
	o.gecko35 = this.gecko3 && !!document.querySelectorAll;
	o.gecko36 = this.gecko35 && test( /rv:1\.9.2/ );

	o.flash = !!fp;
	o['flash' + fv] = !!fv;

	for ( k in o ) // we loop through the scope (this)
		if ( o[k] === TRUE ) // we only want the keys of the values which equate to "true"
			cls.push( k );

	document.documentElement.className += SPACE + cls.join( SPACE ); // now we can assign the classes to the documentElement. i.e. the html tag
};
