var Editor;
 
function Format(action)
{
	Editor.execCommand(action, false, null);
}
 
function Colour(colour)
{		
	Editor.execCommand("forecolor",false, colour);
}

function EditorUpdate()
{
  document.getElementById('text').value = document.getElementById('textbox').contentDocument.body.innerHTML;
}
 
window.onload = function()
{
	if(document.getElementById('textbox')) {
    Editor = document.getElementById('textbox').contentWindow.document;
	  Editor.designMode = "on";
	  document.forms[0].onsubmit = function()
	  {
		  var text = document.getElementById('text');
		  text.value = Editor.body.innerHTML;
	  }
	}
}