// JScript 文件
var SITE_DOMAIN;
var IMAGE_PATH;
var ICON_PATH;
var IMAGE_ATTACH_PATH;
var IMAGE_UPLOAD_CGI;
var MENU_BORDER_COLOR;
var MENU_BG_COLOR;
var MENU_TEXT_COLOR;
var MENU_SELECTED_COLOR;
var TOOLBAR_BORDER_COLOR;
var TOOLBAR_BG_COLOR;
var FORM_BORDER_COLOR;
var FORM_BG_COLOR;
var BUTTON_COLOR;
var OBJ_NAME;
var SELECTION;
var RANGE;
var RANGE_TEXT;
var EDITFORM_DOCUMENT;
var IMAGE_DOCUMENT;
var FLASH_DOCUMENT;
var MEDIA_DOCUMENT;
var REAL_DOCUMENT;
var LINK_DOCUMENT;
var BROWSER;
var TOOLBAR_ICON;
var EDITOR_TYPE;
var SAFE_MODE;
var UPLOAD_MODE;

var MSG_INPUT_URL = "请输入正确的URL地址。";
var MSG_SELECT_IMAGE = "请选择图片。";
var MSG_INVALID_IMAGE = "只能选择GIF,JPG,PNG,BMP格式的图片，请重新选择。";
var MSG_INVALID_FLASH = "只能选择SWF格式的文件，请重新选择。";
var MSG_INVALID_MEDIA = "只能选择MP3,WAV,WMA,WMV,MID,AVI,MPG,ASF格式的文件，请重新选择。";
var MSG_INVALID_REAL = "只能选择RM,RMVB格式的文件，请重新选择。";
var MSG_INVALID_WIDTH = "宽度不是数字，请重新输入。";
var MSG_INVALID_HEIGHT = "高度不是数字，请重新输入。";
var MSG_INVALID_BORDER = "边框不是数字，请重新输入。";
var MSG_INVALID_HSPACE = "横隔不是数字，请重新输入。";
var MSG_INVALID_VSPACE = "竖隔不是数字，请重新输入。";
var STR_TITLE = "描述";
var STR_WIDTH = "宽";
var STR_HEIGHT = "高";
var STR_BORDER = "边";
var STR_ALIGN = "对齐方式";
var STR_HSPACE = "横隔";
var STR_VSPACE = "竖隔";
var STR_BUTTON_CONFIRM = "确定";
var STR_BUTTON_CANCEL = "取消";
var STR_BUTTON_PREVIEW = "预览";
var STR_BUTTON_LISTENING = "试听";
var STR_IMAGE_LOCAL = "本地";
var STR_IMAGE_REMOTE = "远程";
var STR_LINK_BLANK = "新窗口";
var STR_LINK_NOBLANK = "当前窗口";
var STR_LINK_TARGET = "目标";
var STR_ABOUT = "学习与交流";
var STR_INPUT_CONTENT = "请输入内容";

var EDITOR_FONT_FAMILY = "SimSun";

var FONT_NAME = Array(
					Array('SimSun', '宋体'), 
					Array('SimHei', '黑体'), 
					Array('FangSong_utf-8', '仿宋体'), 
					Array('KaiTi_utf-8', '楷体'), 
					Array('NSimSun', '新宋体'), 
					Array('Arial', 'Arial'), 
					Array('Arial Black', 'Arial Black'), 
					Array('Times New Roman', 'Times New Roman'), 
					Array('Courier New', 'Courier New'), 
					Array('Tahoma', 'Tahoma'), 
					Array('Verdana', 'Verdana'), 
					Array('GulimChe', 'GulimChe'), 
					Array('MS Gothic', 'MS Gothic') 
					);
var ZOOM_TABLE = Array('250%', '200%', '150%', '120%', '100%', '80%', '50%');
var TITLE_TABLE = Array(
					Array('H1', '标题 1'), 
					Array('H2', '标题 2'), 
					Array('H3', '标题 3'), 
					Array('H4', '标题 4'), 
					Array('H5', '标题 5'), 
					Array('H6', '标题 6')
					);
var FONT_SIZE = Array(
					Array(1,'8pt'), 
					Array(2,'10pt'), 
					Array(3,'12pt'), 
					Array(4,'14pt'), 
					Array(5,'18pt'), 
					Array(6,'24pt'), 
					Array(7,'36pt')
				);
var SPECIAL_CHARACTER = Array('§','№','☆','★','○','●','◎','◇','◆','□','℃','‰','■','△','▲','※',
							'→','←','↑','↓','〓','¤','°','＃','＆','＠','＼','︿','＿','￣','―','α',
							'β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ','ν','ξ','ο','π','ρ',
							'σ','τ','υ','φ','χ','ψ','ω','≈','≡','≠','＝','≤','≥','＜','＞','≮',
							'≯','∷','±','＋','－','×','÷','／','∫','∮','∝','∞','∧','∨','∑','∏',
							'∪','∩','∈','∵','∴','⊥','∥','∠','⌒','⊙','≌','∽','〖','〗','【','】','（','）','［','］');
var TOP_TOOLBAR_ICON = Array(
						Array('Any_SOURCE', 'source.gif', '视图转换'),
						Array('Any_PREVIEW', 'preview.gif', '预览'),
						Array('Any_ZOOM', 'zoom.gif', '显示比例'),
						Array('Any_PRINT', 'print.gif', '打印'),
						Array('Any_UNDO', 'undo.gif', '回退'),
						Array('Any_REDO', 'redo.gif', '前进'),
						Array('Any_CUT', 'cut.gif', '剪切'),
						Array('Any_COPY', 'copy.gif', '复制'),
						Array('Any_PASTE', 'paste.gif', '粘贴'),
						Array('Any_SELECTALL', 'selectall.gif', '全选'),
						Array('Any_JUSTIFYLEFT', 'justifyleft.gif', '左对齐'),
						Array('Any_JUSTIFYCENTER', 'justifycenter.gif', '居中'),
						Array('Any_JUSTIFYRIGHT', 'justifyright.gif', '右对齐'),
						Array('Any_JUSTIFYFULL', 'justifyfull.gif', '两端对齐'),
						Array('Any_NUMBEREDLIST', 'numberedlist.gif', '编号'),
						Array('Any_UNORDERLIST', 'unorderedlist.gif', '项目符号'),
						Array('Any_INDENT', 'indent.gif', '减少缩进'),
						Array('Any_OUTDENT', 'outdent.gif', '增加缩进'),
						Array('Any_SUBSCRIPT', 'subscript.gif', '下标'),
						Array('Any_SUPERSCRIPT', 'superscript.gif', '上标'),
						Array('Any_DATE', 'date.gif', '日期'),
						Array('Any_TIME', 'time.gif', '时间')
				  );
var BOTTOM_TOOLBAR_ICON = Array(
						Array('Any_TITLE', 'title.gif', '标题'),
						Array('Any_FONTNAME', 'font.gif', '字体'),
						Array('Any_FONTSIZE', 'fontsize.gif', '文字大小'),
						Array('Any_TEXTCOLOR', 'textcolor.gif', '文字颜色'),
						Array('Any_BGCOLOR', 'bgcolor.gif', '文字背景'),
						Array('Any_BOLD', 'bold.gif', '粗体'),
						Array('Any_ITALIC', 'italic.gif', '斜体'),
						Array('Any_UNDERLINE', 'underline.gif', '下划线'),
						Array('Any_STRIKE', 'strikethrough.gif', '删除线'),
						Array('Any_REMOVE', 'removeformat.gif', '删除格式'),
						Array('Any_IMAGE', 'image.gif', '图片'),
						//Array('Any_FLASH', 'flash.gif', 'Flash'),
						//Array('Any_MEDIA', 'media.gif', 'Windows Media Player'),
						//Array('Any_REAL', 'real.gif', 'Real Player'),
						Array('Any_LAYER', 'layer.gif', '层'),
						Array('Any_TABLE', 'table.gif', '表格'),
						Array('Any_SPECIALCHAR', 'specialchar.gif', '特殊字符'),
						Array('Any_HR', 'hr.gif', '横线'),
						Array('Any_ICON', 'emoticons.gif', '笑脸'),
						Array('Any_LINK', 'link.gif', '创建超级连接'),
						Array('Any_UNLINK', 'unlink.gif', '删除超级连接'),
						Array('Any_ABOUT', 'about.gif', '仅限于ie7或以上ie浏览器使用')
				  );
var SIMPLE_TOOLBAR_ICON = Array(
						Array('Any_FONTNAME', 'font.gif', '字体'),
						Array('Any_FONTSIZE', 'fontsize.gif', '文字大小'),
						Array('Any_TEXTCOLOR', 'textcolor.gif', '文字颜色'),
						Array('Any_BGCOLOR', 'bgcolor.gif', '文字背景'),
						Array('Any_BOLD', 'bold.gif', '粗体'),
						Array('Any_ITALIC', 'italic.gif', '斜体'),
						Array('Any_UNDERLINE', 'underline.gif', '下划线'),
						Array('Any_JUSTIFYLEFT', 'justifyleft.gif', '左对齐'),
						Array('Any_JUSTIFYCENTER', 'justifycenter.gif', '居中'),
						Array('Any_JUSTIFYRIGHT', 'justifyright.gif', '右对齐'),
						Array('Any_IMAGE', 'image.gif', '图片'),
						Array('Any_LAYER', 'layer.gif', '层'),
						Array('Any_HR', 'hr.gif', '横线'),
						Array('Any_ICON', 'emoticons.gif', '笑脸'),
						Array('Any_LINK', 'link.gif', '创建超级连接'),
						Array('Any_ABOUT', 'about.gif', '关于')
				  );
var POPUP_MENU_TABLE = Array("Any_ZOOM", "Any_TITLE", "Any_FONTNAME", "Any_FONTSIZE", "Any_TEXTCOLOR", "Any_BGCOLOR", 
							"Any_LAYER", "Any_TABLE", "Any_HR", "Any_ICON", "Any_SPECIALCHAR", "Any_ABOUT", 
							"Any_IMAGE", "Any_FLASH", "Any_MEDIA", "Any_REAL", "Any_LINK");
