function CBrowser()
{
	this.m_sName=new String();
	this.m_iVersion=new Number();
	this.m_iRelease=new Number();
	this.m_bVersionDefined=new Boolean();
	this.m_sUserAgent=new String();
				
	this.GetName=CBrowser_GetName;
	this.GetAddName=CBrowser_GetAddName;
	this.GetFullName=CBrowser_GetFullName;
	this.GetVersion=CBrowser_GetVersion;
	this.GetRelease=CBrowser_GetRelease;
	this.GetFullVersion=CBrowser_GetFullVersion;
	this.VersionDefined=CBrowser_VersionDefined;
	this.isIE=CBrowser_isIE;
	this.isNN=CBrowser_isNN;
	this.isUnknown=CBrowser_isUnknown;

	this.$SetVersion=CBrowser_$SetVersion;
	this.$Init=CBrowser_$Init;	
	
	this.$Init();
}

function CBrowser_$Init()
{
	this.m_sName=navigator.appName;
	this.m_sUserAgent=navigator.userAgent;
	this.$SetVersion();
}

function CBrowser_$SetVersion()
{
	var
		sVersion=navigator.appVersion,
		iInd;
	if (this.isIE()){
		iInd=sVersion.indexOf("MSIE");
		if (iInd!=-1)		
			sVersion=sVersion.substr(iInd+5);
	}
	this.m_iVersion=parseInt(sVersion);
	if (isNaN(this.m_iVersion)){
		this.m_iRelease=this.m_iVersion;
		this.m_bVersionDefined=false;
	}
	else{
		iInd=sVersion.indexOf(".");
		if (iInd!=-1){
			this.m_iRelease=parseInt(sVersion.substr(iInd+1));
			if (isNaN(this.m_iRelease))
				this.m_iRelease=0;
		}	
		else
			this.m_iRelease=0;
		this.m_bVersionDefined=true;		
	}
}

function CBrowser_GetName()
{
	return this.m_sName
}

function CBrowser_GetAddName()
{
	return this.m_sUserAgent;
}

function CBrowser_GetFullName()
{
	return this.GetName()+"/"+this.GetAddName();
}

function CBrowser_GetVersion()
{
	return this.VersionDefined() ? this.m_iVersion : "";
}

function CBrowser_GetRelease()
{
	return this.VersionDefined() ? this.m_iRelease : "";
}

function CBrowser_GetFullVersion()
{
	return this.VersionDefined() ? this.GetVersion()+"."+this.GetRelease() : "";
}

function CBrowser_VersionDefined()
{
	return this.m_bVersionDefined;
}

function CBrowser_isIE()
{
	return this.m_sUserAgent.indexOf("MSIE")>0;
}

function CBrowser_isNN()
{
	return this.m_sName=="Netscape";
}

function CBrowser_isUnknown()
{
	return !this.isIE && !this.isNN();
}
