function JHPBrowser() {
	this.isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
	this.isOpera = navigator.userAgent.indexOf("Opera") != -1;
	this.isNetscape = navigator.userAgent.indexOf("Netscape") != -1 && !this.isFirefox && !this.isOpera;

	this.isExplorer = navigator.appName == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("MSIE") != -1 && !this.isFirefox && !this.isOpera && !this.isNetscape;
	this.isMozilla = navigator.appCodeName == "Mozilla" && !this.isFirefox && !this.isOpera && !this.isExplorer && !this.isNetscape;

	this.browserVersionString;
	this.getBrowserName = _getBrowserName;
	this.getBrowserVersion = _getBrowserVersion;

	this.debugStr = _debugStr;


	function _getBrowserName() {
		if(this.isFirefox) {
			return "Firefox";
		} else if(this.isMozilla) {
			return "Mozilla";
		} else if(this.isNetscape) {
			return "Netscape";
		} else if(this.isOpera) {
			return "Opera";
		} else if(this.isExplorer) {
			return "MS Explorer";
		} else {
			return "not exactly identified ("+navigator.userAgent+")";
		}

	}

	function _getBrowserVersion() {
		var i,j;
		if(this.isFirefox) {
			i = navigator.userAgent.indexOf("Firefox");
			i+= 8;
			this.browserVersionString = navigator.userAgent.substr(i);
			return parseFloat(this.browserVersionString);

		} else if(this.isMozilla) {
			i = navigator.userAgent.indexOf("rv:");
			i+= 3;
			this.browserVersionString = navigator.userAgent.substr(i);
			j = this.browserVersionString.indexOf(")");
			this.browserVersionString = this.browserVersionString.substr(0,j);
			return parseFloat(this.browserVersionString);
		} else if(this.isNetscape) {
			i = navigator.userAgent.indexOf("Netscape");
			i+= 9;
			this.browserVersionString = navigator.userAgent.substr(i);
			return parseFloat(this.browserVersionString);
		} else if(this.isOpera) {
			i = navigator.userAgent.indexOf("Opera");
			i+= 6;
			this.browserVersionString = navigator.userAgent.substr(i);
			return parseFloat(this.browserVersionString);
		} else if(this.isExplorer) {
			i = navigator.userAgent.indexOf("MSIE");
			i+= 5;
			this.browserVersionString = navigator.userAgent.substr(i);
			j = this.browserVersionString.indexOf(";");
			this.browserVersionString = this.browserVersionString.substr(0,j);
			return parseFloat(this.browserVersionString);
		} else {
			return 0;
		}

	}

	function _debugStr() {
		return "You are surfing with " + this.getBrowserName()+" Version " + this.getBrowserVersion() +" ("+this.browserVersionString+")";
	}


}

var Browser = new JHPBrowser();