var COLOR_TABLE = Array(
						"#FF0000", "#FFFF00", "#00FF00", "#00FFFF", "#0000FF", "#FF00FF", "#FFFFFF", "#F5F5F5", "#DCDCDC", "#FFFAFA",
						"#D3D3D3", "#C0C0C0", "#A9A9A9", "#808080", "#696969", "#000000", "#2F4F4F", "#708090", "#778899", "#4682B4",
						"#4169E1", "#6495ED", "#B0C4DE", "#7B68EE", "#6A5ACD", "#483D8B", "#191970", "#000080", "#00008B", "#0000CD",
						"#1E90FF", "#00BFFF", "#87CEFA", "#87CEEB", "#ADD8E6", "#B0E0E6", "#F0FFFF", "#E0FFFF", "#AFEEEE", "#00CED1",
						"#5F9EA0", "#48D1CC", "#00FFFF", "#40E0D0", "#20B2AA", "#008B8B", "#008080", "#7FFFD4", "#66CDAA", "#8FBC8F",
						"#3CB371", "#2E8B57", "#006400", "#008000", "#228B22", "#32CD32", "#00FF00", "#7FFF00", "#7CFC00", "#ADFF2F",
						"#98FB98", "#90EE90", "#00FF7F", "#00FA9A", "#556B2F", "#6B8E23", "#808000", "#BDB76B", "#B8860B", "#DAA520",
						"#FFD700", "#F0E68C", "#EEE8AA", "#FFEBCD", "#FFE4B5", "#F5DEB3", "#FFDEAD", "#DEB887", "#D2B48C", "#BC8F8F",
						"#A0522D", "#8B4513", "#D2691E", "#CD853F", "#F4A460", "#8B0000", "#800000", "#A52A2A", "#B22222", "#CD5C5C",
						"#F08080", "#FA8072", "#E9967A", "#FFA07A", "#FF7F50", "#FF6347", "#FF8C00", "#FFA500", "#FF4500", "#DC143C",
						"#FF0000", "#FF1493", "#FF00FF", "#FF69B4", "#FFB6C1", "#FFC0CB", "#DB7093", "#C71585", "#800080", "#8B008B",
						"#9370DB", "#8A2BE2", "#4B0082", "#9400D3", "#9932CC", "#BA55D3", "#DA70D6", "#EE82EE", "#DDA0DD", "#D8BFD8",
						"#E6E6FA", "#F8F8FF", "#F0F8FF", "#F5FFFA", "#F0FFF0", "#FAFAD2", "#FFFACD", "#FFF8DC", "#FFFFE0", "#FFFFF0",
						"#FFFAF0", "#FAF0E6", "#FDF5E6", "#FAEBD7", "#FFE4C4", "#FFDAB9", "#FFEFD5", "#FFF5EE", "#FFF0F5", "#FFE4E1"
					);
var IMAGE_ALIGN_TABLE = new Array("baseline", "top", "middle", "bottom", "texttop", "absmiddle", "absbottom", "left", "right");

