/**
 * EDIT3 Rich-Text-Editor for Gecko based browser
 *
 * Notice:
 * The original RTE was written by Kevin Roth @ http://www.kevinroth.com/rte/demo.htm
 *
 * Nothing of the original code was wrapped.
 * The Editor are completly rewritten and reviewed by KP3 Medien GmbH
 *
 * Minimum Requirement: Firefox 1.0.7 or higher
 * Tested on MacOS X 10.4 and Windows XP SP1+2
 *
 * Author: 			Dirk Franzky
 * Copyright: 	2005 KP3 Medien GmbH
 * Version:			3.0 RC-1 (2006-04-19)
 **/


/**********************************************************
***********************************************************

		            Start of browser detection

***********************************************************
**********************************************************/

	var boo_systemIsWindows 				= (navigator.appVersion.indexOf("Win")!=-1);
	var boo_systemIsMacintosh 			= (navigator.appVersion.indexOf("Mac")!=-1);
	var boo_systemIsUnix 						= (navigator.appVersion.indexOf("X11")!=-1);
	var boo_systemIsLinux 					= (navigator.appVersion.indexOf("Linux")!=-1);

	// Browser Detection
	var boo_browserIsIE 				= null;
	var boo_browserIsIE5 				= null;
	var boo_browserIsIE55 			= null;
	var boo_browserIsIE6 				= null;

	var boo_browserIsOpera 			= null;
	var boo_browserIsGecko 			= null;
	var boo_browserIsNetscape 	= null;
	var boo_browserIsMozilla		= null;
	var boo_browserIsFirefox		= null;
	var boo_browserIsFirefox15	= null;
	var boo_browserIsSafari 		= null;
	var boo_browserIsKonqueror 	= null;
	var str_myBrowser 					= null;
	var str_userAgent 					= navigator.userAgent.toLowerCase();

	boo_browserIsIE 		= ((str_userAgent.indexOf("msie") != -1) && (str_userAgent.indexOf("webtv") == -1));
	if(boo_browserIsIE) {
		var str_regex 	= /(msie)|(webtv)/;
		var str_regexmatch		= str_regex.exec(str_userAgent);
		if (str_regexmatch != null) {
			str_myBrowser = String(str_regexmatch[0]);
		}


		boo_browserIsIE5 		= ((str_userAgent.indexOf("msie") != -1) && (str_userAgent.indexOf("5.0") != -1));
		if(boo_browserIsIE5) {
			var str_regex 	= /(msie 5\.0)/;
			var str_regexmatch 		= str_regex.exec(str_userAgent);
			if (str_regexmatch != null) {
				str_myBrowser = String(str_regexmatch[0]);
			}
		}

		boo_browserIsIE55 	= ((str_userAgent.indexOf("msie") != -1) && (str_userAgent.indexOf("5.5") != -1));
		if(boo_browserIsIE55) {
			var str_regex 	= /(msie 5\.5)/;
			var str_regexmatch 		= str_regex.exec(str_userAgent);
			if (str_regexmatch != null) {
				str_myBrowser = String(str_regexmatch[0]);
			}
		}

		boo_browserIsIE6 		= ((str_userAgent.indexOf("msie") != -1) && (str_userAgent.indexOf("6.0") != -1));
		if(boo_browserIsIE6) {
			var str_regex 	= /(msie 6\.0)/;
			var str_regexmatch			= str_regex.exec(str_userAgent);
			if (str_regexmatch != null) {
				str_myBrowser = String(str_regexmatch[0]);
			}
		}

	}
	boo_browserIsOpera 	= (str_userAgent.indexOf("opera"));
	if(boo_browserIsOpera) {
		var str_regex 	= /(opera)/;
		var str_regexmatch 		= str_regex.exec(str_userAgent);
		if (str_regexmatch != null) {
			str_myBrowser = String(str_regexmatch[0]);
		}
	}

	boo_browserIsGecko 	= (str_userAgent.indexOf("gecko") != -1);
	if(boo_browserIsGecko) {
		var str_regex 	= /(gecko)/;
		var str_regexmatch			= str_regex.exec(str_userAgent);
		if (str_regexmatch != null) {
			str_myBrowser = String(str_regexmatch[0]);
		}

			boo_browserIsNetscape 	= (str_userAgent.indexOf("netscape") != -1);
			if(boo_browserIsNetscape) {
				var str_regex 	= /(mozilla\/5\.0)|(gecko)|(netscape((.+)|(\/))([6-8]))/;
				var str_regexmatch			= str_regex.exec(str_userAgent);
				if (str_regexmatch != null) {
					str_myBrowser = String(str_regexmatch[0]);
				}
			}

		boo_browserIsMozilla 	= (str_userAgent.indexOf("mozilla") != -1);
		if(boo_browserIsMozilla) {
			var str_regex = /(mozilla\/5\.0)|(rv:1\.[0-7]\.[0-9])|(gecko)/;
			var str_regexmatch = str_regex.exec(str_userAgent);
			if (str_regexmatch != null) {
				str_myBrowser = str_regexmatch[0];
			}
		}

		boo_browserIsFirefox 	= (str_userAgent.indexOf("firefox/1.0") != -1 || str_userAgent.indexOf("firefox/2.0") != -1);
		if(boo_browserIsFirefox) {
			var str_regex = /(mozilla\/5\.0)|(rv:1\.[0-7]\.[0-9])|(gecko)|(firefox\/[1]\.[0-9]\.[0-9])/;
			var str_regexmatch = str_regex.exec(str_userAgent);
			if (str_regexmatch != null) {
				str_myBrowser = str_regexmatch[0];
			}
		}

		boo_browserIsFirefox15 	= (str_userAgent.indexOf("firefox/1.5") != -1);
		if(boo_browserIsFirefox15) {
			var str_regex = /(mozilla\/5\.0)|(rv:1\.[8-9](\.[0-9]{2})?)|(gecko)|(firefox\/1\.5((\.[0-9]{1,4})?\.[0-9]{1,4})?)/;
			var str_regexmatch = str_regex.exec(str_userAgent);
			if (str_regexmatch != null) {
				str_myBrowser = str_regexmatch[0];
			}
		}
	}

	boo_browserIsSafari = (str_userAgent.indexOf("safari") != -1);
	if(boo_browserIsSafari) {
		var str_regex 	= /(safari)/;
		var str_regexmatch 		= str_regex.exec(str_userAgent);
		if (str_regexmatch != null) {
			str_myBrowser = String(str_regexmatch[0]);
		}
	}

	boo_browserIsKonqueror 	= (str_userAgent.indexOf("konqueror") != -1);
	if(boo_browserIsKonqueror) {
		var str_regex	 		= /(konqueror)/;
		var str_regexmatch 				= str_regex.exec(str_userAgent);
		if (str_regexmatch != null) {
			str_myBrowser = String(str_regexmatch[0]);
		}
	}