function showMenu(InputID) {
	hideMenu()
	
	//build the menu
	contextMenu = new ContextMenu();
	contextMenu.addNode("mgmt/uslEditor/images/button_blank.gif", "Select All", "javascript:setStyle(InputID,'SelectAll');");
	contextMenu.addBreak();
	contextMenu.addNode("mgmt/uslEditor/images/button_cut_menu.gif", "Cut", "javascript:setStyle(InputID,'Cut');");
	contextMenu.addNode("mgmt/uslEditor/images/button_copy_menu.gif", "Copy", "javascript:setStyle(InputID,'Copy');");
	contextMenu.addNode("mgmt/uslEditor/images/button_paste_menu.gif", "Paste", "javascript:setStyle(InputID,'Paste');");
	contextMenu.addBreak();
	contextMenu.addNode("mgmt/uslEditor/images/button_blank.gif", "Delete", "javascript:setStyle(InputID,'Delete');");
	
	//set the position
	contextMenu.menuNode.style.left = event.x-6;
	contextMenu.menuNode.style.top = event.y-6+document.body.scrollTop;
	
	return false;
}

function hideMenu() {
	if(contextMenu) {
		document.body.removeChild(contextMenu.menuNode);
		contextMenu = null;
	}
}

/*
	code for IE DHTML Editor. This is all *very* MSIE proprietry, so please
	excuse the poor code
*/

function setStyle(InputID, type, value) {
	document.getElementById(InputID).focus();
	document.execCommand(type, false, value);
}

function insertImage() {
	//popup a modal dialog to prompt user to upload image
	window.showModalDialog("uslEditor/uslEditor_insert_image.html", window, "dialogHeight: 410px; dialogWidth: 575px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
	
	return false;
}

function insertText(InputID, text) {
	// ptw attempts
	document.getElementById(InputID).focus();
	bResult = window.clipboardData.setData("Text",text);
	document.execCommand("paste", false, text);
}

function createSiteMapLink() {
	//popup a window to link to another section of the site
	//PLEASE NOTE:
	//This function is site specific
	window.open("page_link.asp", "window", "dialogHeight: 410px; dialogWidth: 575px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
	
	return false;
}

function insertTable() {
	//popup a modal dialog to prompt user to create table
	window.showModalDialog("uslEditor/uslEditor_insert_table.html", window, "dialogHeight: 210px; dialogWidth: 335px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
	
	return false;
}

function setStates() {
	f = document.forms.editorForm;
	/*set the font
	f.font.value = document.queryCommandValue("FontName");
	//set the size
	if(document.queryCommandValue("FontSize")) f.size.value = document.queryCommandValue("FontSize");
	else f.selectedIndex = 0;
	//don't set the forecolor because it's an arse!
	f.color.value = "";*/		
}

function getHTML(InputID) {
	html = document.getElementById(InputID).innerHTML;
	
	return html;
}