var isIE=false, isIE7=false,
 	isOpera=false,
	isKonquerer=false,
	isMozilla=false,
	isWebkit=false,
	isSafari=false,
	isChrome=false, isChrome3=false;
	
	isFF=false,
	isMac=false,
	isIOS=false,
	
	isVersion=0;
	
function browser_version(UA,txt)
{
	var i=UA.indexOf(txt);
	if(i==-1) return 0;
	return parseFloat(UA.substring(i+txt.length));
}

var UA;
function browser_id()
{
	UA = navigator.userAgent.toLowerCase();
	var platform = navigator.platform.toLowerCase();
	var vendor = navigator.vendor || "";
	var i;
	if (vendor === "KDE") {
		isKonqueror = true;
	} else if (typeof window.opera !== "undefined") {
		isOpera = true;
	} else if (UA.indexOf("trident") != -1) {
		isIE = true;
		isVersion=browser_version(UA,'trident/')+4;
	} else if (typeof document.all !== "undefined") {
		isIE = true;
		isVersion=browser_version(UA,'msie ');
		if(isVersion==7) isIE7 = true;
	} else if (UA.indexOf("applewebkit") != -1) {
		isWebkit=true;
	} else if (UA.indexOf("gecko") != -1) {
		isMozilla=true;
		isVersion=browser_version(UA,'firefox/');
	}
	
	if (vendor.indexOf("Apple Computer, Inc.") > -1) {
		isSafari = true;
		isVersion=browser_version(UA,'version/');
#		Fluid uses whatever version of safari is installed and has no safari version info, just assume 4
		if(UA.indexOf("fluid")) isVersion=4;
	} else if (UA.indexOf("chrome") != -1) {
		isChrome=true;
		isVersion=browser_version(UA,'chrome/');
		if(isVersion==3) isChrome3=true;
	}
	
	if (UA.indexOf("macintosh")!=-1){
		isMac=true;
	}

	if (isWebkit && UA.indexOf("mobile") != -1){
		isIOS = true;
	}
		
	dbg('*** isIE='+isIE+' isOpera='+isOpera+' isKonquerer='+isKonquerer+' isMozilla='+isMozilla+' isWebkit='+isWebkit);
	dbg('+++ isSafari='+isSafari+' isChrome='+isChrome+' isIOS='+isIOS);
	dbg('Version='+isVersion);
	dbg('Vendor='+vendor);
	dbg('Platform='+platform);
	dbg('User Agent='+UA);

#	// remove later
	if(isMozilla) isFF=true;
#	// To be implemented properly
#	isMozilla = !isIE;	
}

# Browser ID research for login page...
# - This module
# - module x_rsh.js has browser ID
# - tpl/login.htm
# - mdev\tpl_testbed\ed_mw3\tm3\editor_mw.js
# OK sticking with very simple positive tested browser ID for now.
