		var launcher, defaultFont, defaultFontSize;
		function removeFormat(r, name)
		{
			var cmd = [ "Bold", "Italic", "Underline", "Strikethrough", "FontName", "FontSize", "ForeColor", "BackColor" ];
			var on = new Array(cmd.length);
			for (var i = 0; i < cmd.length; i++) {
				on[i] = name == cmd[i] ? null : r.queryCommandValue(cmd[i]);
			}
			r.execCommand('RemoveFormat');
			for (var i = 0; i < cmd.length; i++) {
				if (on[i]) r.execCommand(cmd[i], false, on[i]);
			}
		}
		function formatHTML() {
		
			rules = document.styleSheets[0].rules;
			
			/*for (i=0; i < rules.length; i++) {
			
				alert (rules[i].selectorText);
			
			}
			*/
			
			f = document.all[arguments[0]];
			f.focus();
			var sel = document.selection.createRange();
			
			if (arguments[1] == 'InsertImage') {
				launcher = f;
				window.open('/w4b/_upload/index','resources','width=400,height=400,scrollbars=yes,menubar=yes,status=yes,resizable=yes');
			} else if (arguments[1].toLowerCase().indexOf("color")!= -1) {
				
				theVal = document.queryCommandValue(arguments[1]);
				
				if (theVal == null) {
					removeFormat(document,arguments[1]);
					document.execCommand(arguments[1],arguments[2],arguments[3]);
				} else if (theVal.toString() == '16777215') {
					document.execCommand(arguments[1],arguments[2],arguments[3]);
				} else {
					document.execCommand(arguments[1],false,null);
				}
			
			} else {
				document.execCommand(arguments[1],arguments[2],arguments[3]);
			}
		
		}


		// hover(): Handles mouse hovering over toolbar buttons
		function hover(on)
		{
			var el = window.event.srcElement;
			if (el && !el.disabled && el.nodeName == "IMG" && el.className != "spacer") {
				if (on) {
					el.className = "hover";
				} else {
					el.className = el.defaultState ? el.defaultState : null;
				}
			}
		}
		// hover(): Handles mouse clicks on toolbar buttons
		function press(on)
		{
			var el = window.event.srcElement;
			if (el && !el.disabled && el.nodeName == "IMG" && el.className != "spacer") {
				if (on) {
					el.className = "down";
				} else {
					el.className = el.className == "down" ? "hover" : el.defaultState ? el.defaultState : null;
				}
			}
		}

