
var Control=null;var Controls=null;var PageTemp="<html>\r\n"+"<head>\r\n"+"</head>\r\n"+"<body>\r\n"+"</body>\r\n"+"</html>\r\n";var Fonts=["宋体","雅黑","Arial","Courier New","Times New Roman","Verdana"];function lto(a,b){Core.LoadModules(function(){Control=Core.GetModule("Controls.js").Control;Controls=Core.GetModule("Controls.js");a()},b,["Controls.js"])}
function rlv(a,b,c,d){if(Core.Utility.qsd(b)){return b}else{b.style[c]=d;for(var i=0;i<b.childNodes.length;i++){var e=b.childNodes[i];if(!Core.Utility.qsd(b)){rlv(a,e,c,d)}}
return b}}
function drg(a,b,c,d){var e=a.createElement("DIV");e.innerHTML=b;for(var i=0;i<e.childNodes.length;i++){var f=e.childNodes[i];if(Core.Utility.qsd(f)){var g=a.createElement("SPAN");g.style[c]=d;if(f.nodeValue!=undefined)g.innerHTML=f.nodeValue.replace(/\</ig,function(){return"&lt;"});else if(f.textContent!=undefined)g.innetHTML=f.textContent.replace(/\</ig,function(){return"&lt;"});e.replaceChild(g,f)}else{rlv(a,f,c,d)}}
return e.innerHTML}
var EmotionForm=(function(){var c={};var d=document.createElement("DIV");d.className="EmotionForm";d.id=Core.GenerateUniqueId();d.style.display="none";d.style.width="436px";d.style.height="175px";for(var y=0;y<6;y++){for(var x=0;x<15;x++){(function(x,y){var b=document.createElement("DIV");b.className="EmotUnit";Core.Utility.AttachButtonEvent(b,"EmotUnit","EmotUnit_hover","EmotUnit_hover");b.onmousedown=function(a){Core.Utility.CancelBubble(a==undefined?window.event:a);c.Close();if(e!=null)e(String.format("Public/Images/Emotion/e{0}.gif",y*15+x+100))}
d.appendChild(b)})(x,y)}}
var e=null;c.xzz=function(x,y,a){if(d.style.display=="none"){Desktop.EnterMove("default");d.style.left=Math.max(x,0)+"px";d.style.top=Math.max(y,0)+"px";d.style.display="block";e=a}}
c.Close=function(){if(d.style.display=="block"){d.style.display="none";Desktop.LeaveMove()}}
c.mek=function(){return d}
c.ykl=function(){return 436}
c.kaw=function(){return 175}
document.body.appendChild(d);Core.Utility.AttachEvent(document,"mousedown",function(){c.Close()});return c})();function wgh(h){var j=this;Control.call(j,h);var k={lls:j.lls,is:j.is}
j.is=function(a){return a==j.lls()?true:k.is(a)}
j.lls=function(){return"wgh"}
var l=new Controls.Toolbar({Left:0,Top:0,Width:j.GetClientWidth(),Height:24,BorderWidth:0,Css:'toolbar',Parent:j,AnchorStyle:Controls.AnchorStyle.Left|Controls.AnchorStyle.Right|Controls.AnchorStyle.Top,Text:"",Items:[{Css:"Image22_B",Text:"",Command:"B"},{Css:"Image22_I",Text:"",Command:"I"},{Css:"Image22_U",Text:"",Command:"U"},{Type:"DropDownList",Width:120},{Type:"DropDownList",Width:50},{Css:"Image22_Emotion",Text:"表情",Command:"AddEmotion"},{Css:"Image22_jea",Text:"清除格式",Command:"jea"},{Css:"Image22_Delete",Text:"清空",Command:"Empty"}]});for(var i in Fonts){l.GetControl(3).AddItem(Fonts[i])}
l.GetControl(3).yca(Fonts[0]);Core.Utility.DisableSelect(l.GetControl(3).mek(),true);Core.Utility.DisableSelect(l.GetControl(3).GetListDom(),true);l.GetControl(3).OnChanged.Attach(function(){p.execCommand("FontName",false,l.GetControl(3).GetValue())});for(var i=12;i<=24;i+=2){l.GetControl(4).AddItem(i)}
for(var i=36;i<=72;i+=12){l.GetControl(4).AddItem(i)}
l.GetControl(4).yca(12);Core.Utility.DisableSelect(l.GetControl(4).mek(),true);Core.Utility.DisableSelect(l.GetControl(4).GetListDom(),true);l.GetControl(4).OnChanged.Attach(function(){var a=j.ffk();j.qpz();j.ejo(drg(p,a,"fontSize",l.GetControl(4).GetText()+"px"))});var m="";l.OnCommand.Attach(function(c){switch(c){case"B":{p.execCommand("Bold",false,null);q.focus();break}
case"I":{p.execCommand("Italic",false,null);q.focus();break}
case"U":{p.execCommand("Underline",false,null);q.focus();break}
case"A":{p.execCommand("CreateLink",false);q.focus();break}
case"jea":{var d=j.ffk();j.qpz();var e=p.createElement("DIV");e.innerHTML=d;j.ejo(Core.Utility.jeaHtml(e));break}
case"Empty":{j.yca("");break}
case"AddEmotion":{var f=Core.Utility.GetClientCoord(l.GetControl(5));var g=Core.Utility.GetClientCoord(document.body);var y=0;if(f.Y-g.Y>EmotionForm.kaw())y=f.Y-g.Y-EmotionForm.kaw();else y=f.Y+l.GetControl(5).offsetHeight;j.qpz();EmotionForm.xzz(f.X-g.X-300+l.GetControl(5).offsetWidth,y,function(a){var b=String.format("<img src='download.aspx?FileName={0}'/>",escape(a));if(!j.ejo(b)){j.jxo(b)}});break}}});j.xrd=function(a){var b="";for(var i in a){var c=String.format("<a href='download.los?FileName={{Accessory {0}}' target='_blank'>{1}</a>",escape(String.format("src='{0}'",a[i])),Core.IO.Path.GetFileName(escape(a[i])));b+=c}
return b}
var n=new Editor();var o=n.wyl();var p=n.wyl().contentWindow.document;var q=n.wyl().contentWindow;if(Core.vov()=="Firefox"){o.onload=function(){p.designMode="on"}}else{p.designMode="on"}
p.open();p.write(PageTemp);p.close();Core.Utility.AttachEvent(p,"mousedown",function(){try{if(p.activeElement==null){q.focus()}else{p.activeElement.focus()}}catch(ex){}});p.onkeydown=function(e){var a=new Core.Event(e,q);if(a.GetEvent().keyCode==116||(a.GetEvent().ctrlKey&&a.GetEvent().keyCode==82)){a.GetEvent().keyCode=0;a.GetEvent().returnValue=false;return false}
if(a.GetEvent().keyCode==70&&a.GetEvent().ctrlKey&&!a.GetEvent().altKey&&!a.GetEvent().shiftKey){a.GetEvent().keyCode=0;a.GetEvent().returnValue=false;return false}}
var s=null;j.qpz=function(){if(Core.vov()=="IE"){s=p.selection.createRange();if(s.parentElement().document!=p){s=null}}else if(Core.vov()=="Firefox"||Core.vov()=="Chrome"){var a=q.geteya();if(a.rangeCount>0)s=a.getRangeAt(0);else s=null}}
j.ffk=function(){if(Core.vov()=="IE"){var r=p.selection.createRange();if(r.htmlText!=undefined)return r.htmlText;else return""}else if(Core.vov()=="Firefox"||Core.vov()=="Chrome"){var a=q.geteya();if(a.rangeCount>0){var r=null;r=a.getRangeAt(0);return Core.Utility.cyo(r.cloneContents().childNodes)}else{return""}}else{return""}}
j.ejo=function(a){if(s!=null){if(Core.vov()=="IE"){if(s.pasteHTML!=undefined){s.select();s.pasteHTML(a);return true}}else if(Core.vov()=="Firefox"||Core.vov()=="Chrome"){if(s.deleteContents!=undefined&&s.insertNode!=undefined){var b=p.createElement("DIV");b.innerHTML=a;var c=[];for(var i=0;i<b.childNodes.length;i++){c.push(b.childNodes[i])}
s.deleteContents();for(var i in c){b.removeChild(c[i]);s.insertNode(c[i])}
return true}}}
return false}
this.Blur=function(){n.Blur()}
this.jxo=function(a){p.body.innerHTML+=a}
this.GetValue=function(){return p.body.innerHTML}
this.yca=function(a){if(a!=undefined&&a!=null){p.body.innerHTML=a}}
this.Focus=function(){q.focus()}
this.ktl=function(){return p}
this.wyl=function(){return o}
this.iew=function(){return q}
this.OnKeyDown=new Core.Delegate();Core.Utility.AttachEvent(p,"keydown",function(a){if(a==undefined)a=q.event;j.OnKeyDown.Call(a)});if(h.StyleSheet)n.Link("StyleSheet",h.StyleSheet,"text/css");j.SetCss("richEditor");function Editor(){var b=this;var c={Left:0,Top:24,Width:j.GetClientWidth(),Height:j.GetClientHeight()-24,BorderWidth:0,Css:'editor',Parent:j,AnchorStyle:Controls.AnchorStyle.All};Controls.Frame.call(this,c);var d={lls:this.lls,is:this.is}
b.is=function(a){return a==this.lls()?true:d.is(a)}
b.lls=function(){return"wgh.Editor"}}}
Module.wgh=wgh;