
/*
CLASS: Browser
DESCRIPTION: descriptiongoeshere
*/

function Browser(){
	this.userAgent = navigator.userAgent;
	this.name = "";
	this.version;
	this.generation;
}//end function Browser

//begin class method definitions for Browser
Browser.prototype = {
	
	// get browser name and version
	getBrowser: function(){
		var tempResult;
				
		// is it IE??
		// make sure it's not Opera which sometimes reports itself as IE
		
		if ( navigator.appName.search(/Internet Explorer/i) > -1 ){
			if ( navigator.userAgent.search(/Opera\s/i) < 0 ){
				this.name = "Internet Explorer";
				tempResult = navigator.userAgent.match(/msie\s(\d+(\.\d*)*)/i);
				this.version = tempResult[1];
			} else {
				this.name = "Opera";
				tempResult = navigator.userAgent.match(/Opera\s(\d+(\.\d*))/i);
				this.version = tempResult[1];
			}//end if
		} else if ( navigator.userAgent.search(/Gecko\//i) > -1 ){
			
			if ( navigator.userAgent.search(/Netscape\//i) > -1 ){
				this.name = "Netscape";
				tempResult = navigator.userAgent.match(/Netscape\/(\d+(\.\d*)*)/i);
				this.version = tempResult[1];
			} else if ( navigator.userAgent.search(/Netscape6/i) > -1 ){
				this.name = "Netscape";
				tempResult = navigator.userAgent.match(/Netscape6\/(\d+(\.\d*)*)/i);
				this.version = tempResult[1];
			} else if ( navigator.userAgent.search(/Firefox/i) > -1 ){
				this.name = "Firefox";
				tempResult = navigator.userAgent.match(/Firefox\/(\d+(\.\d*)*)/i);
				this.version = tempResult[1];
			} else if ( navigator.userAgent.search(/Camino\//i) > -1 ){
				this.name = "Camino";
				tempResult = navigator.userAgent.match(/Camino\/(\d+(\.\d*)*)/i);
				this.version = tempResult[1];
			} else if ( navigator.userAgent.search(/Galeon\//i) > -1 ){
				this.name = "Galeon";
				tempResult = navigator.userAgent.match(/Galeon\/(\d+(\.\d*)*)/i);
				this.version = tempResult[1];
			} else if ( navigator.userAgent.search(/^Mozilla\//i) > -1 ){
				this.name = "Mozilla";
				tempResult = navigator.userAgent.match(/rv:(\d+(\.\d)*)/i);
				this.version = tempResult[1];
			} else {
				this.name = "Unknown Gecko Browser";
			}//end if
		} else if ( navigator.userAgent.search(/Safari\//i) > -1 ){
			this.name = "Safari";
			tempResult = navigator.userAgent.match(/Safari\/(\d+(\.\d)*)/i);
			var build = parseInt(tempResult[1]);
			switch (build) {
				case 100:
					this.version = "1.1";
					break;
				case 125:
					this.version = "1.2";
					break;
				case 312:
					this.version = "1.3";
					break;
				case 412:
					this.version = "2.0";
					break;
				case 85:
					this.version = "1.0";
					break;
				default:
					break;
			}//end switch
		} else if ( navigator.userAgent.search(/Konqueror\//i) > -1 ){
			this.name = "Konqueror";
			tempResult = navigator.userAgent.match(/Konqueror\/(\d+(\.\d*)*)/i);
			this.version = tempResult[1];
		} else if ( navigator.userAgent.search(/WebTV\//i) > -1 ){
			this.name = "WebTV";
			tempResult = navigator.userAgent.match(/WebTV\/(\d+(\.\d*)*)/i);
			this.version = tempResult[1];
		} else if ( navigator.userAgent.search(/Opera\s?|\/?/i) > -1 ){
			this.name = "Opera";
			tempResult = navigator.userAgent.match(/Opera\s?|\/?(\d+(\.\d*))/i);
			this.version = tempResult[1];
		} else if ( navigator.userAgent.search(/^Mozilla\/4|3|2/i) > -1 ){
			this.name = "Netscape";
			tempResult = navigator.userAgent.match(/Mozilla\/(\d+(\.\d*)*)/i);
			this.version = tempResult[1];
		} else {
			this.name = "unknown";
			this.version = "0.0";
		}//end if
	}
};
//end class method definitions for Browser
