function createButton(txt) {
		// the element that will be created
		var el = null;
		var btn = null;
		switch (txt) {
		    case "separator":
			el = document.createElement("div");
			el.className = "separator";
			break;
		    case "space":
			el = document.createElement("div");
			el.className = "space";
			break;
		    case "linebreak":
			newLine();
			return false;
		    case "textindicator":
			el = document.createElement("div");
			el.appendChild(document.createTextNode("A"));
			el.className = "indicator";
			el.title = HTMLArea.I18N.tooltips.textindicator;
			var obj = {
				name	: txt, // the button name (i.e. 'bold')
				element : el, // the UI element (DIV)
				enabled : true, // is it enabled?
				active	: false, // is it pressed?
				text	: false, // enabled in text mode?
				cmd	: "textindicator", // the command ID
				state	: setButtonStatus // for changing state
			};
			tb_objects[txt] = obj;
			break;
		    default:
			btn = editor.config.btnList[txt];
		}
		if (!el && btn) {
			el = document.createElement("div");
			el.title = btn[0];
			el.className = "button";
			// let's just pretend we have a button object, and
			// assign all the needed information to it.
			var obj = {
				name	: txt, // the button name (i.e. 'bold')
				element : el, // the UI element (DIV)
				enabled : true, // is it enabled?
				active	: false, // is it pressed?
				text	: btn[2], // enabled in text mode?
				cmd	: btn[3], // the command ID
				state	: setButtonStatus, // for changing state
				context : btn[4] || null // enabled in a certain context?
			};
			tb_objects[txt] = obj;
			// handlers to emulate nice flat toolbar buttons
			HTMLArea._addEvent(el, "mouseover", function () {
				if (obj.enabled) {
					HTMLArea._addClass(el, "buttonHover");
				}
			});
			HTMLArea._addEvent(el, "mouseout", function () {
				if (obj.enabled) with (HTMLArea) {
					_removeClass(el, "buttonHover");
					_removeClass(el, "buttonActive");
					(obj.active) && _addClass(el, "buttonPressed");
				}
			});
			HTMLArea._addEvent(el, "mousedown", function (ev) {
				if (obj.enabled) with (HTMLArea) {
					_addClass(el, "buttonActive");
					_removeClass(el, "buttonPressed");
					_stopEvent(is_ie ? window.event : ev);
				}
			});
			// when clicked, do the following:
			HTMLArea._addEvent(el, "click", function (ev) {
				if (obj.enabled) with (HTMLArea) {
					_removeClass(el, "buttonActive");
					_removeClass(el, "buttonHover");
					obj.cmd(editor, obj.name, obj);
					_stopEvent(is_ie ? window.event : ev);
				}
			});
			var img = document.createElement("img");
			img.src = btn[1];
			img.style.width = "18px";
			img.style.height = "18px";
			el.appendChild(img);
		} else if (!el) {
			el = createSelect(txt);
		}
		if (el) {
			var tb_cell = document.createElement("td");
			tb_row.appendChild(tb_cell);
			tb_cell.appendChild(el);
		} else {
			alert("FIXME: Unknown toolbar item: " + txt);
		}
		return el;
	}
// appends a new button to toolbar
appends a new button to toolbar
appends a new button to toolbar
function createButton(txt) {
		var el = null;
		var btn = null;
		switch (txt) {
		    case "separator":
			el = document.createElement("div");
			el.className = "separator";
			break;
		    case "space":
			el = document.createElement("div");
			el.className = "space";
			break;
		    case "linebreak":
			newLine();
			return false;
		    case "textindicator":
			el = document.createElement("div");
			el.appendChild(document.createTextNode("A"));
			el.className = "indicator";
			el.title = HTMLArea.I18N.tooltips.textindicator;
			var obj = {
				name	: txt, 
				element : el, 
				enabled : true, 
				active	: false, 
				text	: false, 
				cmd	: "textindicator", 
				state	: setButtonStatus 
			};
			tb_objects[txt] = obj;
			break;
		    default:
			btn = editor.config.btnList[txt];
		}
		if (!el && btn) {
			el = document.createElement("div");
			el.title = btn[0];
			el.className = "button";
			var obj = {
				name	: txt, 
				element : el, 
				enabled : true, 
				active	: false, 
				text	: btn[2], 
				cmd	: btn[3], 
				state	: setButtonStatus, 
				context : btn[4] || null 
			};
			tb_objects[txt] = obj;
			HTMLArea._addEvent(el, "mouseover", function () {
				if (obj.enabled) {
					HTMLArea._addClass(el, "buttonHover");
				}
			});
			HTMLArea._addEvent(el, "mouseout", function () {
				if (obj.enabled) with (HTMLArea) {
					_removeClass(el, "buttonHover");
					_removeClass(el, "buttonActive");
					(obj.active) && _addClass(el, "buttonPressed");
				}
			});
			HTMLArea._addEvent(el, "mousedown", function (ev) {
				if (obj.enabled) with (HTMLArea) {
					_addClass(el, "buttonActive");
					_removeClass(el, "buttonPressed");
					_stopEvent(is_ie ? window.event : ev);
				}
			});
			HTMLArea._addEvent(el, "click", function (ev) {
				if (obj.enabled) with (HTMLArea) {
					_removeClass(el, "buttonActive");
					_removeClass(el, "buttonHover");
					obj.cmd(editor, obj.name, obj);
					_stopEvent(is_ie ? window.event : ev);
				}
			});
			var img = document.createElement("img");
			img.src = btn[1];
			img.style.width = "18px";
			img.style.height = "18px";
			el.appendChild(img);
		} else if (!el) {
			el = createSelect(txt);
		}
		if (el) {
			var tb_cell = document.createElement("td");
			tb_row.appendChild(tb_cell);
			tb_cell.appendChild(el);
		} else {
			alert("FIXME: Unknown toolbar item: " + txt);
		}
		return el;
	}