function AnyGetBrowser()
{
	var browser = '';
	var agentInfo = navigator.userAgent.toLowerCase();
	if (agentInfo.indexOf("msie") > -1) {
		var re = new RegExp("msie\\s?([\\d\\.]+)","ig");
		var arr = re.exec(agentInfo);
		if (parseInt(RegExp.$1) >= 5.5) {
			browser = 'IE';
		}
	} else if (agentInfo.indexOf("firefox") > -1) {
		browser = 'FF';
	} else if (agentInfo.indexOf("netscape") > -1) {
		var temp1 = agentInfo.split(' ');
		var temp2 = temp1[temp1.length-1].split('/');
		if (parseInt(temp2[1]) >= 7) {
			browser = 'NS';
		}
	} else if (agentInfo.indexOf("gecko") > -1) {
		browser = 'ML';
	} else if (agentInfo.indexOf("opera") > -1) {
		var temp1 = agentInfo.split(' ');
		var temp2 = temp1[0].split('/');
		if (parseInt(temp2[1]) >= 9) {
			browser = 'OPERA';
		}
	}
	return browser;
}
function AnyGetFileName(file, separator)
{
	var temp = file.split(separator);
	var len = temp.length;
	var fileName = temp[len-1];
	return fileName;
}
function AnyGetFileExt(fileName)
{
	var temp = fileName.split(".");
	var len = temp.length;
	var fileExt = temp[len-1].toLowerCase();
	return fileExt;
}
function AnyCheckImageFileType(file, separator)
{
	if (separator == "/" && file.match(/http:\/\/.{3,}/) == null) {
		alert(MSG_INPUT_URL);
		return false;
	}
	var fileName = AnyGetFileName(file, separator);
	var fileExt = AnyGetFileExt(fileName);
	if (fileExt != 'gif' && fileExt != 'jpg' && fileExt != 'png' && fileExt != 'bmp') {
		alert(MSG_INVALID_IMAGE);
		return false;
	}
	return true;
}
function AnyCheckFlashFileType(file, separator)
{
	if (file.match(/http:\/\/.{3,}/) == null) {
		alert(MSG_INPUT_URL);
		return false;
	}
	var fileName = AnyGetFileName(file, "/");
	var fileExt = AnyGetFileExt(fileName);
	if (fileExt != 'swf') {
		alert(MSG_INVALID_FLASH);
		return false;
	}
	return true;
}
function AnyCheckMediaFileType(cmd, file, separator)
{
	if (file.match(/http:\/\/.{3,}/) == null) {
		alert(MSG_INPUT_URL);
		return false;
	}
	var fileName = AnyGetFileName(file, "/");
	var fileExt = AnyGetFileExt(fileName);
	if (cmd == 'Any_REAL') {
		if (fileExt != 'rm' && fileExt != 'rmvb') {
			alert(MSG_INVALID_REAL);
			return false;
		}
	} else {
		if (fileExt != 'mp3' && fileExt != 'wav' && fileExt != 'wma' && fileExt != 'wmv' && fileExt != 'mid' && fileExt != 'avi' && fileExt != 'mpg' && fileExt != 'asf') {
			alert(MSG_INVALID_MEDIA);
			return false;
		}
	}
	return true;
}
function AnyImageToObj(str)
{
	str = str.replace(/<img([^>]*id="flashpreviewimg"[^>]*)>/gi, function ($0,$1) {
					var width = $1.match(/width:\s?(\d+)/i);
					var height = $1.match(/height:\s?(\d+)/i);
					var url = $1.match(/alt="([^"\s>]+)"/i);
					var ret = AnyGetFlashHtmlTag(url[1], width[1], height[1]);
					return ret;
				}
			);
	str = str.replace(/<img([^>]*id="mediapreviewimg"[^>]*)>/gi, function ($0,$1) {
					var width = $1.match(/width:\s?(\d+)/i);
					var height = $1.match(/height:\s?(\d+)/i);
					var url = $1.match(/alt="([^"\s>]+)"/i);
					var title = $1.match(/title="([^"\s>]+)"/i);
					var ret = AnyGetMediaHtmlTag('Any_MEDIA', url[1], width[1], height[1], title[1]);
					return ret;
				}
			);
	str = str.replace(/<img([^>]*id="realpreviewimg"[^>]*)>/gi, function ($0,$1) {
					var width = $1.match(/width:\s?(\d+)/i);
					var height = $1.match(/height:\s?(\d+)/i);
					var url = $1.match(/alt="([^"\s>]+)"/i);
					var title = $1.match(/title="([^"\s>]+)"/i);
					var ret = AnyGetMediaHtmlTag('Any_REAL', url[1], width[1], height[1], title[1]);
					return ret;
				}
			);
	return str;
}
function AnyObjToImage(str)
{
	str = str.replace(/<object([^>]*type="application\/x-shockwave-flash"[^>]*)>.*?<\/object>/gi, function ($0,$1) {
					var url = IMAGE_PATH + 'flashpreview.gif';
					var width = $1.match(/width="([^"\s>]+)"/i);
					var height = $1.match(/height="([^"\s>]+)"/i);
					var alt = $1.match(/data="([^"\s>]+)"/i);
					var ret = '<img id="flashpreviewimg" src="'+url+'" style="' + 
							'width:'+width[1]+'px;height:'+height[1]+'px;" alt="'+alt[1]+'" border="0">';
					return ret;
				}
			);
	str = str.replace(/<object([^>]*type="video\/x-ms-asf-plugin"[^>]*)>(.*?)<\/object>/gi, function ($0,$1,$2) {
					var url = IMAGE_PATH + 'mediapreview.gif';
					var width = $1.match(/width="([^"\s>]+)"/i);
					var height = $1.match(/height="([^"\s>]+)"/i);
					var alt = $1.match(/data="([^"\s>]+)"/i);
					var autostart = $2.match(/name="autostart" value="(\w+)"/i);
					var controls = $2.match(/name="EnableContextMenu" value="(\w+)"/i);
					var title = autostart[1] + '-' + controls[1];
					var ret = '<img id="mediapreviewimg" src="'+url+'" style="' + 
							'width:'+width[1]+'px;height:'+height[1]+'px;" alt="'+alt[1]+'" title="'+title+'" border="0">';
					return ret;
				}
			);
	str = str.replace(/<object([^>]*type="audio\/x-pn-realaudio-plugin"[^>]*)>(.*?)<\/object>/gi, function ($0,$1,$2) {
					var url = IMAGE_PATH + 'realpreview.gif';
					var width = $1.match(/width="([^"\s>]+)"/i);
					var height = $1.match(/height="([^"\s>]+)"/i);
					var alt = $1.match(/data="([^"\s>]+)"/i);
					var autostart = $2.match(/name="autostart" value="(\w+)"/i);
					var controls = $2.match(/name="controls" value="([\w,]+)"/i);
					var title = autostart[1] + '-' + controls[1];
					var ret = '<img id="realpreviewimg" src="'+url+'" style="' + 
							'width:'+width[1]+'px;height:'+height[1]+'px;" alt="'+alt[1]+'" title="'+title+'" border="0">';
					return ret;
				}
			);
	return str;

}
function AnyHtmlToXhtml(str) 
{
	str = str.replace(/<p(.*?>)/gi, "<div$1");
	str = str.replace(/<\/p>/gi, "</div>");
	str = str.replace(/<br.*?>/gi, "<br />");
	str = str.replace(/(<hr[^>]*[^\/])(>)/gi, "$1 />");
	str = str.replace(/(<img[^>]*[^\/])(>)/gi, "$1 />");
	str = str.replace(/(<\w+)(.*?>)/gi, function ($0,$1,$2) {
						return($1.toLowerCase() + AnyConvertAttribute($2));
					}
				);
	str = str.replace(/(<\/\w+>)/gi, function ($0,$1) {
						return($1.toLowerCase());
					}
				);
	str = AnyTrim(str);
	return str;
}
function AnyConvertAttribute(str)
{
	str = AnyConvertAttributeChild(str, 'style', '[^\"\'>]+');
	str = AnyConvertAttributeChild(str, 'src', '[^\"\'\\s>]+');
	str = AnyConvertAttributeChild(str, 'href', '[^\"\'\\s>]+');
	str = AnyConvertAttributeChild(str, 'color', '[^\"\'\\s>]+');
	str = AnyConvertAttributeChild(str, 'alt', '[^\"\'\\s>]+');
	str = AnyConvertAttributeChild(str, 'title', '[^\"\'\\s>]+');
	str = AnyConvertAttributeChild(str, 'type', '[^\"\'\\s>]+');
	str = AnyConvertAttributeChild(str, 'face', '[^\"\'>]+');
	str = AnyConvertAttributeChild(str, 'id', '\\w+');
	str = AnyConvertAttributeChild(str, 'name', '\\w+');
	str = AnyConvertAttributeChild(str, 'dir', '\\w+');
	str = AnyConvertAttributeChild(str, 'target', '\\w+');
	str = AnyConvertAttributeChild(str, 'align', '\\w+');
	str = AnyConvertAttributeChild(str, 'width', '[\\w%]+');
	str = AnyConvertAttributeChild(str, 'height', '[\\w%]+');
	str = AnyConvertAttributeChild(str, 'border', '[\\w%]+');
	str = AnyConvertAttributeChild(str, 'hspace', '[\\w%]+');
	str = AnyConvertAttributeChild(str, 'vspace', '[\\w%]+');
	str = AnyConvertAttributeChild(str, 'size', '[\\w%]+');
	str = AnyConvertAttributeChild(str, 'cellspacing', '\\d+');
	str = AnyConvertAttributeChild(str, 'cellpadding', '\\d+');
	if (SAFE_MODE == true) {
		str = AnyClearAttributeScriptTag(str);
	}
	return str;
}
function AnyConvertAttributeChild(str, attName, regStr)
{
//	var re = new RegExp("("+attName+"=)[\"']?("+regStr+")[\"']?", "ig");
//	var reUrl = new RegExp("http://" + SITE_DOMAIN + "(/.*)", "i");
//	str = str.replace(re, function ($0,$1,$2) {
//						var val = $2;
//						if (val.match(reUrl) != null) {
//							val = val.replace(reUrl, "$1");
//						}
//						if (BROWSER == 'IE' && attName.match(/style/i) != null) {
//							return($1.toLowerCase() + "\"" + val.toLowerCase() + "\"");
//						} else {
//							return($1.toLowerCase() + "\"" + val + "\"");
//						}
//					}
//此段过滤了id参数);
	return str;
}
function AnyClearAttributeScriptTag(str)
{
	var re = new RegExp("(\\son[a-z]+=)[\"']?[^>]*?[^\\\\\>][\"']?([\\s>])","ig");
	str = str.replace(re, function ($0,$1,$2) {
						return($1.toLowerCase() + "\"\"" + $2);
					}
				);
	return str;
}
function AnyClearScriptTag(str)
{
	if (SAFE_MODE == false) {
		return str;
	}
	str = str.replace(/<(script.*?)>/gi, "[$1]");
	str = str.replace(/<\/script>/gi, "[/script]");
	return str;
}
function AnyTrim(str)
{
	str = str.replace(/^\s+|\s+$/g, "");
	str = str.replace(/[\r\n]+/g, "\r\n");
	return str;
}
function AnyHtmlentities(str)
{
	str = str.replace(/&/g,'&amp;');
	str = str.replace(/</g,'&lt;');
	str = str.replace(/>/g,'&gt;');
	str = str.replace(/"/g,'&quot;');
	return str;
}
function AnyHtmlentitiesDecode(str)
{
	str = str.replace(/&lt;/g,'<');
	str = str.replace(/&gt;/g,'>');
	str = str.replace(/&quot;/g,'"');
	str = str.replace(/&amp;/g,'&');
	return str;
}
function AnyGetTop(id)
{
	var top = 28;
	var tmp = '';
	var obj = document.getElementById(id);
	while (eval("obj" + tmp).tagName != "BODY") {
		tmp += ".offsetParent";
		top += eval("obj" + tmp).offsetTop;
	}
	return top;
}
function AnyGetLeft(id)
{
	var left = 2;
	var tmp = '';
	var obj = document.getElementById(id);
	while (eval("obj" + tmp).tagName != "BODY") {
		tmp += ".offsetParent";
		left += eval("obj" + tmp).offsetLeft;
	}
	return left;
}
function AnyDisplayMenu(cmd)
{
	if (cmd != 'Any_ABOUT') {
		editorsopForm.focus();
		AnySelection();
	}
	AnyDisableMenu();
	var top, left;
	top = AnyGetTop(cmd);
	left = AnyGetLeft(cmd);
	if (cmd == 'Any_ABOUT') {
		left -= 168;
	} else if (cmd == 'Any_LINK') {
		left -= 220;
	}
	document.getElementById('POPUP_'+cmd).style.top =  top.toString(10) + 'px';
	document.getElementById('POPUP_'+cmd).style.left = left.toString(10) + 'px';
	document.getElementById('POPUP_'+cmd).style.display = 'block';
}
function AnyDisableMenu()
{
	for (i = 0; i < POPUP_MENU_TABLE.length; i++) {
		document.getElementById('POPUP_'+POPUP_MENU_TABLE[i]).style.display = 'none';
	}
}
function AnyReloadIframe()
{
	var str = '';
	str += AnyPopupMenu('Any_IMAGE');
	str += AnyPopupMenu('Any_FLASH');
	str += AnyPopupMenu('Any_MEDIA');
	str += AnyPopupMenu('Any_REAL');
	document.getElementById('InsertIframe').innerHTML = str;
	AnyDrawIframe('Any_IMAGE');
	AnyDrawIframe('Any_FLASH');
	AnyDrawIframe('Any_MEDIA');
	AnyDrawIframe('Any_REAL');
}
function AnyGetMenuCommonStyle()
{
	var str = 'position:absolute;top:1px;left:1px;font-size:12px;color:'+MENU_TEXT_COLOR+
			';background-color:'+MENU_BG_COLOR+';border:solid 1px '+MENU_BORDER_COLOR+';z-index:1;display:none;';
	return str;
}
function AnyGetCommonMenu(cmd, content)
{
	var str = '';
	str += '<div id="POPUP_'+cmd+'" style="'+AnyGetMenuCommonStyle()+'">';
	str += content;
	str += '</div>';
	return str;
}
function AnyCreateColorTable(cmd, eventStr)
{
	var str = '';
	str += '<table cellpadding="0" cellspacing="2" border="0">';
	for (i = 0; i < COLOR_TABLE.length; i++) {
		if (i == 0 || (i >= 10 && i%10 == 0)) {
			str += '<tr>';
		}
		str += '<td style="width:12px;height:12px;border:1px solid #AAAAAA;font-size:1px;cursor:pointer;background-color:' +
		COLOR_TABLE[i] + ';" onmouseover="javascript:this.style.borderColor=\'#000000\';' + ((eventStr) ? eventStr : '') + '" ' +
		'onmouseout="javascript:this.style.borderColor=\'#AAAAAA\';" ' + 
		'onclick="javascript:AnyExecute(\''+cmd+'_END\', \'' + COLOR_TABLE[i] + '\');">&nbsp;</td>';
		if (i >= 9 && i%(i-1) == 0) {
			str += '</tr>';
		}
	}
	str += '</table>';
	return str;
}
function AnyDrawColorTable(cmd)
{
	var str = '';
	str += '<div id="POPUP_'+cmd+'" style="width:160px;padding:2px;'+AnyGetMenuCommonStyle()+'">';
	str += AnyCreateColorTable(cmd);
	str += '</div>';
	return str;
}
function AnyDrawMedia(cmd)
{
	var str = '';
	str += '<table cellpadding="0" cellspacing="0" style="width:100%">' + 
		'<tr><td colspan="2"><table border="0"><tr><td id="'+cmd+'preview" style="width:240px;height:240px;border:1px solid #AAAAAA;background-color:#FFFFFF;" align="center" valign="middle">&nbsp;</td></tr></table></td></tr>' +  	
		'<tr><td style="width:40px;padding:5px;">'+STR_IMAGE_REMOTE+'</td>' +
		'<td style="width:210px;padding-bottom:5px;"><input type="text" id="'+cmd+'link" value="http://" style="width:190px;border:1px solid #555555;" /></td></tr>' +
		'<tr><td colspan="2" style="margin:5px;padding-bottom:5px;" align="center">' +
		'<input type="button" name="button" value="'+STR_BUTTON_LISTENING+'" onclick="javascript:parent.AnyMediaPreview(\''+cmd+'\');" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +
		'<input type="submit" name="button" id="'+cmd+'submitButton" value="'+STR_BUTTON_CONFIRM+'" onclick="javascript:parent.AnyDrawMediaEnd(\''+cmd+'\');" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +
		'<input type="button" name="button" value="'+STR_BUTTON_CANCEL+'" onclick="javascript:parent.AnyDisableMenu();parent.AnyReloadIframe();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /></td></tr>' + 
		'</table>';
	return str;
}
function AnyPopupMenu(cmd)
{
	switch (cmd)
	{
		case 'Any_ZOOM':
			var str = '';
			for (i = 0; i < ZOOM_TABLE.length; i++) {
				str += '<div style="padding:2px;width:120px;cursor:pointer;" ' + 
				'onclick="javascript:AnyExecute(\'Any_ZOOM_END\', \'' + ZOOM_TABLE[i] + '\');" ' + 
				'onmouseover="javascript:this.style.backgroundColor=\''+MENU_SELECTED_COLOR+'\';" ' +
				'onmouseout="javascript:this.style.backgroundColor=\''+MENU_BG_COLOR+'\';">' + 
				ZOOM_TABLE[i] + '</div>';
			}
			str = AnyGetCommonMenu('Any_ZOOM', str);
			return str;
			break;
		case 'Any_TITLE':
			var str = '';
			for (i = 0; i < TITLE_TABLE.length; i++) {
				str += '<div style="width:140px;cursor:pointer;" ' + 
				'onclick="javascript:AnyExecute(\'Any_TITLE_END\', \'' + TITLE_TABLE[i][0] + '\');" ' + 
				'onmouseover="javascript:this.style.backgroundColor=\''+MENU_SELECTED_COLOR+'\';" ' +
				'onmouseout="javascript:this.style.backgroundColor=\''+MENU_BG_COLOR+'\';"><' + TITLE_TABLE[i][0] + ' style="margin:2px;">' + 
				TITLE_TABLE[i][1] + '</' + TITLE_TABLE[i][0] + '></div>';
			}
			str = AnyGetCommonMenu('Any_TITLE', str);
			return str;
			break;
		case 'Any_FONTNAME':
			var str = '';
			for (i = 0; i < FONT_NAME.length; i++) {
				str += '<div style="font-family:' + FONT_NAME[i][0] + 
				';padding:2px;width:160px;cursor:pointer;" ' + 
				'onclick="javascript:AnyExecute(\'Any_FONTNAME_END\', \'' + FONT_NAME[i][0] + '\');" ' + 
				'onmouseover="javascript:this.style.backgroundColor=\''+MENU_SELECTED_COLOR+'\';" ' +
				'onmouseout="javascript:this.style.backgroundColor=\''+MENU_BG_COLOR+'\';">' + 
				FONT_NAME[i][1] + '</div>';
			}
			str = AnyGetCommonMenu('Any_FONTNAME', str);
			return str;
			break;
		case 'Any_FONTSIZE':
			var str = '';
			for (i = 0; i < FONT_SIZE.length; i++) {
				str += '<div style="font-size:' + FONT_SIZE[i][1] + 
				';padding:2px;width:120px;cursor:pointer;" ' + 
				'onclick="javascript:AnyExecute(\'Any_FONTSIZE_END\', \'' + FONT_SIZE[i][0] + '\');" ' + 
				'onmouseover="javascript:this.style.backgroundColor=\''+MENU_SELECTED_COLOR+'\';" ' +
				'onmouseout="javascript:this.style.backgroundColor=\''+MENU_BG_COLOR+'\';">' + 
				FONT_SIZE[i][1] + '</div>';
			}
			str = AnyGetCommonMenu('Any_FONTSIZE', str);
			return str;
			break;
		case 'Any_TEXTCOLOR':
			var str = '';
			str = AnyDrawColorTable('Any_TEXTCOLOR');
			return str;
			break;
		case 'Any_BGCOLOR':
			var str = '';
			str = AnyDrawColorTable('Any_BGCOLOR');
			return str;
			break;
		case 'Any_HR':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:160px;'+AnyGetMenuCommonStyle()+'">';
			str += '<div id="hrPreview" style="margin:10px 2px 10px 2px;height:1px;border:0;font-size:0;background-color:#FFFFFF;"></div>';
			str += AnyCreateColorTable(cmd, 'document.getElementById(\'hrPreview\').style.backgroundColor = this.style.backgroundColor;');
			str += '</div>';
			return str;
			break;
		case 'Any_LAYER':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:160px;'+AnyGetMenuCommonStyle()+'">';
			str += '<div id="divPreview" style="margin:5px 2px 5px 2px;height:20px;border:1px solid #AAAAAA;font-size:1px;background-color:#FFFFFF;"></div>';
			str += AnyCreateColorTable(cmd, 'document.getElementById(\'divPreview\').style.backgroundColor = this.style.backgroundColor;');
			str += '</div>';
			return str;
			break;
		case 'Any_ICON':
			var str = '';
			var iconNum = 36;
			str += '<table id="POPUP_'+cmd+'" cellpadding="0" cellspacing="2" style="'+AnyGetMenuCommonStyle()+'">';
			for (i = 0; i < iconNum; i++) {
				if (i == 0 || (i >= 6 && i%6 == 0)) {
					str += '<tr>';
				}
				var num;
				if ((i+1).toString(10).length < 2) {
					num = '0' + (i+1);
				} else {
					num = (i+1).toString(10);
				}
				var iconUrl = ICON_PATH + 'etc_' + num + '.gif';
				str += '<td style="padding:2px;border:0;cursor:pointer;" ' + 
				'onclick="javascript:AnyExecute(\'Any_ICON_END\', \'' + iconUrl + '\');">' +
				'<img src="' + iconUrl + '" style="border:1px solid #EEEEEE;" onmouseover="javascript:this.style.borderColor=\'#AAAAAA\';" ' +
				'onmouseout="javascript:this.style.borderColor=\'#EEEEEE\';">' + '</td>';
				if (i >= 5 && i%(i-1) == 0) {
					str += '</tr>';
				}
			}
			str += '</table>';
			return str;
			break;
		case 'Any_SPECIALCHAR':
			var str = '';
			str += '<table id="POPUP_'+cmd+'" cellpadding="0" cellspacing="2" style="'+AnyGetMenuCommonStyle()+'">';
			for (i = 0; i < SPECIAL_CHARACTER.length; i++) {
				if (i == 0 || (i >= 10 && i%10 == 0)) {
					str += '<tr>';
				}
				str += '<td style="padding:2px;border:1px solid #AAAAAA;cursor:pointer;" ' + 
				'onclick="javascript:AnyExecute(\'Any_SPECIALCHAR_END\', \'' + SPECIAL_CHARACTER[i] + '\');" ' +
				'onmouseover="javascript:this.style.borderColor=\'#000000\';" ' +
				'onmouseout="javascript:this.style.borderColor=\'#AAAAAA\';">' + SPECIAL_CHARACTER[i] + '</td>';
				if (i >= 9 && i%(i-1) == 0) {
					str += '</tr>';
				}
			}
			str += '</table>';
			return str;
			break;
		case 'Any_TABLE':
			var str = '';
			var num = 10;
			str += '<table id="POPUP_'+cmd+'" cellpadding="0" cellspacing="0" style="'+AnyGetMenuCommonStyle()+'">';
			for (i = 1; i <= num; i++) {
				str += '<tr>';
				for (j = 1; j <= num; j++) {
					var value = i.toString(10) + ',' + j.toString(10);
					str += '<td id="AnyTableTd' + i.toString(10) + '_' + j.toString(10) + 
					'" style="width:15px;height:15px;background-color:#FFFFFF;border:1px solid #DDDDDD;cursor:pointer;" ' + 
					'onclick="javascript:AnyExecute(\'Any_TABLE_END\', \'' + value + '\');" ' +
					'onmouseover="javascript:AnyDrawTableSelected(\''+i.toString(10)+'\', \''+j.toString(10)+'\');" ' + 
					'onmouseout="javascript:;">&nbsp;</td>';
				}
				str += '</tr>';
			}
			str += '<tr><td colspan="10" id="tableLocation" style="text-align:center;height:20px;"></td></tr>';
			str += '</table>';
			return str;
			break;
		case 'Any_IMAGE':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:250px;'+AnyGetMenuCommonStyle()+'">';
			str += '<iframe name="AnyImageIframe" id="AnyImageIframe" frameborder="0" style="width:250px;height:390px;padding:0;margin:0;border:0;">';
			str += '</iframe></div>';
			return str;
			break;
		case 'Any_FLASH':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:250px;'+AnyGetMenuCommonStyle()+'">';
			str += '<iframe name="AnyFlashIframe" id="AnyFlashIframe" frameborder="0" style="width:250px;height:300px;padding:0;margin:0;border:0;">';
			str += '</iframe></div>';
			return str;
			break;
		case 'Any_MEDIA':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:250px;'+AnyGetMenuCommonStyle()+'">';
			str += '<iframe name="AnyMediaIframe" id="AnyMediaIframe" frameborder="0" style="width:250px;height:300px;padding:0;margin:0;border:0;">';
			str += '</iframe></div>';
			return str;
			break;
		case 'Any_REAL':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:250px;'+AnyGetMenuCommonStyle()+'">';
			str += '<iframe name="AnyRealIframe" id="AnyRealIframe" frameborder="0" style="width:250px;height:300px;padding:0;margin:0;border:0;">';
			str += '</iframe></div>';
			return str;
			break;
		case 'Any_LINK':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:250px;'+AnyGetMenuCommonStyle()+'">';
			str += '<iframe name="AnyLinkIframe" id="AnyLinkIframe" frameborder="0" style="width:250px;height:85px;padding:0;margin:0;border:0;">';
			str += '</iframe></div>';
			return str;
			break;
		case 'Any_ABOUT':
			var str = '';
			str += '<div id="POPUP_'+cmd+'" style="width:200px;'+AnyGetMenuCommonStyle()+';padding:5px;">';
			str += '<span style="margin-right:10px;">&nbsp;限使用于IE家族！IE7或以上版本！</span>' + '<br />';
			str += '</div>';
			return str;
			break;
		default: 
			break;
	}
}
function AnyDrawIframe(cmd)
{
	if (BROWSER == 'IE') {
		IMAGE_DOCUMENT = document.frames("AnyImageIframe").document;
		FLASH_DOCUMENT = document.frames("AnyFlashIframe").document;
		MEDIA_DOCUMENT = document.frames("AnyMediaIframe").document;
		REAL_DOCUMENT = document.frames("AnyRealIframe").document;
		LINK_DOCUMENT = document.frames("AnyLinkIframe").document;
	} else {
		IMAGE_DOCUMENT = document.getElementById('AnyImageIframe').contentDocument;
		FLASH_DOCUMENT = document.getElementById('AnyFlashIframe').contentDocument;
		MEDIA_DOCUMENT = document.getElementById('AnyMediaIframe').contentDocument;
		REAL_DOCUMENT = document.getElementById('AnyRealIframe').contentDocument;
		LINK_DOCUMENT = document.getElementById('AnyLinkIframe').contentDocument;
	}
	switch (cmd)
	{
		case 'Any_IMAGE':
			var str = '';
			str += '<div align="center">' +
				'<form name="uploadForm" style="margin:0;padding:0;" method="post" enctype="multipart/form-data" ' +
				'action="' + IMAGE_UPLOAD_CGI + '" onsubmit="javascript:if(parent.AnyDrawImageEnd()==false){return false;}"><table cellpadding="0" cellspacing="0" style="width:100%;font-size:12px;">' + 
				'<tr><td colspan="2"><table border="0" style="margin-bottom:3px;"><tr><td id="imgPreview" style="width:240px;height:240px;border:1px solid #AAAAAA;background-color:#FFFFFF;" align="center" valign="middle">&nbsp;</td></tr></table></td></tr>' +  	
				'<tr><td style="width:50px;padding-left:5px;">';
			if (UPLOAD_MODE == true) {
				str += '<select id="imageType" onchange="javascript:parent.AnyImageType(this.value);document.getElementById(\''+cmd+'submitButton\').focus();"><option value="1" selected="selected">'+STR_IMAGE_LOCAL+'</option><option value="2">'+STR_IMAGE_REMOTE+'</option></select>';
			} else {
				str += STR_IMAGE_REMOTE;
			}
			str += '</td><td style="width:200px;padding-bottom:3px;">';
			if (UPLOAD_MODE == true) {
				str += '<input type="text" id="imgLink" value="http://" maxlength="255" style="width:95%;border:1px solid #555555;display:none;" />' +
				'<input type="file" name="file1" id="FileUpload1" size="14" style="border:1px solid #555555;" onclick="javascript:document.getElementById(\'imgLink\').value=\'http://\';" />';
			} else {
				str += '<input type="text" id="imgLink" value="http://" maxlength="255" style="width:95%;border:1px solid #555555;" />' +
				'<input type="hidden" name="imageType" id="imageType" value="2"><input type="hidden" name="filename1" id="FileUpload1" value="" />';
			}
			str += '</td></tr><tr><td colspan="2" style="padding-bottom:3px;">' +
				'<table border="0" style="width:100%;font-size:12px;"><tr>' +
				'<td width="18%" style="padding:2px 2px 2px 5px;">'+STR_TITLE+'</td><td width="82%"><input type="text" name="imgTitle" id="imgTitle" value="" maxlength="100" style="width:95%;border:1px solid #555555;" /></td></tr></table>' +	
				'<table border="0" style="width:100%;font-size:12px;"><tr>' +
				'<td width="10%" style="padding:2px 2px 2px 5px;">'+STR_WIDTH+'</td><td width="23%"><input type="text" name="imgWidth" id="imgWidth" value="0" maxlength="4" style="width:40px;border:1px solid #555555;" /></td>' +
				'<td width="10%" style="padding:2px;">'+STR_HEIGHT+'</td><td width="23%"><input type="text" name="imgHeight" id="imgHeight" value="0" maxlength="4" style="width:40px;border:1px solid #555555;" /></td>' +
				'<td width="10%" style="padding:2px;">'+STR_BORDER+'</td><td width="23%"><input type="text" name="imgBorder" id="imgBorder" value="0" maxlength="1" style="width:20px;border:1px solid #555555;" /></td></tr></table>' +
				'<table border="0" style="width:100%;font-size:12px;"><tr>' +
				'<td width="39%" style="padding:2px 2px 2px 5px;"><select id="imgAlign" name="imgAlign"><option value="left">'+STR_ALIGN+'</option>';
			for (var i = 0; i < IMAGE_ALIGN_TABLE.length; i++) {
				str += '<option value="' + IMAGE_ALIGN_TABLE[i] + '">' + IMAGE_ALIGN_TABLE[i] + '</option>';
			}
			str += '</select><input type="hidden" name="fileName" id="fileName" value="" /></td>' +
				'<td width="15%" style="padding:2px;">'+STR_HSPACE+'</td><td width="15%"><input type="text" name="imgHspace" id="imgHspace" value="0" maxlength="1" style="width:20px;border:1px solid #555555;" /></td>' +
				'<td width="15%" style="padding:2px;">'+STR_VSPACE+'</td><td width="15%"><input type="text" name="imgVspace" id="imgVspace" value="0" maxlength="1" style="width:20px;border:1px solid #555555;" /></td></tr></table>' +
				'</td></tr><tr><td colspan="2" style="margin:5px;padding-bottom:5px;" align="center">' +
				'<input type="button" name="button" value="'+STR_BUTTON_PREVIEW+'" onclick="javascript:parent.AnyImagePreview();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +

				'<input type="submit" name="button" id="'+cmd+'submitButton" value="'+STR_BUTTON_CONFIRM+'" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +
				'<input type="button" name="button" value="'+STR_BUTTON_CANCEL+'" onclick="javascript:parent.AnyDisableMenu();parent.AnyReloadIframe();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /></td></tr>' + 
				'</table></form></div>';
			AnyWriteFullHtml(IMAGE_DOCUMENT, str);
			IMAGE_DOCUMENT.body.style.color = MENU_TEXT_COLOR;
			IMAGE_DOCUMENT.body.style.backgroundColor = MENU_BG_COLOR;
			IMAGE_DOCUMENT.body.style.margin = 0;
			IMAGE_DOCUMENT.body.scroll = 'no';
			break;
		case 'Any_FLASH':
			var str = '';
			str += '<table cellpadding="0" cellspacing="0" style="width:100%;">' + 
			'<tr><td colspan="2"><table border="0"><tr><td id="flashPreview" style="width:240px;height:240px;border:1px solid #AAAAAA;background-color:#FFFFFF;" align="center" valign="middle">&nbsp;</td></tr></table></td></tr>' +  	
			'<tr><td style="width:40px;padding:5px;">'+STR_IMAGE_REMOTE+'</td>' +
			'<td style="width:210px;padding-bottom:5px;"><input type="text" id="flashLink" value="http://" style="width:190px;border:1px solid #555555;" /></td></tr>' +
			'<tr><td colspan="2" style="margin:5px;padding-bottom:5px;" align="center">' +
			'<input type="button" name="button" value="'+STR_BUTTON_PREVIEW+'" onclick="javascript:parent.AnyFlashPreview();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +
			'<input type="submit" name="button" id="'+cmd+'submitButton" value="'+STR_BUTTON_CONFIRM+'" onclick="javascript:parent.AnyDrawFlashEnd();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +
			'<input type="button" name="button" value="'+STR_BUTTON_CANCEL+'" onclick="javascript:parent.AnyDisableMenu();parent.AnyReloadIframe();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /></td></tr>' + 
			'</table>';
			AnyWriteFullHtml(FLASH_DOCUMENT, str);
			FLASH_DOCUMENT.body.style.color = MENU_TEXT_COLOR;
			FLASH_DOCUMENT.body.style.backgroundColor = MENU_BG_COLOR;
			FLASH_DOCUMENT.body.style.margin = 0;
			FLASH_DOCUMENT.body.scroll = 'no';
			break;
		case 'Any_MEDIA':
			var str = '';
			str += AnyDrawMedia(cmd);
			AnyWriteFullHtml(MEDIA_DOCUMENT, str);
			MEDIA_DOCUMENT.body.style.color = MENU_TEXT_COLOR;
			MEDIA_DOCUMENT.body.style.backgroundColor = MENU_BG_COLOR;
			MEDIA_DOCUMENT.body.style.margin = 0;
			MEDIA_DOCUMENT.body.scroll = 'no';
			break;
		case 'Any_REAL':
			var str = '';
			str += AnyDrawMedia(cmd);
			AnyWriteFullHtml(REAL_DOCUMENT, str);
			REAL_DOCUMENT.body.style.color = MENU_TEXT_COLOR;
			REAL_DOCUMENT.body.style.backgroundColor = MENU_BG_COLOR;
			REAL_DOCUMENT.body.style.margin = 0;
			REAL_DOCUMENT.body.scroll = 'no';
			break;
		case 'Any_LINK':
			var str = '';
			str += '<table cellpadding="0" cellspacing="0" style="width:100%">' + 
				'<tr><td style="width:50px;padding:5px;">URL</td>' +
				'<td style="width:200px;padding-top:5px;padding-bottom:5px;"><input type="text" id="hyperLink" value="http://" style="width:190px;border:1px solid #555555;background-color:#FFFFFF;"></td>' +
				'<tr><td style="padding:5px;">'+STR_LINK_TARGET+'</td>' +
				'<td style="padding-bottom:5px;"><select id="hyperLinkTarget"><option value="_blank" selected="selected">'+STR_LINK_BLANK+'</option><option value="">'+STR_LINK_NOBLANK+'</option></select></td></tr>' + 
				'<tr><td colspan="2" style="padding-bottom:5px;" align="center">' +
				'<input type="submit" name="button" id="'+cmd+'submitButton" value="'+STR_BUTTON_CONFIRM+'" onclick="javascript:parent.AnyDrawLinkEnd();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /> ' +
				'<input type="button" name="button" value="'+STR_BUTTON_CANCEL+'" onclick="javascript:parent.AnyDisableMenu();" style="border:1px solid #555555;background-color:'+BUTTON_COLOR+';" /></td></tr>';
			str += '</table>';
			AnyWriteFullHtml(LINK_DOCUMENT, str);
			LINK_DOCUMENT.body.style.color = MENU_TEXT_COLOR;
			LINK_DOCUMENT.body.style.backgroundColor = MENU_BG_COLOR;
			LINK_DOCUMENT.body.style.margin = 0;
			LINK_DOCUMENT.body.scroll = 'no';
			break;
		default:
			break;
	}
}
function AnyDrawTableSelected(i, j)
{
	var text = i.toString(10) + ' by ' + j.toString(10) + ' Table';
	document.getElementById('tableLocation').innerHTML = text;
	var num = 10;
	for (m = 1; m <= num; m++) {
		for (n = 1; n <= num; n++) {
			var obj = document.getElementById('AnyTableTd' + m.toString(10) + '_' + n.toString(10) + '');
			if (m <= i && n <= j) {
				obj.style.backgroundColor = MENU_SELECTED_COLOR;
			} else {
				obj.style.backgroundColor = '#FFFFFF';
			}
		}
	}
}
function AnyImageType(type)
{
	if (type == 1) {
		IMAGE_DOCUMENT.getElementById('FileUpload1').style.display = 'block';
		IMAGE_DOCUMENT.getElementById('imgLink').style.display = 'none';
		IMAGE_DOCUMENT.getElementById('imgLink').value = 'http://';
	} else {
		IMAGE_DOCUMENT.getElementById('FileUpload1').style.display = 'none';
		IMAGE_DOCUMENT.getElementById('imgLink').style.display = 'block';
	}
	IMAGE_DOCUMENT.getElementById('imgPreview').innerHTML = "&nbsp;";
	IMAGE_DOCUMENT.getElementById('imgWidth').value = 0;
	IMAGE_DOCUMENT.getElementById('imgHeight').value = 0;
}
function AnyImagePreview()
{
	var type = IMAGE_DOCUMENT.getElementById('imageType').value;
	var url = IMAGE_DOCUMENT.getElementById('imgLink').value;
	var file = IMAGE_DOCUMENT.getElementById('FileUpload1').value;
	if (type == 1) {
		if (BROWSER != 'IE') {
			return false;

		}
		if (file == '') {
			alert(MSG_SELECT_IMAGE);
			return false;
		}
		url = 'file:///' + file;
		if (AnyCheckImageFileType(url, "\\") == false) {
			return false;
		}
	} else {
		if (AnyCheckImageFileType(url, "/") == false) {
			return false;
		}
	}
	var imgObj = IMAGE_DOCUMENT.createElement("IMG");
	imgObj.src = url;
	var width = parseInt(imgObj.width);
	var height = parseInt(imgObj.height);
	IMAGE_DOCUMENT.getElementById('imgWidth').value = width;
	IMAGE_DOCUMENT.getElementById('imgHeight').value = height;
	var rate = parseInt(width/height);
	if (width >230 && height <= 230) {
		width = 230;
		height = parseInt(width/rate);
	} else if (width <=230 && height > 230) {
		height = 230;
		width = parseInt(height*rate);
	} else if (width >230 && height > 230) {
		if (width >= height) {
			width = 230;
			height = parseInt(width/rate);
		} else {
			height = 230;
			width = parseInt(height*rate);
		}
	}
	imgObj.style.width = width;
	imgObj.style.height = height;
	var el = IMAGE_DOCUMENT.getElementById('imgPreview');
	if (el.hasChildNodes()) {
		el.removeChild(el.childNodes[0]);
	}
	el.appendChild(imgObj);
	return imgObj;
}
function AnyDrawImageEnd()
{
	var type = IMAGE_DOCUMENT.getElementById('imageType').value;
	var url = IMAGE_DOCUMENT.getElementById('imgLink').value;
	var file = IMAGE_DOCUMENT.getElementById('FileUpload1').value;
	var width = IMAGE_DOCUMENT.getElementById('imgWidth').value;
	var height = IMAGE_DOCUMENT.getElementById('imgHeight').value;
	var border = IMAGE_DOCUMENT.getElementById('imgBorder').value;
	var title = IMAGE_DOCUMENT.getElementById('imgTitle').value;
	var align = IMAGE_DOCUMENT.getElementById('imgAlign').value;
	var hspace = IMAGE_DOCUMENT.getElementById('imgHspace').value;
	var vspace = IMAGE_DOCUMENT.getElementById('imgVspace').value;
	if (type == 1) {
		if (file == '') {
			alert(MSG_SELECT_IMAGE);
			return false;
		}
		if (AnyCheckImageFileType(file, "\\") == false) {
			return false;
		}
	} else {
		if (AnyCheckImageFileType(url, "/") == false) {
			return false;
		}
	}
	if (width.match(/^\d+$/) == null) {
		alert(MSG_INVALID_WIDTH);
		return false;
	}
	if (height.match(/^\d+$/) == null) {
		alert(MSG_INVALID_HEIGHT);
		return false;
	}
	if (border.match(/^\d+$/) == null) {
		alert(MSG_INVALID_BORDER);
		return false;
	}
	if (hspace.match(/^\d+$/) == null) {
		alert(MSG_INVALID_HSPACE);
		return false;
	}
	if (vspace.match(/^\d+$/) == null) {
		alert(MSG_INVALID_VSPACE);
		return false;
	}
	var fileName;
	editorsopForm.focus();
	if (type == 1) {
		fileName = AnyGetFileName(file, "\\");
		var fileExt = AnyGetFileExt(fileName);
		var dateObj = new Date();
		var year = dateObj.getFullYear().toString(10);
		var month = (dateObj.getMonth() + 1).toString(10);
		month = month.length < 2 ? '0' + month : month;
		var day = dateObj.getDate().toString(10);
		day = day.length < 2 ? '0' + day : day;
		var ymd = year + month + day;
		fileName = ymd + dateObj.getTime().toString(10) + '.' + fileExt;
		IMAGE_DOCUMENT.getElementById('fileName').value = fileName;
	} else {
		AnyInsertImage(url, width, height, border, title, align, hspace, vspace);
	}
}
function AnyInsertImage(url, width, height, border, title, align, hspace, vspace)
{
	var element = document.createElement("img");
	element.src = url;
	if (width > 0) {
		element.style.width = width;
	}
	if (height > 0) {
		element.style.height = height;
	}
	if (align != "") {
		element.align = align;
	}
	if (hspace > 0) {
		element.hspace = hspace;
	}
	if (vspace > 0) {
		element.vspace = vspace;
	}
	element.border = border;
	element.alt = AnyHtmlentities(title);
	AnySelect();
	AnyInsertItem(element);
	AnyDisableMenu();
	AnyReloadIframe();
}
function AnyGetFlashHtmlTag(url, width, height)
{
	var str = '<object type="application/x-shockwave-flash" data="'+url+'" ' + 
			'width="'+width+'" height="'+height+'" wmode="transparent">' + 
			'<param name="movie" value="'+url+'" />' + 
			'<param name="wmode" value="transparent"/>' + 
			'</object>';
	return str;
}
function AnyFlashPreview()
{
	var url = FLASH_DOCUMENT.getElementById('flashLink').value;
	if (AnyCheckFlashFileType(url, "/") == false) {
		return false;
	}
	var el = FLASH_DOCUMENT.getElementById('flashPreview');
	el.innerHTML = AnyGetFlashHtmlTag(url, '230', '230');
}
function AnyDrawFlashEnd()
{
	var url = FLASH_DOCUMENT.getElementById('flashLink').value;
	if (AnyCheckFlashFileType(url, "/") == false) {
		return false;
	}
	editorsopForm.focus();
	AnySelect();
	var imgObj = document.createElement("IMG");
	imgObj.id = 'flashpreviewimg';
	imgObj.src = IMAGE_PATH + 'flashpreview.gif';
	imgObj.style.width = '100';
	imgObj.style.height = '100';
	imgObj.border = '0';
	imgObj.alt = url;
	AnyInsertItem(imgObj);
	AnyDisableMenu();
}
function AnyGetMediaHtmlTag(cmd, url, width, height, title)
{
	var temp = title.split('-');
	var autostart = temp[0];
	var controls = temp[1];
	var str;
	if (cmd == "Any_REAL") {
		str = '<object type="audio/x-pn-realaudio-plugin" data="'+url+'" ' + 
			'width="'+width+'" height="'+height+'">' + 
			'<param name="SRC" value="'+url+'" />' + 
			'<param name="AUTOSTART" value="'+autostart+'" />' + 
			'<param name="CONTROLS" value="'+controls+'" />' + 
			'</object>';
	} else {
		str = '<object type="video/x-ms-asf-plugin" data="'+url+'" ' + 
			'width="'+width+'" height="'+height+'">' + 
			'<param name="FileName" value="'+url+'" />' + 
			'<param name="AutoStart" value="'+autostart+'" />' + 
			'<param name="EnableContextMenu" value="'+controls+'" />' + 
			'</object>';
	}
	return str;
}
function AnyMediaPreview(cmd)
{
	var mediaDocument;
	if (cmd == 'Any_REAL') {
		mediaDocument = REAL_DOCUMENT;
	} else {
		mediaDocument = MEDIA_DOCUMENT;
	}
	var url = mediaDocument.getElementById(cmd+'link').value;
	if (AnyCheckMediaFileType(cmd, url, "/") == false) {
		return false;
	}
	var el = mediaDocument.getElementById(cmd+'preview');
	var title;
	if (cmd == "Any_REAL") {
		title = '1-ControlPanel,StatusBar';
	} else {
		title = '1-0';
	}
	el.innerHTML = AnyGetMediaHtmlTag(cmd, url, 230, 230, title);
}
function AnyDrawMediaEnd(cmd)
{
	var mediaDocument;
	if (cmd == 'Any_REAL') {
		mediaDocument = REAL_DOCUMENT;
	} else {
		mediaDocument = MEDIA_DOCUMENT;
	}
	var url = mediaDocument.getElementById(cmd+'link').value;
	if (AnyCheckMediaFileType(cmd, url, "/") == false) {
		return false;
	}
	editorsopForm.focus();
	AnySelect();
	var imgObj = document.createElement("IMG");
	if (cmd == 'Any_REAL') {
		imgObj.id = 'realpreviewimg';
		imgObj.src = IMAGE_PATH + 'realpreview.gif';
	} else {
		imgObj.id = 'mediapreviewimg';
		imgObj.src = IMAGE_PATH + 'mediapreview.gif';
	}
	imgObj.style.width = '100px';
	imgObj.style.height = '100px';
	if (cmd == "Any_REAL") {
		imgObj.title = '1-ControlPanel,StatusBar';
	} else {
		imgObj.title = '1-0';
	}
	imgObj.border = '0';
	imgObj.alt = url;
	AnyInsertItem(imgObj);
	AnyDisableMenu(cmd);
}
function AnyDrawLinkEnd()
{
	var range;
	var url = LINK_DOCUMENT.getElementById('hyperLink').value;
	var target = LINK_DOCUMENT.getElementById('hyperLinkTarget').value;
	if (url.match(/http:\/\/.{3,}/) == null) {
		alert(MSG_INPUT_URL);
		return false;
	}
	editorsopForm.focus();
	AnySelect();
	var element;
    if (BROWSER == 'IE') {
		if (SELECTION.type.toLowerCase() == 'control') {
			var el = document.createElement("a");
			el.href = url;
			if (target) {
				el.target = target;
			}
			RANGE.item(0).applyElement(el);
		} else if (SELECTION.type.toLowerCase() == 'text') {
			AnyExecuteValue('CreateLink', url);
			element = RANGE.parentElement();
			if (target) {
				element.target = target;
			}
		}
	} else {
		AnyExecuteValue('CreateLink', url);
		element = RANGE.startContainer.previousSibling;
		element.target = target;
		if (target) {
			element.target = target;
		}
    }
	AnyDisableMenu();
}
function AnySelection()
{
	if (BROWSER == 'IE') {
		SELECTION = EDITFORM_DOCUMENT.selection;
		RANGE = SELECTION.createRange();
		RANGE_TEXT = RANGE.text;
	} else {
		SELECTION = document.getElementById("editorsopForm").contentWindow.getSelection();
        RANGE = SELECTION.getRangeAt(0);
		RANGE_TEXT = RANGE.toString();
	}
}
function AnySelect()
{
	if (BROWSER == 'IE') {
		RANGE.select();
	}
}
function AnyInsertItem(insertNode)
{
	if (BROWSER == 'IE') {
		if (SELECTION.type.toLowerCase() == 'control') {
			RANGE.item(0).outerHTML = insertNode.outerHTML;
		} else {
			RANGE.pasteHTML(insertNode.outerHTML);
		}
	} else {
        SELECTION.removeAllRanges();
		RANGE.deleteContents();
        var startRangeNode = RANGE.startContainer;
        var startRangeOffset = RANGE.startOffset;
        var newRange = document.createRange();
		if (startRangeNode.nodeType == 3 && insertNode.nodeType == 3) {
            startRangeNode.insertData(startRangeOffset, insertNode.nodeValue);
            newRange.setEnd(startRangeNode, startRangeOffset + insertNode.length);
            newRange.setStart(startRangeNode, startRangeOffset + insertNode.length);
        } else {
            var afterNode;
            if (startRangeNode.nodeType == 3) {
                var textNode = startRangeNode;
                startRangeNode = textNode.parentNode;
                var text = textNode.nodeValue;
                var textBefore = text.substr(0, startRangeOffset);
                var textAfter = text.substr(startRangeOffset);
                var beforeNode = document.createTextNode(textBefore);
                var afterNode = document.createTextNode(textAfter);
                startRangeNode.insertBefore(afterNode, textNode);
                startRangeNode.insertBefore(insertNode, afterNode);
                startRangeNode.insertBefore(beforeNode, insertNode);
                startRangeNode.removeChild(textNode);
            } else {
				if (startRangeNode.tagName.toLowerCase() == 'html') {
					startRangeNode = startRangeNode.childNodes[0].nextSibling;
					afterNode = startRangeNode.childNodes[0];
				} else {
					afterNode = startRangeNode.childNodes[startRangeOffset];
				}
				startRangeNode.insertBefore(insertNode, afterNode);
            }
            newRange.setEnd(afterNode, 0);
            newRange.setStart(afterNode, 0);
        }
        SELECTION.addRange(newRange);
	}
}
function AnyExecuteValue(cmd, value)
{
	EDITFORM_DOCUMENT.execCommand(cmd, false, value);
}
function AnySimpleExecute(cmd)
{
	editorsopForm.focus();
	EDITFORM_DOCUMENT.execCommand(cmd, false, null);
	AnyDisableMenu();
}
function AnyExecute(cmd, value)
{
	switch (cmd)
	{
		case 'Any_SOURCE':
			var length = document.getElementById(TOP_TOOLBAR_ICON[0][0]).src.length - 10;
			var image = document.getElementById(TOP_TOOLBAR_ICON[0][0]).src.substr(length,10);
			if (image == 'source.gif') {
				document.getElementById("AnyCodeForm").value = AnyImageToObj(AnyHtmlToXhtml(EDITFORM_DOCUMENT.body.innerHTML));
				document.getElementById("editorsopIframe").style.display = 'none';
				document.getElementById("AnyEditTextarea").style.display = 'block';
				AnyDisableToolbar(true);
			} else {
				EDITFORM_DOCUMENT.body.innerHTML = AnyClearScriptTag(AnyObjToImage(document.getElementById("AnyCodeForm").value));
				document.getElementById("AnyEditTextarea").style.display = 'none';
				document.getElementById("editorsopIframe").style.display = 'block';
				AnyDisableToolbar(false);
			}
			AnyDisableMenu();
			break;
		case 'Any_PRINT':
			AnySimpleExecute('print');
			break;
		case 'Any_UNDO':
			AnySimpleExecute('undo');
			break;
		case 'Any_REDO':
			AnySimpleExecute('redo');
			break;
		case 'Any_CUT':
			AnySimpleExecute('cut');
			break;
		case 'Any_COPY':
			AnySimpleExecute('copy');
			break;
		case 'Any_PASTE':
			AnySimpleExecute('paste');
			break;
		case 'Any_SELECTALL':
			AnySimpleExecute('selectall');
			break;
		case 'Any_SUBSCRIPT':
			AnySimpleExecute('subscript');
			break;
		case 'Any_SUPERSCRIPT':
			AnySimpleExecute('superscript');
			break;
		case 'Any_BOLD':
			AnySimpleExecute('bold');
			break;
		case 'Any_ITALIC':
			AnySimpleExecute('italic');
			break;
		case 'Any_UNDERLINE':
			AnySimpleExecute('underline');
			break;
		case 'Any_STRIKE':
			AnySimpleExecute('strikethrough');
			break;
		case 'Any_JUSTIFYLEFT':
			AnySimpleExecute('justifyleft');
			break;
		case 'Any_JUSTIFYCENTER':
			AnySimpleExecute('justifycenter');
			break;
		case 'Any_JUSTIFYRIGHT':
			AnySimpleExecute('justifyright');



			break;
		case 'Any_JUSTIFYFULL':
			AnySimpleExecute('justifyfull');
			break;
		case 'Any_NUMBEREDLIST':
			AnySimpleExecute('insertorderedlist');
			break;
		case 'Any_UNORDERLIST':
			AnySimpleExecute('insertunorderedlist');
			break;
		case 'Any_INDENT':
			AnySimpleExecute('indent');
			break;
		case 'Any_OUTDENT':
			AnySimpleExecute('outdent');
			break;
		case 'Any_REMOVE':
			AnySimpleExecute('removeformat');
			break;
		case 'Any_ZOOM':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_ZOOM_END':
			editorsopForm.focus();
			EDITFORM_DOCUMENT.body.style.zoom = value;
			AnyDisableMenu();
			break;
		case 'Any_TITLE':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_TITLE_END':
			editorsopForm.focus();
			value = '<' + value + '>';
			AnySelect();
			AnyExecuteValue('FormatBlock', value);
			AnyDisableMenu();
			break;
		case 'Any_FONTNAME':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_FONTNAME_END':
			editorsopForm.focus();
			AnySelect();
			AnyExecuteValue('fontname', value);
			AnyDisableMenu();
			break;
		case 'Any_FONTSIZE':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_FONTSIZE_END':
			editorsopForm.focus();
			value = value.substr(0, 1);
			AnySelect();
			AnyExecuteValue('fontsize', value);
			AnyDisableMenu();
			break;
		case 'Any_TEXTCOLOR':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_TEXTCOLOR_END':
			editorsopForm.focus();
			AnySelect();
			AnyExecuteValue('ForeColor', value);
			AnyDisableMenu();
			break;
		case 'Any_BGCOLOR':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_BGCOLOR_END':
			editorsopForm.focus();
			if (BROWSER == 'IE') {
				AnySelect();
				AnyExecuteValue('BackColor', value);
			} else {
				var startRangeNode = RANGE.startContainer;
				if (startRangeNode.nodeType == 3) {
					var parent = startRangeNode.parentNode;
					var element = document.createElement("font");
					element.style.backgroundColor = value;
					element.appendChild(RANGE.extractContents());
					var startRangeOffset = RANGE.startOffset;
					var newRange = document.createRange();
					var afterNode;
					var textNode = startRangeNode;
					startRangeNode = textNode.parentNode;
					var text = textNode.nodeValue;
					var textBefore = text.substr(0, startRangeOffset);
					var textAfter = text.substr(startRangeOffset);
					var beforeNode = document.createTextNode(textBefore);
					var afterNode = document.createTextNode(textAfter);
					startRangeNode.insertBefore(afterNode, textNode);
					startRangeNode.insertBefore(element, afterNode);
					startRangeNode.insertBefore(beforeNode, element);
					startRangeNode.removeChild(textNode);
					newRange.setEnd(afterNode, 0);
					newRange.setStart(afterNode, 0);
					SELECTION.addRange(newRange);
				}
			}
			AnyDisableMenu();
			break;
		case 'Any_ICON':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_ICON_END':
			editorsopForm.focus();
			var element = document.createElement("img");
			element.src = value;
			element.border = 0;
			element.alt = "";
			AnySelect();
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_IMAGE':
			AnyDisplayMenu(cmd);
			//AnyImageIframe.focus();
			//IMAGE_DOCUMENT.getElementById(cmd+'submitButton').focus();
			break;
		case 'Any_FLASH':
			AnyDisplayMenu(cmd);
			//AnyFlashIframe.focus();
			//FLASH_DOCUMENT.getElementById(cmd+'submitButton').focus();
			break;
		case 'Any_MEDIA':
			AnyDisplayMenu(cmd);
			//AnyMediaIframe.focus();
			//MEDIA_DOCUMENT.getElementById(cmd+'submitButton').focus();
			break;
		case 'Any_REAL':
			AnyDisplayMenu(cmd);
			//AnyRealIframe.focus();
			//REAL_DOCUMENT.getElementById(cmd+'submitButton').focus();
			break;
		case 'Any_LINK':
			AnyDisplayMenu(cmd);
			AnyLinkIframe.focus();
			LINK_DOCUMENT.getElementById(cmd+'submitButton').focus();
			break;
		case 'Any_UNLINK':
			AnySimpleExecute('unlink');
			break;
		case 'Any_SPECIALCHAR':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_SPECIALCHAR_END':
			editorsopForm.focus();

			AnySelect();

			var element = document.createElement("span");
			element.appendChild(document.createTextNode(value));
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_LAYER':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_LAYER_END':
			editorsopForm.focus();
			var element = document.createElement("div");
			element.style.padding = "5px";
			element.style.border = "1px solid #AAAAAA";
			element.style.backgroundColor = value;
			var childElement = document.createElement("div");
			childElement.innerHTML = STR_INPUT_CONTENT;
			element.appendChild(childElement);
			AnySelect();
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_TABLE':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_TABLE_END':
			editorsopForm.focus();
			var location = value.split(',');
			var element = document.createElement("table");
			element.cellPadding = 0;
			element.cellSpacing = 0;
			element.border = 1;
			element.style.width = "100px";
			element.style.height = "100px";
			for (var i = 0; i < location[0]; i++) {
				var rowElement = element.insertRow(i);
				for (var j = 0; j < location[1]; j++) {
					var cellElement = rowElement.insertCell(j);
					cellElement.innerHTML = "&nbsp;";
				}
			}
			AnySelect();
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_HR':
			AnyDisplayMenu(cmd);
			break;
		case 'Any_HR_END':
			editorsopForm.focus();
			var element = document.createElement("hr");
			element.width = "100%";
			element.color = value;
			element.size = 1;
			AnySelect();
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_DATE':
			editorsopForm.focus();
			AnySelection();
			var date = new Date();
			var year = date.getFullYear().toString(10);
			var month = (date.getMonth() + 1).toString(10);
			month = month.length < 2 ? '0' + month : month;
			var day = date.getDate().toString(10);
			day = day.length < 2 ? '0' + day : day;
			var value = year + '-' + month + '-' + day;
			var element = document.createElement("span");
			element.appendChild(document.createTextNode(value));
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_TIME':
			editorsopForm.focus();
			AnySelection();
			var date = new Date();
			var hour = date.getHours().toString(10);
			hour = hour.length < 2 ? '0' + hour : hour;
			var minute = date.getMinutes().toString(10);
			minute = minute.length < 2 ? '0' + minute : minute;
			var second = date.getSeconds().toString(10);
			second = second.length < 2 ? '0' + second : second;
			var value = hour + ':' + minute + ':' + second;
			var element = document.createElement("span");
			element.appendChild(document.createTextNode(value));
			AnyInsertItem(element);
			AnyDisableMenu();
			break;
		case 'Any_PREVIEW':
			eval(OBJ_NAME).data();
			var newWin = window.open('', 'AnyPreview','width=800,height=600,left=30,top=30,resizable=yes,scrollbars=yes');
			AnyWriteFullHtml(newWin.document, document.getElementsByName(eval(OBJ_NAME).hiddenName)[0].value);
			//AnyDisableMenu();
			break;
		case 'Any_ABOUT':
			AnyDisplayMenu(cmd);
			break;
		default: 
			break;
	}
}
function AnyDisableToolbar(flag)
{
	if (flag == true) {
		document.getElementById(TOP_TOOLBAR_ICON[0][0]).src = IMAGE_PATH + 'design.gif';
		for (i = 0; i < TOOLBAR_ICON.length; i++) {
			var el = document.getElementById(TOOLBAR_ICON[i][0]);
			if (TOOLBAR_ICON[i][0] == 'Any_SOURCE' || TOOLBAR_ICON[i][0] == 'Any_PREVIEW' || TOOLBAR_ICON[i][0] == 'Any_ABOUT') {
				continue;
			}
			el.style.visibility = 'hidden';

		}
	} else {
		document.getElementById(TOP_TOOLBAR_ICON[0][0]).src = IMAGE_PATH + 'source.gif';
		for (i = 0; i < TOOLBAR_ICON.length; i++) {
			var el = document.getElementById(TOOLBAR_ICON[i][0]);
			el.style.visibility = 'visible';
			EDITFORM_DOCUMENT.designMode = 'On';
		}
	}
}
function AnyCreateIcon(icon)
{
	var str = '<img id="'+ icon[0] +'" src="' + IMAGE_PATH + icon[1] + '" alt="' + icon[2] + '" title="' + icon[2] + 
			'" align="absmiddle" style="border:1px solid ' + TOOLBAR_BG_COLOR +';cursor:pointer;height:20px;';
	str += '" onclick="javascript:AnyExecute(\''+ icon[0] +'\');" '+
			'onmouseover="javascript:this.style.border=\'1px solid ' + MENU_BORDER_COLOR + '\';" ' +
			'onmouseout="javascript:this.style.border=\'1px solid ' + TOOLBAR_BG_COLOR + '\';" ';
	str += '>';
	return str;
}
function AnyCreateToolbar()
{
	var htmlData = '<table cellpadding="0" cellspacing="0" border="0" height="26"><tr>';
	if (EDITOR_TYPE == 'full') {
		for (i = 0; i < TOP_TOOLBAR_ICON.length; i++) {
			htmlData += '<td style="padding:2px;">' + AnyCreateIcon(TOP_TOOLBAR_ICON[i]) + '</td>';
		}
		htmlData += '</tr></table><table cellpadding="0" cellspacing="0" border="0" height="26"><tr>';
		for (i = 0; i < BOTTOM_TOOLBAR_ICON.length; i++) {
			htmlData += '<td style="padding:2px;">' + AnyCreateIcon(BOTTOM_TOOLBAR_ICON[i]) + '</td>';
		}
	} else {
		for (i = 0; i < SIMPLE_TOOLBAR_ICON.length; i++) {
			htmlData += '<td style="padding:2px;">' + AnyCreateIcon(SIMPLE_TOOLBAR_ICON[i]) + '</td>';
		}
	}
	htmlData += '</tr></table>';
	return htmlData;
}
function AnyWriteFullHtml(documentObj, content)
{
	var editHtmlData = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n';
	editHtmlData += '<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>editorsop</title>\r\n<style type="text/css">\r\np {margin:0;}\r\n</style>\r\n</head>\r\n';
	editHtmlData += '<body style="font-size:12px;font-family:'+EDITOR_FONT_FAMILY+';margin:0px;background-color:' + FORM_BG_COLOR + '">\r\n';
	editHtmlData += content;
	editHtmlData += '\r\n</body>\r\n</html>\r\n';
	documentObj.open();
	documentObj.write(editHtmlData);
	documentObj.close();
}
function editorsop(objName) 
{
	this.objName = objName;
	this.hiddenName = objName;
	this.siteDomain = "";
	this.editorType = "full"; //full or simple
	this.safeMode = false; // true or false
	this.uploadMode = true; // true or false
	this.imageUploadCgi = "./icoeditor.aspx";
	this.menuBorderColor = '#AAAAAA';
	this.menuBgColor = '#EFEFEF';
	this.menuTextColor = '#222222';
	this.menuSelectedColor = '#CCCCCC';
	this.toolbarBorderColor = '#DDDDDD';
	this.toolbarBgColor = '#EFEFEF';
	this.formBorderColor = '#DDDDDD';
	this.formBgColor = '#FFFFFF';
	this.buttonColor = '#AAAAAA';
	this.init = function()
	{
		SITE_DOMAIN = this.siteDomain;
		EDITOR_TYPE = this.editorType.toLowerCase();
		SAFE_MODE = this.safeMode;
		UPLOAD_MODE = this.uploadMode;
		IMAGE_PATH = this.skinPath;
		ICON_PATH = this.iconPath;
		IMAGE_ATTACH_PATH = this.imageAttachPath;
		IMAGE_UPLOAD_CGI = this.imageUploadCgi;
		MENU_BORDER_COLOR = this.menuBorderColor;
		MENU_BG_COLOR = this.menuBgColor;
		MENU_TEXT_COLOR = this.menuTextColor;
		MENU_SELECTED_COLOR = this.menuSelectedColor;
		TOOLBAR_BORDER_COLOR = this.toolbarBorderColor;
		TOOLBAR_BG_COLOR = this.toolbarBgColor;
		FORM_BORDER_COLOR = this.formBorderColor;
		FORM_BG_COLOR = this.formBgColor;
		BUTTON_COLOR = this.buttonColor;
		OBJ_NAME = this.objName;
		BROWSER = AnyGetBrowser();
		TOOLBAR_ICON = Array();
		for (var i = 0; i < TOP_TOOLBAR_ICON.length; i++) {
			TOOLBAR_ICON.push(TOP_TOOLBAR_ICON[i]);
		}
		for (var i = 0; i < BOTTOM_TOOLBAR_ICON.length; i++) {
			TOOLBAR_ICON.push(BOTTOM_TOOLBAR_ICON[i]);
		}
	}
	this.show = function()
	{

		this.init();
		var widthStyle = 'width:' + this.editorWidth + ';';
		var widthArr = this.editorWidth.match(/(\d+)([px%]{1,2})/);
		var iframeWidthStyle = 'width:' + (parseInt(widthArr[1]) - 2).toString(10) + widthArr[2] + ';';
		var heightStyle = 'height:' + this.editorHeight + ';';
		var heightArr = this.editorHeight.match(/(\d+)([px%]{1,2})/);
		var iframeHeightStyle = 'height:' + (parseInt(heightArr[1]) - 3).toString(10) + heightArr[2] + ';';
		if (BROWSER == '') {
			var htmlData = '<div id="AnyEditTextarea" style="' + widthStyle + heightStyle + '">' +
			'<textarea name="AnyCodeForm" id="AnyCodeForm" style="' + widthStyle + heightStyle + 
			'padding:0;margin:0;border:1px solid '+ FORM_BORDER_COLOR + 
			';font-size:12px;line-height:16px;font-family:'+EDITOR_FONT_FAMILY+';background-color:'+ 
			FORM_BG_COLOR +';">' + document.getElementsByName(this.hiddenName)[0].value + '</textarea></div>';
			document.open();
			document.write(htmlData);
			document.close();
			return;
		}
		var htmlData = '<div style="font-family:'+EDITOR_FONT_FAMILY+';">';
		htmlData += '<div style="'+widthStyle+';border:1px solid ' + TOOLBAR_BORDER_COLOR + ';background-color:'+ TOOLBAR_BG_COLOR +'">';
		htmlData += AnyCreateToolbar();
		htmlData += '</div><div id="editorsopIframe" style="' + widthStyle + heightStyle + 
			'border:1px solid '+ FORM_BORDER_COLOR +';border-top:0;">' +
			'<iframe name="editorsopForm" id="editorsopForm" frameborder="0" style="' + iframeWidthStyle + iframeHeightStyle + 
			'padding:0;margin:0;border:0;"></iframe></div>';
		if (EDITOR_TYPE == 'full') {
			htmlData += '<div id="AnyEditTextarea" style="' + widthStyle + heightStyle + 
				'border:1px solid '+ FORM_BORDER_COLOR +';background-color:'+ 
				FORM_BG_COLOR +';border-top:0;display:none;">' +
				'<textarea name="AnyCodeForm" id="AnyCodeForm" style="' + iframeWidthStyle + iframeHeightStyle + 
				'padding:0;margin:0;border:0;font-size:12px;line-height:16px;font-family:'+EDITOR_FONT_FAMILY+';background-color:'+ 
				FORM_BG_COLOR +';" onclick="javascirit:AnyDisableMenu();"></textarea></div>';
		}
		htmlData += '</div>';
		for (var i = 0; i < POPUP_MENU_TABLE.length; i++) {
			if (POPUP_MENU_TABLE[i] == 'Any_IMAGE') {
				htmlData += '<span id="InsertIframe">';
			}
			htmlData += AnyPopupMenu(POPUP_MENU_TABLE[i]);
			if (POPUP_MENU_TABLE[i] == 'Any_REAL') {
				htmlData += '</span>';
			}
		}
		document.open();
		document.write(htmlData);
		document.close();
		if (BROWSER == 'IE') {
			EDITFORM_DOCUMENT = document.frames("editorsopForm").document;
		} else {
			EDITFORM_DOCUMENT = document.getElementById('editorsopForm').contentDocument;
		}
		AnyDrawIframe('Any_IMAGE');
		AnyDrawIframe('Any_FLASH');
		AnyDrawIframe('Any_MEDIA');
		AnyDrawIframe('Any_REAL');
		AnyDrawIframe('Any_LINK');
		EDITFORM_DOCUMENT.designMode = 'On';
		AnyWriteFullHtml(EDITFORM_DOCUMENT, document.getElementsByName(eval(OBJ_NAME).hiddenName)[0].value);
		var el = EDITFORM_DOCUMENT.body;
		if (el.addEventListener){
			el.addEventListener('click', AnyDisableMenu, false); 
		} else if (el.attachEvent){
			el.attachEvent('onclick', AnyDisableMenu);
		}
	}
	this.data = function()
	{
		var htmlResult;
		if (BROWSER == '') {
			htmlResult = document.getElementById("AnyCodeForm").value;
		} else {
			if (EDITOR_TYPE == 'full') {
				var length = document.getElementById(TOP_TOOLBAR_ICON[0][0]).src.length - 10;
				var image = document.getElementById(TOP_TOOLBAR_ICON[0][0]).src.substr(length,10);
				if (image == 'source.gif') {
					htmlResult = EDITFORM_DOCUMENT.body.innerHTML;
				} else {
					htmlResult = document.getElementById("AnyCodeForm").value;
				}
			} else {
				htmlResult = EDITFORM_DOCUMENT.body.innerHTML;
			}
		}
		AnyDisableMenu();
		htmlResult = AnyHtmlToXhtml(htmlResult);
		htmlResult = AnyImageToObj(htmlResult);
		htmlResult = AnyClearScriptTag(htmlResult);
		document.getElementsByName(this.hiddenName)[0].value = htmlResult;
		return htmlResult;
	}
}

