var cmxbrowser = new cmxBrowser();

function cmxBrowser()
{
	//Private variables
	var _userAgent = navigator.userAgent.toLowerCase();

	//Public properties
	this.flash = new _Flash();
	this.ie = (_userAgent.indexOf("msie") != -1);	
	this.ie5 = (this.ie && (this.major == 4) && (_userAgent.indexOf("msie 5.0") != -1));
	this.ie5mac = (this.mac && (_userAgent.indexOf("msie") != -1) && (this.major > 3));
	this.ie6 = (this.ie && (this.major == 4) && (_userAgent.indexOf("msie 6.0") != -1));
	this.safari = (_userAgent.indexOf("safari") != -1);
	this.firefox = (_userAgent.indexOf("firefox") != -1);
	this.mac = (_userAgent.indexOf("mac") != -1);
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.nav = ((_userAgent.indexOf('mozilla') != -1) 
		&& (_userAgent.indexOf('spoofer') == -1) 
		&& (_userAgent.indexOf('compatible') == -1) 
		&& (_userAgent.indexOf('opera') == -1) 
		&& (_userAgent.indexOf('webtv') == -1) 
		|| (_userAgent.indexOf('netscape') != -1));
	this.nav4 = (this.nav && (this.major == 4));
	this.nav4up = (this.nav && (this.major >= 4));
	this.nav6 = (this.nav && (this.major == 5));
	this.opera = (_userAgent.indexOf("opera") != -1);
	this.supportsDOM = (document.all || document.getElementById);
	this.supportsLayers = (document.layers);
	this.webtv = (_userAgent.indexOf("webtv") != -1);

	//Private functions
	function _Flash()
	{
		var _hasPlugin = false;

		this.installed = false;
		this.version = 0;
	
		try 
		{
			if (navigator.plugins && navigator.plugins.length) 
			{
				_hasPlugin = navigator.plugins["Shockwave Flash"];
				
				if (_hasPlugin) 
				{
					this.installed = true;
					
					if (_hasPlugin.description) 
					{
						var pluginDescription = _hasPlugin.description;
						this.version = pluginDescription.charAt(pluginDescription.indexOf('.') -1);
					}
				}
				else
					this.installed = false;
					
				if (navigator.plugins["Shockwave Flash 2.0"]) 
				{
					this.installed = true;
					this.version = 2;
				}
			}
			else if (navigator.mimeTypes && navigator.mimeTypes.length) 
			{
				_hasPlugin = navigator.mimeTypes['application/x-shockwave-flash'];
				
				if (_hasPlugin && _hasPlugin.enabledPlugin)
					this.installed = true;
				else
					this.installed = false;
			}
			else
			{
				for (var i = 0; i <= 7; i++) 
				{
					try 
					{
						var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
						this.version = i;															
					}
					catch(e) {}
				}
				
				if (this.version != 0)
					this.installed = true;
				else
					this.installed = false;
			}
		}
		catch(e) {}
	}
}

