// browser & platform detection
// using the navigator.userAgent property
// 01/Sept/2005
// platform checks, windows, mac, symbian, (nokia)
// browser checks, IE, netscape 4+, mozilla, firefox, opera, safari(mac)

var agt=navigator.userAgent.toLowerCase();
var appvers = navigator.appVersion;
var nappname = navigator.appName;

var strBrowserType = "";
var strVersion = "";

// platforms, all boolean values
var bMac = (appvers.indexOf('Mac')!=-1);
var bWin = ( ( (appvers.indexOf('Win')!=-1) || (appvers.indexOf('NT')!=-1) ) && !bMac)?true:false;
var bSymbian = (agt.indexOf("symbian")!=-1);
var bNokia = (agt.indexOf("nokia")!=-1);
// browsers, all boolean values
var bGecko = false;
var bIE = false;
var bFirefox = false;
var bMozillaSuite = false;
var bNetscape4 = false;
var bNetscapeNew = false;
var bOpera = false;
var bSafari = false;
var bOtherBrowser = false;
//version, float value
var fVersion = 0.0;

// OPERA
if (agt.indexOf("opera")>-1){
	strBrowserType = "Opera";
	strVersion = agt.substr(agt.indexOf("opera")+6);
	bOpera = true;
	fVersion = parseFloat(strVersion);
// GECKO (Mozilla, Netscape 6+, Firefox, Safari)
} else if (agt.indexOf("gecko")>-1){
	strBrowserType = "Gecko based";
	bGecko = true;
	if (agt.indexOf("firefox")>-1){
		strBrowserType += ": Firefox";
		strVersion = agt.substr(agt.indexOf("firefox")+8);
		bFirefox = true;
		
	} else if (agt.indexOf("netscape")>-1){
		strBrowserType += ": Netscape";
		strVersion = agt.substr(agt.indexOf("netscape")+9);
		bNetscapeNew = true;
		
	} else if (agt.indexOf("mozilla")>-1 && agt.indexOf("rv:")>-1){
		strBrowserType += ": Mozilla";
		strVersion = agt.substr(agt.indexOf("rv:")+3 , 5);
		bMozillaSuite = true;
		
	} else if (agt.indexOf("safari")>-1){
		strBrowserType += ": Safari";
		strVersion = agt.substr(agt.indexOf("safari")+7);
		bSafari = true;
	} else {
		strBrowserType += ": Unknown";
	}
	fVersion = parseFloat(strVersion);
// IE
} else if (agt.indexOf("msie")>-1){
	strBrowserType = "IE";
	strVersion = agt.substr(agt.indexOf("msie")+5 , 3);
	bIE = true;
	if (agt.indexOf("msie 4")>-1) browser = "ie4";
	else if (agt.indexOf("msie 5.0")>-1) browser = "ie50";
	else if (agt.indexOf("msie 5.5")>-1) browser = "ie55";
	else if (agt.indexOf("msie 6")>-1) browser = "ie6";
	else if (agt.indexOf("msie 7")>-1) browser = "ie7";
	fVersion = parseFloat(strVersion);
// Netscape 4
} else if (agt.indexOf("mozilla/4.")>-1){
	strBrowserType = "Netscape 4";
	strVersion = agt.substr(agt.indexOf("mozilla/4.")+8 , 4);
	bNetscape4 = true;
	fVersion = parseFloat(strVersion);
// unidentified
} else {
	strBrowserType = "Something different";
	bOtherBrowser = true;
}