function createButton ( txt ) { var el = null ; var btn = null ; switch ( txt ) { case "separator" : el = document . createElement ( "div" ) ; el . className = "separator" ; break ; case "space" : el = document . createElement ( "div" ) ; el . className = "space" ; break ; case "linebreak" : newLine ( ) ; return false ; case "textindicator" : el = document . createElement ( "div" ) ; el . appendChild ( document . createTextNode ( "A" ) ) ; el . className = "indicator" ; el . title = HTMLArea . I18N . tooltips . textindicator ; var obj = { name : txt , element : el , enabled : true , active : false , text : false , cmd : "textindicator" , state : setButtonStatus } ; tb_objects [ txt ] = obj ; break ; default : btn = editor . config . btnList [ txt ] ; } if ( ! el && btn ) { el = document . createElement ( "div" ) ; el . title = btn [ 0 ] ; el . className = "button" ; var obj = { name : txt , element : el , enabled : true , active : false , text : btn [ 2 ] , cmd : btn [ 3 ] , state : setButtonStatus , context : btn [ 4 ] || null } ; tb_objects [ txt ] = obj ; HTMLArea . _addEvent ( el , "mouseover" , function ( ) { if ( obj . enabled ) { HTMLArea . _addClass ( el , "buttonHover" ) ; } } ) ; HTMLArea . _addEvent ( el , "mouseout" , function ( ) { if ( obj . enabled ) with ( HTMLArea ) { _removeClass ( el , "buttonHover" ) ; _removeClass ( el , "buttonActive" ) ; ( obj . active ) && _addClass ( el , "buttonPressed" ) ; } } ) ; HTMLArea . _addEvent ( el , "mousedown" , function ( ev ) { if ( obj . enabled ) with ( HTMLArea ) { _addClass ( el , "buttonActive" ) ; _removeClass ( el , "buttonPressed" ) ; _stopEvent ( is_ie ? window . event : ev ) ; } } ) ; HTMLArea . _addEvent ( el , "click" , function ( ev ) { if ( obj . enabled ) with ( HTMLArea ) { _removeClass ( el , "buttonActive" ) ; _removeClass ( el , "buttonHover" ) ; obj . cmd ( editor , obj . name , obj ) ; _stopEvent ( is_ie ? window . event : ev ) ; } } ) ; var img = document . createElement ( "img" ) ; img . src = btn [ 1 ] ; img . style . width = "18px" ; img . style . height = "18px" ; el . appendChild ( img ) ; } else if ( ! el ) { el = createSelect ( txt ) ; } if ( el ) { var tb_cell = document . createElement ( "td" ) ; tb_row . appendChild ( tb_cell ) ; tb_cell . appendChild ( el ) ; } else { alert ( "FIXME: Unknown toolbar item: " + txt ) ; } return el ; }
appends a new button to toolbar
appends a new button to toolbar
// the element that will be created // the button name (i.e. 'bold') // the UI element (DIV) // is it enabled? // is it pressed? // enabled in text mode? // the command ID // for changing state // let's just pretend we have a button object, and // assign all the needed information to it. // the button name (i.e. 'bold') // the UI element (DIV) // is it enabled? // is it pressed? // enabled in text mode? // the command ID // for changing state // enabled in a certain context? // handlers to emulate nice flat toolbar buttons // when clicked, do the following: