ControlEditor = {
    EditorID: '',
    CodeID: '',
    ContentID: '',
    EditorHeight: '',
    PlugPath: '',
    JsPath: '',
    Simple: false,
    TagList: '',
    UploadPagePath: '',
    PlugUploadPath: '',
    VideoEx: '',
    PicEx: '',
    FlashEx: '',
    UploadPath: '',
    ButtonName: '',
    Init: function() {
        this.EditorHeight = this.EditorHeight.replace("px");
        var mHeight = this.EditorHeight - 70;
        var iEditorID = this.EditorID.replace('#', '');
        var strIframe = '<iframe id="' + this.EditorID + '" name="' + this.EditorID + '" marginwidth="0" marginheight="0" style="border:0px;" frameborder="0"></iframe>';
        var strPage = '<html><head><title>编辑器</title>\
                    <script type="text/javascript" src="/App_Themes/ManagerTheme/Js/jquery.min.js"></script>\
                    <script type="text/javascript" src="/App_Themes/ManagerTheme/js/lhgdialog.min.js"></script>\
                    <script type="text/javascript" src="' + this.JsPath + '"></script>\
                    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />\
                    <style>\
                    .XRen_BODY\
                    {\
	                    FONT-SIZE: 9pt\
                    }\
                    .XRen_BODY .TEXTAREA\
                    {\
	                    FONT-SIZE: 9pt;\
	                    FONT-FAMILY: 宋体\
                    }\
                    .XRen_BODY INPUT\
                    {\
	                    FONT-SIZE: 9pt;\
	                    FONT-FAMILY: 宋体;\
	                    height: 25px;\
                    }\
                    td.HtmlEditor_On \
                    {\
	                    font: 8pt MS Sans Serif;\
	                    padding:1px 5px;\
	                    border:1px inset;\
	                    background-color: #F4F6F4;\
                    }\
                    td.HtmlEditor_Off \
                    {\
	                    font: 8pt MS Sans Serif;\
	                    padding:1px 5px;\
	                    border:1px outset;\
	                    cursor:hand;\
                    }\
                    .XRen_select\
                    {\
	                    FONT-SIZE: 9pt;\
	                    FONT-FAMILY: 宋体\
                    }\
                    #EditorMenu td{ line-height:25px;}\
                    </style>\
                    </head><body style="font-size:9pt;">\
                    <table cellspacing="0" cellpadding="0" width="100%" border="1" style="border-collapse: collapse">\
                        <tr>\
                            <td align="left" colspan="2">\
                                <table style="width: 100%" cellspacing="0" cellpadding="0">\
	                                <tr id="EditorMenu">\
		                                <td style="width: 101px;"><img src="' + this.PlugPath + 'FontName.gif" alt="字体" abbr="FontName" char="" /></td>\
		                                <td style="width: 74px;"><img src="' + this.PlugPath + 'NormalDropDown.gif" alt="字号" abbr="FontSize" char=""  /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'forecolor.gif" alt="字体颜色" abbr="Color" char="ForeColor" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'BackColor.gif" alt="背景颜色" abbr="Color" char="BackColor" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'bold.gif" alt="粗体" abbr="bold" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'italic.gif" alt="斜体" abbr="italic" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'underline.gif" alt="下划线" abbr="underline" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'clear.gif" alt="删除文字格式" abbr="RemoveFormat" char=" " /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'Aleft.gif" alt="左对齐" abbr="Justifyleft" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'Acenter.gif" alt="居中" abbr="JustifyCenter" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'Aright.gif" alt="右对齐" abbr="JustifyRight" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'url.gif" alt="超级链接" abbr="createLink" char="" /></td>\
		                                <td style="width: 28px;"><img src="' + this.PlugPath + 'InsertFile.gif" alt="插入文件" abbr="File" path="/" char="*.swf" tag="swf" /></td>';
        if (!this.Simple) {
            strPage += '<td style="width: 28px;"><img src="' + this.PlugPath + 'UserFunction.gif" alt="插入标签" abbr="Window" char="TagList" /></td>';
        }
        strPage += '                  <td>&nbsp;</td>\
	                                </tr>\
                                </table>\
                            </td>\
                        </tr>\
                    </table>\
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">\
                        <tr>\
                            <td colspan="2"><textarea id="txtCode" name="txtCode" style="border-style: solid; border-width: 1px; border-color: Gray; border-bottom-width:0px; display:none;font-size: 9pt;width:99%;height:' + mHeight + 'px;" pCode="' + this.CodeID + '"></textarea>\
                            <iframe id="message" name="message" marginwidth="0" marginheight="0" style="border-style: solid; border-width: 1px; border-color: Gray; border-bottom-width:0px;width:99%;height:' + mHeight + 'px;" frameborder="0"></iframe></td>\
                        </tr>\
                        <tr style="background: #DCDCDC;">\
                            <td style="width: 80%; height: 100%">';
        if (!this.Simple) {
            strPage += '<table width="100%" border="0" cellspacing="0" cellpadding="0">\
                                    <tr>\
                                        <td class="HtmlEditor_On" id="HtmlEditor_Design"  style="width: 40px;"><img alt="设计" src="' + this.PlugPath + 'modeedit.gif" /></td>\
                                        <td class="HtmlEditor_Off" id="HtmlEditor_Html"  style="width: 40px"><img alt="代码" src="' + this.PlugPath + 'modecode.gif" /></td>\
                                        <td class="HtmlEditor_Off" id="HtmlEditor_View"  style="width: 40px;"><img alt="预览" src="' + this.PlugPath + 'modepreview.gif" /></td>\
                                        <td style="FONT-SIZE: 9pt">&nbsp;提示:回车换行请用[Shift]+[Enter]</td>\
                                        <td></td>\
                                    </tr>\
                                </table>';
        }

        strPage += '</td>\
                            <td style="width: 20%"></td>\
                        </tr>\
                    </table>\
                    <input type="hidden" id="iHead" value="" />\
                    <input type="hidden" id="PlugPath" value="' + this.PlugPath + '" />\
                    <input type="hidden" id="TagList" value="' + this.TagList + '" />\
                    <input type="hidden" id="UploadPagePath" value="' + this.UploadPagePath + '" />\
                    <input type="hidden" id="PlugUploadPath" value="' + this.PlugUploadPath + '" />\
                    <input type="hidden" id="VideoEx" value="' + this.VideoEx + '" />\
                    <input type="hidden" id="PicEx" value="' + this.PicEx + '" />\
                    <input type="hidden" id="FlashEx" value="' + this.FlashEx + '" />\
                    <input type="hidden" id="UploadPath" value="' + this.UploadPath + '" />\
                    <input type="hidden" id="ButtonName" value="' + this.ButtonName + '" />\
                    </body></html>';
        $(strIframe).appendTo($('#' + this.ContentID));
        var thisFrame = $('#' + this.EditorID)[0].contentWindow;
        thisFrame.document.open();
        thisFrame.document.clear();
        thisFrame.document.write(strPage);
        thisFrame.document.charset = "utf-8";
        thisFrame.document.close();
        $('#' + this.EditorID, $('#' + this.ContentID)).css('width', '100%');
        $('#' + this.EditorID, $('#' + this.ContentID)).css('height', this.EditorHeight + 'px');
        //        if (isNaN(this.EditorHeight)) {
        //            $('#message', thisFrame.document).css('height', this.EditorHeight);
        //            $('#txtCode', thisFrame.document).css('height', this.EditorHeight);
        //            $('#message').css('height', this.EditorHeight);
        //            $('#txtCode').css('height', this.EditorHeight);
        //            $('#' + this.EditorID, $('#' + this.ContentID)).css('height', this.EditorHeight);

        //        } else {
        //            $('#message', thisFrame.document).css('height', (this.EditorHeight - 60) + 'px');
        //            $('#txtCode', thisFrame.document).css('height', (this.EditorHeight - 60) + 'px');
        //            $('#message').css('height', (this.EditorHeight - 60) + 'px');
        //            $('#txtCode').css('height', (this.EditorHeight - 60) + 'px');
        //            $('#' + this.EditorID, $('#' + this.ContentID)).css('height', this.EditorHeight + 'px');

        //        }
        //alert($('#message')[0].id);
        //alert($('#message', thisFrame.document)[0].id);

    }
}
