var br = new detectAgent();
var NN = (br.shortName == "NAV");
var IE = (br.shortName == "EXP");
var OP = (br.shortName == "OPR");

function detectAgent() {
  with (navigator) {
       var tempAgent = userAgent;
	   var tempName = appName;
	   this.plainAgentStr = userAgent;
	   this.plainNameStr = appName;
	   this.plainVersionStr = appVersion;
	   if (tempAgent.indexOf('Opera')>=0) {
	      this.name = "Opera";
		  this.shortName = "OPR";
		  var tempVer = tempAgent.substring(tempAgent.indexOf("Opera") + 6, tempAgent.length);
		  this.version = tempVer.substring(0, tempVer.indexOf(" "));
          this.minorVer = this.version.substring(tempVer.indexOf(".") + 1, tempVer.length);
          this.language = tempAgent.substring(tempAgent.indexOf("[") + 1, tempAgent.indexOf("]"));
		  
	   }
       else {
	      if (tempAgent.indexOf('MSIE')>=0) {
		     this.name = "Internet Explorer";
			 this.shortName = "EXP";
             var tempVer = tempAgent.substring(tempAgent.indexOf("MSIE") + 5, tempAgent.length);
             this.version = tempVer.substring(0, tempVer.indexOf(";"));
             this.minorVer = this.version.substring(tempVer.indexOf(".") + 1, tempVer.length);
             this.language = browserLanguage;
		  }
		  else {
		    if (tempName.indexOf('Netscape')>=0) {
			   this.name = "Netscape Navigator";
			   this.shortName = "NAV"
			   this.minorVer = appVersion.substring(appVersion.indexOf(".") + 1, appVersion.indexOf(" "));
               this.language = tempAgent.substring(tempAgent.indexOf("[") +1, tempAgent.indexOf("]"));
               this.version = appVersion.substring(0, appVersion.indexOf(" "));			   
			}
			else {
			   this.name = "Unknown";
			   this.shortName = "UNK"
			}
		  }
	   }
  }
}
