// cBrowser - Class to identify browser - Copyright (C) 2007-2010
//
// Assumes:  if isTrulyIE exists, browser is IE

function cBrowser ( ua )
{
if ( arguments.length == 0 )
	ua = navigator.userAgent;
this.ua = ua.toLowerCase();
if ( typeof(isTrulyIE) != 'undefined' )
  {
	this.isIE = true;
	this.isKhtml = this.isChrome = this.isSafari = this.isOpera = this.isGecko = this.isNetscape = this.isWebtv = false;
  }
else
  {
	this.isKhtml = (this.ua.indexOf("khtml") != -1);
	this.isChrome = (this.ua.indexOf("chrome/") != -1);
	this.isSafari = (this.ua.indexOf("safari") != -1);
	this.isOpera = (this.ua.indexOf("opera") != -1);
	this.isGecko = !this.isKhtml && !this.isChrome && !this.isSafari && !this.isOpera
		&& (this.ua.indexOf("gecko/") != -1);
	this.isNetscape = !this.isKhtml && !this.isOpera &&
	  ( (this.ua.indexOf('mozilla')!=-1)
		&& ((this.ua.indexOf('spoofer')==-1)
		&& (this.ua.indexOf('compatible')==-1)) );
	this.isWebtv = (this.ua.indexOf("webtv")!=-1);
	this.isIE = !this.isWebtv && !this.isOpera && (this.ua.indexOf("msie") != -1);
	this.version = parseFloat(navigator.appVersion);
	if ( this.isNetscape && (this.version>=5) )
		this.isGecko = true;
  }
if ( this.isIE )
	this.version = new cVersion( parseFloat(this.ua.substring(4+this.ua.indexOf("msie"))) );
else if ( this.isOpera )
  {
	if ( this.ua.indexOf('version/') != -1 )
		this.version = new cVersion( parseFloat(this.ua.substring(8+this.ua.indexOf("version/"))) );
	else if ( this.ua.indexOf('opera/') == 0 )
		this.version = new cVersion( parseFloat(this.ua.substring(1+this.ua.indexOf("/"))) );
	else if ( this.ua.indexOf("opera/") != -1 )
		this.version = new cVersion( parseFloat(this.ua.substring(2+this.ua.indexOf(")"))) );
	else
		this.version = new cVersion( parseFloat(this.ua.substring(6+this.ua.indexOf("opera/"))) );
  }
}

