window.isIEBool=(navigator.appName=="Microsoft Internet Explorer");window.isChrome=window.navigator.userAgent.indexOf("Chrome")!=-1;window.isOpera=window.opera?true:false;window.isWebKit=navigator.userAgent.indexOf("AppleWebKit/")>-1;window.isGecko=navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1;if(window.isIEBool){if(navigator.userAgent.indexOf("Opera")>-1){window.isIEBool=null}}else{if(window.isOpera&&Math.floor((navigator.userAgent.toLowerCase().match(/opera.([\d.]+)/)[1]))<9){window.isIEBool=null}}Function.prototype.bindAsEventListener2=function(B,C){var A=this;return function(D){return A.call(B,D||window.event,C)}};var Dom=Dom||function(){};Dom.create=function(A,B,D){var C=document.createElement(A);if(B){C.className=B}if(!D){D=document.body}D.appendChild(C);return C};Dom.show=function(A){A.style.visibility="visible"};Dom.hide=function(A){A.style.visibility="hidden"};Dom.showD=function(A,B){A.style.display=B?B:""};Dom.hideD=function(A){A.style.display="none"};Dom.getClientRect=function(A){var B={left:0,top:0,width:0,height:0,bottom:0,right:0};if(A==document){A=document.documentElement}B.left=0;B.top=0;if(A==document.body&&!window.isIEBool){A=document.documentElement;B.width=A.scrollWidth;B.height=A.scrollHeight}else{B.width=A.clientWidth;B.height=A.clientHeight}B.bottom=B.top+B.height;B.right=B.left+B.width;return B};Dom.getOffsetRect=function(A){var B={left:0,top:0,width:0,height:0,bottom:0,right:0};if(A==document){A=document.documentElement;B.left=A.scrollLeft;B.top=A.scrollTop;if(window.isIEBool){B.width=A.offsetWidth;B.height=A.offsetHeight}else{B.width=window.innerWidth;B.height=window.innerHeight}}else{B.left=A.offsetLeft;B.top=A.offsetTop;if(A==document.body&&!window.isIEBool){A=document.documentElement;B.width=A.scrollWidth;B.height=A.scrollHeight}else{B.width=A.offsetWidth;B.height=A.offsetHeight}}B.bottom=B.top+B.height;B.right=B.left+B.width;return B};Dom.getRect=function(A){var C=Dom.getOffsetRect(A);var B=A.offsetParent;while(B){var D=Dom.getOffsetRect(B);C.left+=D.left;C.top+=D.top;B=B.offsetParent}C.bottom=C.top+C.height;C.right=C.left+C.width;return C};Dom.setPosition=function(B,A){B.style.left=A.left+"px";B.style.top=A.top+"px"};Dom.setRect=function(A,B){Dom.setPosition(A,B);A.style.width=B.width+"px";A.style.height=B.height+"px"};Dom.isInRect=function(A,B){return(A.left>=B.left&&A.top>=B.top&&A.left<=B.right&&B.top<=B.bottom)};Dom.maxRect=function(B,A){var C={left:0,top:0,width:0,height:0,bottom:0,right:0};C.left=Math.min(B.left,A.left);C.top=Math.min(B.top,A.top);C.bottom=Math.max(B.bottom,A.bottom);C.right=Math.max(B.right,A.right);C.width=C.right-C.left;C.height=C.bottom-C.top;return C};Dom.showModalDialog=function(D,C,F){var H=false;if(!C){C=null}var A="";if(window.isIEBool){if(F){var E;for(E=0;E<F.length;E++){var B=F[E][0];var G=F[E][1];switch(B){case"width":B="dialogWidth";G=G+"px";break;case"height":B="dialogHeight";G=G+"px";break}A+=B+":"+G+";"}}H=window.showModalDialog(D,C,A)}else{if(F){var E;for(E=0;E<F.length;E++){var B=F[E][0];var G=F[E][1];A+=B+"="+G+","}}if(window.isOpera===true){window.dialogArguments=C}H=window.open(D,null,A+"modal=yes");if(!window.isOpera){H.dialogArguments=C}}return H};Dom.open=function(D,C,F,B){var G=false;if(!C){C=null}var A="";if(!F){F=[["modal","yes"]]}if(B){F.push(["location","no"]);F.push(["menubar","no"]);F.push(["toolbar","no"]);F.push(["scrollbars","yes"]);F.push(["resizable","yes"])}var E;for(E=0;E<F.length;E++){A+=F[E][0]+"="+F[E][1];if(E!=F.length-1){A+=","}}window.openDialogArguments=C;G=window.open(D,null,A);return G};Dom.ready=function(A){Dom._readyFns=Dom._readyFns||[];Dom._readyFns.push(A)};(function(){var C=function(){if(window._domready){return}window._domready=true;while(Dom._readyFns&&Dom._readyFns.length){Dom._readyFns.shift().call()}};window.isWebKit=window.isWebKit||navigator.userAgent.indexOf("AppleWebKit/")>-1;window.isIEBool=window.isIEBool||(navigator.appName=="Microsoft Internet Explorer");if(window.isWebKit){(function(){var D=document.readyState;(D=="loaded"||D=="complete")?C():setTimeout(arguments.callee,50)})()}else{if(window.isIEBool){var A=document.createElement("div");(function(){try{A.doScroll("left");document.body.appendChild(A);A.innerHTML="tmp";document.body.removeChild(A);C()}catch(D){setTimeout(arguments.callee,50)}})()}else{try{Event.observe(window,"load",C,false);Event.observe(document,"DOMContentLoaded",C,false)}catch(B){window.addEventListener("load",C,false);document.addEventListener("DOMContentLoaded",C,false)}}}})();var Editor=new Object();Editor.editorWin=false;Editor.editorObj=false;Editor.cache=false;Editor.coder=false;Editor.selection=false;Editor.rangeCache=false;Editor.viewState="view";Editor.init=function(A,C,D,B){Editor.menu=$(A);Editor.coder=$(D);if(window.isIEBool==null){alert("\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u7f16\u8f91\u5668\u5f88\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u5efa\u8bae\u60a8\u91c7\u7528IE\u6216Firefox\uff01");Dom.show(Editor.coder);Editor.menu.style.height="0px"}else{if(window.isIEBool&&$(B)){$(B).style.display=""}Editor.container=$(C);Editor.initElements()}};Editor.initTools=function(){Editor.controls=new Object();var Y=Config.tool.data;var N=Config.tool.css;var G=false;for(var U=0;U<Y.length;U++){var R=Dom.create("div",N.part,Editor.menu);var X=Y[U];for(var T=0;T<X.length;T++){Dom.create("div",N.newLine,R);var J=Dom.create("div",N.row,R);var L=X[T];for(var S=0;S<L.length;S++){var H=L[S];var E=H[0];var O=H[1];if(E=="line"){var K=Config.imgPath+O+".gif";var C=Dom.create("div",N.tool,J);var Z=Dom.create("img",false,C);Z.src=K}else{var a=H[2];var W=H[3];var P=H[4];var I=H[5];var V=H[6];var C=Dom.create("div",N.tool,J);Editor.controls[O]=C;C.sohu={};C.sohu.id=O;C.sohu.type=E;C.sohu.state=0;if(E=="img"){var K=Config.imgPath+O+".gif";var Z=Dom.create("img",false,C);Z.src=K;Z.alt=a;Z.title=a;C.sohu.tool=Z}else{var M=O+"Select";var F=Dom.create("div",O,C);if(window.isIEBool){C.sohu.tool=new Array();C.sohu.tool.selectedIndex=0;C.sohu.tool[0]=Dom.create("div",M,F);C.sohu.tool[0].sohuValue=null;var A,B;if(O=="fontname"){A=Config.lister.fontNameData.text;B=Config.lister.fontNameData.value;C.sohu.tool[0].innerHTML="\u5b57\u4f53"}else{A=Config.lister.fontSizeData.text;B=Config.lister.fontSizeData.value;C.sohu.tool[0].innerHTML="\u5b57\u53f7"}var Q=0;for(Q=0;Q<A.length;Q++){var D=Dom.create("div",M,F);D.style.display="none";D.innerHTML=A[Q];D.sohuValue=B[Q].toString();C.sohu.tool[Q+1]=D}}else{C.sohu.tool=Dom.create("div",M,F)}}C.sohu.downCall=W;if(P){C.sohu.upCall=P;if(I){C.sohu.selectCall=I}if(V){C.sohu.cancelCall=V}}else{C.sohu.upCall=W}Event.observe(C,"mouseover",Editor.toolMouseOver.bind(Editor,C));Event.observe(C,"mouseout",Editor.toolMouseOut.bind(Editor,C));Event.observe(C,"mousedown",Editor.toolMouseDown.bind(Editor,C));Event.observe(C,"mouseup",Editor.toolMouseUp.bindAsEventListener2(Editor,C))}}}}};Editor.initElements=function(){var C=Config.tool.css;Dom.show(Editor.coder);Dom.hideD(Editor.coder);Editor.initTools();Editor.menu.onselectstart=function(){return false};window.sohu={};var J=window.isIEBool?"<iframe frameborder='0'></iframe>":"iframe";Editor.editorObj=Dom.create(J,C.editor,Editor.container);Editor.editorWin=Editor.editorObj.contentWindow;try{var I=parseInt(Config.size.editorContent.height);if(I&&I>5){Editor.editorObj.style.height=I+"px";Editor.coder.style.height=(I-2)+"px"}}catch(D){}var H=Editor.editorWin.document;H.open();var B="";B+="<html>";B+="<head>";B+='<meta http-equiv="Content-Type" content="text/html; charset=gbk" />';B+="<style> *{line-height:130%;}body{margin:5px;font-size:14px;line-height:130%;font-family:'\u5b8b\u4f53',Verdana,Arial,Helvetica,sans-serif;}img{border:0;}p{margin:0.1em auto;}marquee{background:#dddddd}</style>";B+="</head>";B+="<body>";if(!window.isIEBool){B+=Editor.coder.value}B+="</body>";B+="</html>";H.write(B);H.close();if(window.isIEBool){Editor.iCache=Dom.create("iframe",C.cache,Editor.container);Editor.iCacheDoc=Editor.iCache.contentWindow.document;Editor.iCacheDoc.open();Editor.iCacheDoc.write("<html><head><style>body{font-family:'\u5b8b\u4f53';}</style></head><body></body></html>");Editor.iCacheDoc.close();H.body.contentEditable=true;Event.observe(Editor.editorWin.document.body,"beforedeactivate",Editor.cacheRange);Event.observe(Editor.getDocument().body,"paste",Editor.shortcutPaste);Event.observe(Editor.editorWin.document,"selectionchange",Editor.checkAllState);Event.observe(Editor.editorWin.document,"keyup",Editor.checkAllState);if(Config.enableClipBoard){Event.observe(window,"unload",function(){var K=Editor.editorWin.document.body.createTextRange();K.execCommand("Copy")})}Editor.editorWin.document.body.innerHTML=Editor.coder.value}else{Editor.disableSpecialTool();Editor.bindLoadFF()}if((Config.enabledFeature&&Config.enabledFeature.pasteForbidden)){Event.stopObserving(Editor.getDocument().body,"paste");Event.observe(Editor.getDocument().body,"paste",Editor.noDefaultPaste);Event.observe(Editor.getDocument(),"keydown",Editor.noPasteKeyDown);Event.observe(Editor.getDocument(),"keypress",Editor.noPasteKeyDown);Event.observe(Editor.getDocument(),"contextmenu",Editor.noPasteContext)}Editor.cache=Dom.create("div",C.cache,document.body);if(!Config.disableCodeMode){var G=Dom.create("div",Config.tool.css.footer,Editor.container);Editor.viewControler=document.createElement("input");Editor.viewControler.type="checkbox";G.appendChild(Editor.viewControler);var E=document.createElement("span");G.appendChild(E);E.style.display="inline-block";E.style.height="20px";E.style.lineHeight="20px";E.innerHTML="\u663e\u793a\u6e90\u4ee3\u7801";Event.observe(G,"click",Editor.setView)}if(Editor.controls.fontname){Editor.setFontName("\u5b8b\u4f53")}if(Editor.controls.fontsize){Editor.setFontSize(3)}if(Config.counter){var F="";F+='    <span id="counter-label" class="counter-title">\u5269\u4f59\u5b57\u6570:</span>';F+='    <span id="counter" class="counter"></span><span >\u5b57</span>';var A=$(document.createElement("div"));A.addClassName(Config.counter.cls);A.innerHTML=F;G.insert({top:A});A.displayEl=A.select("#counter")[0];A.labelEl=A.select("#counter-label")[0];Editor.counter=A;Event.observe(Editor.editorWin.document,"keyup",Editor.onWinKeyUpDoCounting.bind(Editor));Event.observe(Editor.editorWin.document,"focus",Editor.onWinKeyUpDoCounting.bind(Editor));Event.observe(Editor.viewControler,"click",function(){if(Editor.viewControler.checked===true){Editor.counter.hide()}else{Editor.counter.onActivate()}});Editor.counter.onActivate=function(){this.show();Editor.onWinKeyUpDoCounting()}}if(Config.backup){if(window.isOpera){Event.observe(window,"blur",Editor.onWinUnloadBackupContent.bind(Editor))}else{Event.observe(window,"unload",Editor.onWinUnloadBackupContent.bind(Editor))}Editor.restoreBackupedContent()}};Editor.disableSpecialTool=function(){Editor.setState(Editor.controls.cut,-3);Editor.setState(Editor.controls.copy,-3);if(!(Config.enabledFeature&&Config.enabledFeature.pasteForbidden)){Editor.setState(Editor.controls.paste,-3)}if(Editor.controls.cut){Editor.controls.cut.sohu.tool.title="\u63d0\u793a\uff1a\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e [Ctrl + C]\uff01"}if(Editor.controls.copy){Editor.controls.copy.sohu.tool.title="\u63d0\u793a\uff1a\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e [Ctrl + X]\uff01"}if(!(Config.enabledFeature&&Config.enabledFeature.pasteForbidden)){if(Editor.controls.paste){Editor.controls.paste.sohu.tool.title="\u63d0\u793a\uff1a\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e [Ctrl + V]\uff01"}}};Editor.bindLoadFF=function(){Editor.setDesignMode(true);Event.observe(Editor.editorWin.document.body,"mouseup",Editor.checkAllState);Event.observe(Editor.editorWin.document,"keyup",Editor.checkAllState)};Editor.setContent=function(){if(Editor.coder.style.display=="none"){Editor.coder.value=Editor.editorWin.document.body.innerHTML}};Editor.preview=function(){var E=$F("entrytitle");if(E==""){alert("\u8bf7\u586b\u5199\u65e5\u5fd7\u6807\u9898");$("entrytitle").focus();return}E=E.convertTextToHTML();Editor.setContent();var C=$F(Editor.coder);if(C.length<1){alert("\u8bf7\u586b\u5199\u65e5\u5fd7\u5185\u5bb9");return}var B=[];var A={win:window,title:E,content:C};var D=Dom.open("/editor/html/preview.html",A,B,true)};Editor.restoreBackupedContent=function(){this.setupBackupStore();this.backupStore.get("content-backup",function(A,B){if(A){this.editorWin.document.body.innerHTML=B}}.bind(this))};Editor.onWinUnloadBackupContent=function(){this.setupBackupStore();this.backupStore.set("content-backup",Editor.editorWin.document.body.innerHTML)};Editor.setupBackupStore=function(){if(!this.backupStore){this.backupStore=new Persist.Store("editor",{swf_path:Config.contextPath+"persist.swf"})}};Editor.onWinKeyUpDoCounting=function(){var J=this.editorWin.document.body;var G=(typeof J.textContent==="string")?J.textContent:J.innerText;var H=0;var C=/[\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[\uf900-\ufa2d]/g;var E=/\s/g;var I=G.match(C),A=G.match(E);var B=Config.counter["cn-bytes"]||2;var K=I?I.length:0;var F=G.length-K-(A?A.length:0);H+=K*B;H+=F;var D=Math.floor((Config.counter["max-characters"]-H)/2);this.remain=D;if(D>=0){if(this.counter.overflowed){this.counter.overflowed=false;this.counter.labelEl.update(Config.counter.INRANGE_LABEL||"\u5269\u4f59\u5b57\u6570:");this.counter.removeClassName("counter-overflowed")}this.counter.displayEl.update(D)}else{this.counter.overflowed=true;this.counter.labelEl.update(Config.counter.OVERFLOW_LABEL||"\u5df2\u8d85\u51fa\u9650\u5236:");this.counter.addClassName("counter-overflowed");this.counter.displayEl.update(Math.abs(D))}};Editor.checkAllState=function(){if(!Editor.isChecking){Editor.isChecking=true;if(!Editor.stateArray){Editor.stateChecking=true;if(window.isIEBool){Editor.stateArray=["Paste","Cut","Copy","FontName","FontSize","Bold","Italic","Underline","JustifyLeft","InsertOrderedList","InsertUnorderedList","Undo"]}else{Editor.stateArray=["fontname","fontsize","bold","italic","underline","justifyleft","insertorderedlist","insertunorderedlist"]}}try{var A=Editor.editorWin.document;if(A){var B=0;for(B=0;B<Editor.stateArray.length;B++){Editor.checkCommandState(Editor.stateArray[B],A)}}}catch(C){}finally{Editor.isChecking=false}}if((Config.enabledFeature&&Config.enabledFeature.pasteForbidden)){Editor.setState(Editor.controls.paste,0)}};Editor.checkCommandState=function(F,I){var B=false;var J=F.toLowerCase();var G=Editor.controls[J];if(J=="insertorderedlist"){G=Editor.controls.orderlist}else{if(J=="insertunorderedlist"){G=Editor.controls.unorderlist}}switch(J){case"cut":case"copy":case"paste":B=I.queryCommandEnabled(F);if(B){Editor.setState(G,0)}else{Editor.setState(G,-3)}break;case"fontname":case"fontsize":B=I.queryCommandValue(F);if(window.isIEBool){var L=G.sohu.tool;var E=L.selectedIndex;if(L[E].sohuValue!=B){var H=0,P=false;if(B!=null){for(H=1;H<L.length;H++){if(L[H].sohuValue==B){P=true;L.selectedIndex=H}}}if(!P){L.selectedIndex=0}if(L.selectedIndex!=E){L[E].style.display="none";L[L.selectedIndex].style.display=""}}}else{if(J=="fontname"){if(B==""){break}else{B=B.replace(/'/g,"");var C=B.indexOf(",");if(C>0){B=B.substr(0,C)}C=B.indexOf("_");if(C>0){B=B.substr(0,C)}}}else{if(B==""){break}else{var H=0,P=false;var O=window.isWebKit?Config.lister.fontSizeData.safariValue:Config.lister.fontSizeData.value;for(H=0;H<O.length;H++){if(O[H]==B){B=Config.lister.fontSizeData.text[H];P=true;break}}if(!P){B="\u5b57\u53f7"}}}G.sohu.tool.innerHTML=B}break;case"justifyleft":case"justifycenter":case"justifyright":var D=0,A=0,N=0;if(window.isIEBool||window.isOpera){D=I.queryCommandState("JustifyLeft")?-2:0;A=I.queryCommandState("JustifyCenter")?-2:0;N=I.queryCommandState("JustifyRight")?-2:0}else{if(window.isWebKit){var Q=this.getElementPath(this.GetBoundaryParentElement(true));var M=Q.block||Q.blocklimit;var K;K=$(M).getStyle("text-align");K=K.replace(/(-moz-|-webkit-|start|auto)/i,"");D=(K==="left")?-2:0;A=(K==="center")?-2:0;N=(K==="right")?-2:0}else{B=I.queryCommandValue(F);if(B=="left"){D=-2}if(B=="center"){A=-2}if(B=="right"){N=-2}}}Editor.setState(Editor.controls.justifyleft,D);Editor.setState(Editor.controls.justifycenter,A);Editor.setState(Editor.controls.justifyright,N);break;case"undo":B=Editor.editorWin.document.queryCommandEnabled(F);if(B){Editor.setState(G,0)}else{Editor.setState(G,-3)}break;default:B=I.queryCommandState(F);if(B){Editor.setState(G,-2)}else{Editor.setState(G,0)}break}return B};Editor.command=function(D,B){var A=false;if(Editor.isView()){Editor.checkRange();if(B&&B=="#"&&window.isIEBool){Editor.removeColor(D)}else{try{if(!window.isIEBool){D=D.toLowerCase()}Editor.editorWin.document.execCommand(D,false,B);if(!window.isIEBool){Editor.editorWin.focus()}}catch(C){}}}return A};Editor.getText=function(){var A=Editor.getRange();if(A){if(Editor.selection.type.toLowerCase()=="control"){html=A.item(0).innerHTML}else{html=A.text}if(!html){html=""}}return html};Editor.removeColor=function(C){var B=Editor.getText();if(B.length>0){var A=Editor.getSpecialElement("font",true);if(A&&A.innerHTML==B){if(C=="ForeColor"){A.color=""}else{A.style.backgroundColor=""}}}else{Editor.editorWin.document.execCommand(C,false,"#")}};Editor.undo=function(){Editor.command("Undo",1);return -1};Editor.checkFocus=function(){if(window.sohu&&window.sohu.win&&window.sohu.win.win){window.sohu.win.win.focus()}};Editor.setState=function(A,C,B){if(!A){A=Editor.controls[B]}if(A){A.sohu.state=C;if(A.sohu.type!="select"){switch(C){case 1:A.className=Config.tool.css.toolOver;break;case 0:A.className=Config.tool.css.tool;break;case -1:case -2:A.className=Config.tool.css.toolDown;break;case -3:A.className=Config.tool.css.toolDisable;break}}}};Editor.toolMouseOver=function(A){if(Editor.isView()&&A.sohu.state==0){Editor.setState(A,1)}};Editor.toolMouseOut=function(A){if(Editor.isView()&&(A.sohu.state==1||A.sohu.state==-1)){Editor.setState(A,0)}};Editor.toolMouseDown=function(A){if(Editor.isView()&&A.sohu.state!=-3){if(Lister.now){if(!(A.sohu.lister&&A.sohu.lister==Lister.now)){Lister.now.cancel(false)}}if(A.sohu.state!=-1&&A.sohu.state!=-2){Editor.setState(A,-1)}}};Editor.toolMouseUp=function(C,A){if(Editor.isView()&&A.sohu.state!=-3){var B=1;if(A.sohu.state==-1){B=A.sohu.downCall.call(Editor)}if(A.sohu.state==-2){B=A.sohu.upCall.call(Editor)}Editor.setState(A,B);Event.stop(C);Editor.checkAllState()}};Editor.blankUpCall=function(){return 0};Editor.blankCall=function(A){if(typeof(A)!="undefined"){return A}};Editor.normalCancelCall=function(B,A){var C=0;if(A){C=A}Editor.setState(null,C,B)};Editor.showFontNameList=function(){var A=Editor.controls.fontname;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.fontNameData,1,Config.lister.option)}A.sohu.lister.show();return -2};Editor.hideFontNameList=function(){var A=Editor.controls.fontname;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.setFontName=function(A){if(A){Editor.command("FontName",A)}Editor.showFontName(null,A);Editor.setState(null,0,"fontname")};Editor.cancelFontName=function(){Editor.setState(null,0,"fontname")};Editor.showFontName=function(D,A){if(window.isIEBool){tool=Editor.controls.fontname.sohu.tool;var G=false;for(var C=1;C<tool.length;C++){if(tool[C].sohuValue==A){tool[C].style.display="";tool[0].innerHTML=tool[C].innerHTML}else{tool[C].style.display="none"}}}else{var B=Editor.controls.fontname.sohu.tool;var F="\u5b57\u4f53";if(D){F=D}else{if(A){var C=0;var E=Config.lister.fontNameData;for(C=0;C<E.value.length;C++){if(E.value[C]==A){F=E.text[C]}}}}B.innerHTML=F}};Editor.showFontSizeList=function(){var A=Editor.controls.fontsize;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.fontSizeData,1,Config.lister.option)}A.sohu.lister.show();return -2};Editor.hideFontSizeList=function(){var A=Editor.controls.fontsize;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.setFontSize=function(A){if(A){Editor.command("FontSize",A)}Editor.showFontSize(null,A);Editor.setState(null,0,"fontsize")};Editor.cancelFontSize=function(){Editor.setState(null,0,"fontsize")};Editor.showFontSize=function(D,A){if(window.isIEBool){tool=Editor.controls.fontsize.sohu.tool;for(var C=1;C<tool.length;C++){if(tool[C].sohuValue==A){tool[C].style.display="";tool[0].innerHTML=tool[C].innerHTML}else{tool[C].style.display="none"}}}else{var B=Editor.controls.fontsize.sohu.tool;var F="\u5b57\u53f7";if(D){F=D}else{if(A){var C=0;var E=Config.lister.fontSizeData;for(C=0;C<E.value.length;C++){if(E.value[C]==A){F=E.text[C]}}}}B.innerHTML=F}};Editor.showForeColorList=function(){var A=Editor.controls.forecolor;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.colorData,6,Config.lister.option)}A.sohu.lister.show();return -2};Editor.hideForeColorList=function(){var A=Editor.controls.forecolor;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.setForeColor=function(A){if(A=="#"){A="#000000"}if(A){Editor.command("ForeColor",A)}Editor.setState(null,0,"forecolor")};Editor.cancelForeColor=function(){Editor.setState(null,0,"forecolor")};Editor.showBackColorList=function(){var A=Editor.controls.backcolor;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.colorData,6,Config.lister.option)}A.sohu.lister.show();return -2};Editor.hideBackColorList=function(){var A=Editor.controls.backcolor;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.setBackColor=function(A,B){if(A=="#"){A="#FFFFFF"}if(A){if(window.isIEBool){Editor.command("BackColor",A)}else{Editor.command("hilitecolor",A)}}Editor.setState(null,0,"backcolor")};Editor.cancelBackColor=function(){Editor.setState(null,0,"backcolor")};Editor.getDocument=function(){return Editor.editorWin.document};Editor.setDesignMode=function(A){Editor.getDocument().designMode=A?"On":"Off"};Editor.canEdit=function(){return(Editor.viewState!="changing")};Editor.isView=function(){return(Editor.viewState=="view")};Editor.showBrow=function(){var B=Editor.controls.emot;if(!B.sohu.lister){var A={init:function(C,D){Emote.init({parent:C,output:"url",callback:function(E,F){if(E){D('<img src="'+E+'" title="'+F+'" alt="'+F+'" />')}else{D()}},matrix:{"20":[10,7],"42":[6,4]},stat:"editor"})},type:"function"};B.sohu.lister=new Lister(B,A,8,Config.lister.option)}B.sohu.lister.show();return -2};Editor.hideBrow=function(){var A=Editor.controls.emot;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.addBrow=function(A){if(A){var B="&nbsp;"+A+"&nbsp;";Editor.pasteHTML(B)}Editor.setState(null,0,"emot")};Editor.cancelBrowCall=function(){Editor.setState(null,0,"emot")};Editor.fastPasteHTML=function(B){if(window.isIEBool){var A=Editor.editorWin.document.selection.createRange();if(A){A.pasteHTML(B)}}else{var A=Editor.editorWin.document;A.execCommand("inserthtml",null,B)}};Editor.pasteHTML=function(C){var D=false;try{if(Editor.isView()){var B=Editor.getRange();if(B){if(window.isIEBool){if(Editor.selection.type.toLowerCase()=="control"){var A=Editor.editorWin.document.body.createTextRange();A.moveToElementText(B.item(0));B=A}B.pasteHTML(C);B.select();Editor.checkAllState()}else{Editor.command("inserthtml",C)}D=true}else{alert("\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u64cd\u4f5c\uff01")}}}catch(E){}return D};Editor.getClipboardData=function(){var A="";if(window.isIEBool){Editor.iCacheDoc.body.innerHTML="";Editor.iCacheDoc.body.createTextRange().execCommand("Paste");A=Editor.iCacheDoc.body.innerHTML;Editor.iCacheDoc.body.innerHTML=""}else{}return A};Editor.clearFromWord=function(A){A=A.replace(/<\/?SPAN[^>]*>/gi,"");A=A.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");A=A.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi,"<$1$3");A=A.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");A=A.replace(/<\\?\?xml[^>]*>/gi,"");A=A.replace(/<\/?\w+:[^>]*>/gi,"");A=A.replace(/<\/?\w+:[^>]*>/gi,"");A=A.replace(/<\/?\w+:[^>]*>/gi,"");return A};Editor.getSelectedHTML=function(){var D="";var B=Editor.getRange();if(B){if(window.isIEBool){if(Editor.selection.type.toLowerCase()=="control"){D=B.item(0).outerHTML}else{D=B.htmlText}if(!D){D=""}}else{if(Editor.selection.rangeCount>0){var C=Editor.selection.getRangeAt(0);var A=C.cloneContents();Editor.cache.innerHTML="";Editor.cache.appendChild(A);D=Editor.cache.innerHTML;Editor.cache.innerHTML=""}}}return D};Editor.setBold=function(){var A=Editor.command("Bold")?-2:0;return A};Editor.setItalic=function(){var A=Editor.command("Italic")?-2:0;return A};Editor.setUnderline=function(){var A=Editor.command("Underline")?-2:0;return A};Editor.copy=function(){if(window.isIEBool){Editor.command("Copy");return -1}else{alert("\u63d0\u793a\uff1a\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e [Ctrl + C]\uff01");return 0}};Editor.cut=function(){if(window.isIEBool){Editor.command("Cut");return -1}else{alert("\u63d0\u793a\uff1a\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e [Ctrl + X]\uff01");return 0}};Editor.noPasteContext=function(A){A=A||window.event;Event.stop(A)};Editor.noPasteKeyDown=function(A){var B=A||window.event;if((B.ctrlKey&&B.keyCode==86)||B.keyCode==45){Editor.noDefaultPaste(B);Event.stop(B)}};Editor.noDefaultPaste=function(A){alert("\u5982\u679c\u60a8\u8981\u7c98\u8d34\u5185\u5bb9\u5230\u73ed\u7ea7\u7559\u8a00\uff0c\u8bf7\u70b9\u51fb\u7f16\u8f91\u5668\u5de5\u5177\u680f\u4e0a\u7684\u7c98\u8d34\u6309\u94ae\u3002");Event.stop(A);return false};Editor.showPaste=function(C){var D=Editor.controls.paste;var B=Config.popupDialog.paste;var E=[["height",B.height||"300"],["width",B.width||"400"],["center","yes"]];var A={win:window,controler:D,value:C};var F=Dom.showModalDialog(B.url+(__EDITOR_DIALOG_PARAM.paste||"")||Config.contextPath+"paste.html",A,E);return 0};Editor.shortcutPaste=function(){Editor.paste();return false};Editor.pasteCall=function(A){if((Config.enabledFeature&&Config.enabledFeature.pasteForbidden)){var B=A.value;if(B){Editor.pasteHTML(B)}}return 0};Editor.paste=function(){if((Config.enabledFeature&&Config.enabledFeature.pasteForbidden)){Editor.showPaste("")}else{if(window.isIEBool){if(Editor.isView()){var B=Editor.getClipboardData();if(B&&B.length>0){var A=/<\w[^>]* class="?MsoNormal"?/gi;if(A.test(B)){if(confirm("\u60a8\u73b0\u5728\u662f\u4eceword\u4e2d\u590d\u5236\uff0c\u662f\u5426\u6e05\u9664\u5176\u4e2d\u7684\u683c\u5f0f\uff1f\r\n\r\n\u5c0f\u63d0\u793a\uff1a\u6e05\u9664\u683c\u5f0f\u53ef\u4ee5\u4f7f\u7f16\u8f91\u66f4\u4e3a\u65b9\u4fbf\uff01")){B=Editor.clearFromWord(B)}}Editor.pasteHTML(B)}}return -1}else{alert("\u63d0\u793a\uff1a\u60a8\u73b0\u5728\u6240\u4f7f\u7528\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e [Ctrl + V]\uff01");return 0}}};Editor.setElementJustify=function(A,B){switch(B){case"left":align="FLOAT: left; MARGIN: 0px 10px 10px 0px";break;case"center":align="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center";break;case"right":align="FLOAT: right; MARGIN: 0px 0px 10px 10px";break;default:align="DISPLAY: block";break}A.style.cssText=align};Editor.setLeft=function(){var A=Editor.getSpecialElement(["img","embed"]);if(A){Editor.setElementJustify(A,"left")}else{Editor.command("JustifyLeft")}return -1};Editor.setCenter=function(){var A=Editor.getSpecialElement(["img","embed"]);if(A){Editor.setElementJustify(A,"center")}else{Editor.command("JustifyCenter")}return -1};Editor.setRight=function(){var A=Editor.getSpecialElement(["img","embed"]);if(A){Editor.setElementJustify(A,"right")}else{Editor.command("JustifyRight")}return -1};Editor.setOrder=function(){Editor.command("InsertOrderedList");return -1};Editor.setUnorder=function(){Editor.command("InsertUnorderedList");return -1};Editor.setIndent=function(){Editor.command("Indent");return -1};Editor.setOutdent=function(){Editor.command("Outdent");return -1};Editor.showLink=function(){var C=Editor.controls.url;var A=Editor.getSpecialElement("a",true);if(!A){var F=Editor.getSelectedHTML();if(F.length<1){alert("\u8bf7\u9009\u62e9\u8981\u6dfb\u52a0\u94fe\u63a5\u7684\u5185\u5bb9\uff01");return 0}}var D=[["height","260"],["width","560"],["center","yes"]];var B={win:window,controler:C,obj:A};var E=Dom.showModalDialog(Config.contextPath+"link.html",B,D);return 0};Editor.clearLink=function(){if(window.isIEBool){Editor.command("Unlink")}else{var C="";var B;if(window.isIEBool){B=Editor.getSpecialElement("a",true)}else{B=Editor.getSpecialElement("a",false)}if(B){C=B.innerHTML;if(!window.isIEBool){var A=Editor.editorWin.document.createRange();A.selectNode(B);var D=Editor.editorWin.getSelection();if(D){D.removeAllRanges();D.addRange(A)}}Editor.pasteHTML(C)}}};Editor.cancelLinkCall=function(){Editor.setState(null,0,"url")};Editor.addLink=function(C){if(C){var B="";var A=Editor.getSpecialElement("a");if(A){B=A.innerHTML}else{B=Editor.getSelectedHTML()}if(A){A.href=C.link;A.target=C.target}else{B='<a href="'+C.link+'" target="'+C.target+'">'+B+"</a>";Editor.pasteHTML(B)}}};Editor.showImg=function(){var B=Editor.controls.simg;var D=Editor.getSpecialElement("img",true);var C=[["height","647"],["width","800"],["center","yes"]];var A={win:window,controler:B,obj:D};var E=Dom.showModalDialog("insert_image.html",A,C);return 0};Editor.cancelImgCall=function(){Editor.setState(null,0,"simg")};Editor.addImg=function(D){if(D){var N=Editor.getSpecialElement("img",true);var J="";if(D.align){switch(D.align){case"none":J=" ";break;case"left":J="FLOAT: left; MARGIN: 0px 10px 10px 0px";break;case"center":J="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center";break;case"right":J="FLOAT: right; MARGIN: 0px 0px 10px 10px";break}}if(N){N.src=D.data[0].url;N.style.cssText=J}else{var K=D.type;var F=D.data;var I=D.showMemo;var H="";if(J==""){J="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center;"}if(K=="imgs"){var C=F.length;for(var E=0;E<C;E++){var M=F[E];var A=M.url;var G=M.alt?M.alt:"";var L=M.link;if(L){H+='<a href="'+L+'" target="_blank">'}H+='<img src="'+A+'" border="0" style="'+J+'" alt="'+G+'" />';if(L){H+="</a>"}if(I){H+='<div style="'+J+'">'+(F[E].alt?F[E].alt:"")+"</div>"}}}else{H="<br /><!-- sohublogblock begin -->";if(D.kind==1){H+='<div style="float:left;padding:7px;"><div style="float:left;margin:0 10px 8px 0;width:229px;"><div style="padding:10px;background-color:white;text-align:center"><a href="'+D.link+'" target=_blank><img style="width:200px;" src="'+D.url+'"></a><div style="font-size:12px;color:#333;text-align:left;"><div style="font-weight:bold;padding-top:10px;">'+D.name+'</div><div style="padding-top:10px;">'+D.desc+'</div><div style="text-align:right;padding-top:10px;">'+D.count+"\u5f20</div></div></div></div>";var B=F.length;for(var E=0;E<B;E++){var M=F[E];H+='<div style="float:left;margin:2px;text-align:center"><a href="'+M.link+'" target=_blank><img alt="'+M.alt+'" src="'+M.url+'" border=0></a></div>'}H+="</div>"}else{if(D.kind==2){H+='<div style="overflow:auto;float:left;background-color:#333;padding:7px;"><div style="float:left;margin:0 10px 8px 0;width:300px;"><div style="padding:10px;background-color:white;text-align:center"><a href="'+D.link+'" target=_blank><img style="width:250px;" src="'+D.url+'"></a><div style="font-size:12px;color: #333;text-align:left";><div style="font-weight:bold;padding-top:10px;">'+D.name+'</div><div style="padding-top:10px;">'+D.desc+'</div><div style="padding-top:10px;text-align:right">'+D.count+"\u5f20</div></div></div></div>";var B=F.length;for(var E=0;E<B;E++){var M=F[E];H+='<div style="float:left;margin:0 5px 1px 0;width:150px;height:190px;text-align:center;"><div style="margin:0;width:100%;background-color:white;"><div style="padding:7px;text-align:center;"><a href="'+M.link+'" target=_blank><img src="'+M.url+'" alt="'+M.alt+'"></a><div style="font-size:12px;margin:7px 0 0;overflow:hidden;color:#333;height:28px;text-align:left;line-height:120%;">'+M.alt+"</div></div></div></div>"}H+="</div>"}}H+='<div style="clear:both;"></div><!-- sohublogblock end --><br />'}Editor.pasteHTML(H)}}};Editor.redraw=function(){Editor.editorWin.document.body.style.visibility="hidden";Editor.editorWin.document.body.style.visibility="visible"};Editor.showImg2=function(){var B=Editor.controls.simg;var C=[["height","647"],["width","800"],["center","yes"]];var A={win:window,controler:B};var D=Dom.showModalDialog(Config.contextPath+"insert_image2.html",A,C);return 0};Editor.addImg2=function(C){if(C&&C.length>0){var B="";var A;for(A=C.length-1;A>=0;A--){B+='<img border="0" style="display:block;text-align:center;margin: 0px auto 10px;" src="'+C[A]+'" />'}Editor.pasteHTML(B)}};Editor.showMv=function(){var C=Editor.controls.svideo;var B=Editor.getSpecialElement("embed",true);var D=[["height","647"],["width","760"],["center","yes"]];var A={win:window,controler:C,obj:B};var E=Dom.showModalDialog(Config.contextPath+"insert_media.html",A,D);return 0};Editor.cancelMvCall=function(){Editor.setState(null,0,"svideo")};Editor.addMv=function(D){if(D){if(D.type=="net"){var A=Editor.getSpecialElement("embed");var K="";switch(D.f_align.toString()){case"none":K="DISPLAY: block";break;case"left":K="FLOAT: left; MARGIN: 0px 10px 10px 0px";break;case"center":K="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center";break;case"right":K="FLOAT: right; MARGIN: 0px 0px 10px 10px";break}var J=D.f_url.substring(D.f_url.lastIndexOf(".")+1).toLowerCase();var M="video";if(/mp3|wma|wav|mid/.test(J)){M="audio"}var C="";var L="";if(D.f_width==""){C=(M=="audio")?300:480}else{C=D.f_width}if(D.f_height==""){L=(M=="audio")?45:418}else{L=D.f_height}if(A){var I=Editor.getRange();A.src=D.f_url;A.style.cssText=K;A.width=C;A.height=L;A.autostart=(D.f_autostart=="true")?true:false;A.loop=(D.f_loop=="true")?true:false}else{var B=D.f_autostart;var H=D.f_loop;var G='<embed style="'+K+'" src="'+D.f_url+'" width="'+C+'" height="'+L+'"  loop="'+H+'" autostart="'+B+'" />';Editor.pasteHTML(G)}}else{if(D.type=="lists"){var K="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center";var G="";var F=D.data;for(var E=0;E<F.length;E++){G+='<embed style="'+K+'" src="'+F[E].flash+'" width="480" height="418" quality="high" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';if(F[E].title){G+='<div style="DISPLAY: block; MARGIN: 0px auto 10px; TEXT-ALIGN: center;"><a href="'+F[E].url+'" target="_blank">'+(F[E].title)+"</a></div><br />"}}Editor.pasteHTML(G)}}}};Editor.setView=function(){if(Editor.viewState!="changing"){var C=Editor.viewState;Editor.viewState="changing";var B=(C=="view")?"code":"view";if(C!=B){if(B=="code"){Editor.viewControler.checked=true;Editor.coder.value=Editor.editorWin.document.body.innerHTML;Dom.hideD(Editor.editorObj);Dom.showD(Editor.coder);Editor.menu.style.filter="Alpha(Opacity=30)";Editor.menu.style.MozOpacity="0.3";if(Editor.counter){Editor.counter.hide()}Editor.coder.focus()}else{if(B=="view"){Editor.viewControler.checked=false;Editor.editorWin.document.body.innerHTML=Editor.coder.value;Dom.hideD(Editor.coder);Dom.showD(Editor.editorObj);Editor.menu.style.filter="Alpha(Opacity=100)";Editor.menu.style.MozOpacity="1";if(Editor.counter){Editor.counter.onActivate()}if(window.isIEBool){var A=Editor.editorWin.document.body.createTextRange();A.setEndPoint("EndToStart",A);A.select()}else{Editor.editorWin.document.designMode="on"}if(Editor.editorObj.focus){Editor.editorObj.focus()}}}}Editor.viewState=B}};Editor.showMap=function(){var A=Editor.controls.map;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.mapData,6,Config.lister.option)}A.sohu.lister.show();return -2};Editor.hideMap=function(){var A=Editor.controls.map;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.initMapInput=function(A){A.value="";A.focus()};Editor.checkMapInput=function(C){var B=C.value;if(B==""){alert("\u8bf7\u586b\u5165\u641c\u7d22\u5173\u952e\u8bcd\uff01");C.focus()}else{if(window.isIEBool){Editor.controls.map.sohu.lister.cancel(false);var D="http://map.sogou.com/privatemap/?lq="+decodeURIComponent(B)+"&login=auto&appid=1733&redirect=http://blog.sohu.com/editor/support/map.html";var E=[["width","800"],["height","600"],["center","yes"]];var A=Dom.open(D,null,E);if(!A){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u963b\u6b62\u4e86\u5730\u56fe\u64cd\u4f5c\u7a97\u53e3\uff0c\u8bf7\u5173\u95ed\u6d4f\u89c8\u5668\u7684\u963b\u6b62\u5f39\u51fa\u7a97\u53e3\u9009\u9879\u540e\u7ee7\u7eed\u4f7f\u7528\uff01")}}else{alert("\u5bf9\u4e0d\u8d77\uff0c\u60a8\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6b64\u529f\u80fd\uff01")}return 0}};Editor.addMap=function(C){Editor.checkRange();var D=C.src;var B=C.link;var A='<a href="'+B+'" target="_blank"><img alt="\u70b9\u51fb\u6b64\u67e5\u770b\u5730\u56fe" src="'+D+'" style="display: block; margin: 0px auto 10px; text-align: center;" border="0" /></a>';A=decodeURI(A);Editor.pasteHTML(A)};Editor.cancelMapCall=function(){Editor.setState(null,0,"map")};Editor.showArticle=function(){var B=Editor.controls.article;var D=[["height","350"],["width","550"],["center","yes"]];Editor.setContent();var C=Editor.coder.value.unescapeHTML();if(C.length<300){alert("\u5bf9\u4e0d\u8d77\uff0c\u6587\u54c1\u6d4b\u8bd5\u81f3\u5c11\u9700\u8981300\u4e2a\u6587\u5b57\uff01")}else{var A={win:window,controler:B,content:C};var E=Dom.showModalDialog(Config.contextPath+"sogou_article.html",A,D)}return 0};Editor.cancelArticleCall=function(){Editor.setState(null,0,"article")};Editor.addArticle=function(A){A="<br /><!-- sohublogblock begin -->"+A+"<!-- sohublogblock end -->";Editor.pasteHTML(A)};Editor.showRelative=function(){var A=$F("keywords").trim();if(A==""){Editor.setContent();if(Editor.coder.value.length<100){Editor.popupRelative(A)}else{showTipInfo("\u6b63\u5728\u5206\u6790\u60a8\u7684\u65e5\u5fd7\u5185\u5bb9\uff0c\u8bf7\u7a0d\u5019...");_requestTag(Editor.popupRelative)}}else{Editor.popupRelative(A)}return 0};Editor.popupRelative=function(B){var C=Editor.controls.relative_s;var D=[["height","570"],["width","640"],["center","yes"]];var A={win:window,controler:C,keywords:B};var E=Dom.showModalDialog(Config.contextPath+"relative.html",A,D);return 0};Editor.cancelRelativeCall=function(){Editor.setState(null,0,"relative_s")};Editor.addRelative=function(C){var D="";if(C[0].length>0){var E=C[0];D+='<br /><div style="font-weight: bold;">\u6211\u7684\u76f8\u5173\u65e5\u5fd7\uff1a</div><br />';for(var B=0;B<E.length;B++){var G=E[B]["title"],A=E[B]["url"],F=Editor.getDateStr(E[B]["time"]);D+=F+'&nbsp;|&nbsp;<a href="'+A+'" target="_blank" title="'+G+'" alt="'+G+'">'+G+"</a><br />"}D+="<br />"}if(C[1].length>0){var E=C[1];D+='<br /><div style="font-weight: bold;">\u5176\u4ed6\u7f51\u53cb\u7684\u76f8\u5173\u65e5\u5fd7\uff1a</div><br />';for(var B=0;B<E.length;B++){var G=E[B]["title"],A=E[B]["url"],F=Editor.getDateStr(E[B]["time"]);D+=F+'&nbsp;|&nbsp;<a href="'+A+'" target="_blank" title="'+G+'" alt="'+G+'">'+G+"</a><br />"}D+="<br />"}Editor.pasteHTML(D)};Editor.getDateStr=function(C){var B=new Date(parseInt(C));var D=B.getMonth()+1;D=(D>9?"":"0")+D;var A=(B.getDate()>9?"":"0")+B.getDate();var E=B.getFullYear()+"-"+D+"-"+A;return E};Editor.focusContent=function(){Editor.editorWin.focus()};Editor.cacheRange=function(){Editor.selection=Editor.editorWin.document.selection;Editor.rangeCache=Editor.selection.createRange()};Editor.checkRange=function(){if(Editor.rangeCache){Editor.editorWin.focus();Editor.rangeCache.select();Editor.rangeCache=false}};Editor.getRange=function(){var A=false;if(window.isIEBool){Editor.editorWin.focus();Editor.selection=Editor.editorWin.document.selection;A=Editor.selection.createRange()}else{Editor.selection=Editor.editorWin.getSelection();A=Editor.editorWin.document}return A};Editor.getElement=function(){var C=null;var D;var B;if(window.isIEBool){D=Editor.editorWin.document.selection;switch(D.type.toLowerCase()){case"none":case"text":B=D.createRange();C=B.parentElement();break;case"control":var A=D.createRange();C=A.item(0);break}}else{D=Editor.editorWin.getSelection();if(D.rangeCount>0){B=D.getRangeAt(0);if(B.startContainer==B.endContainer){if(B.startContainer.nodeType!=3){C=B.startContainer.childNodes[B.startOffset]}else{C=B.startContainer}}else{C=B.commonAncestorContainer}}if(C&&C.nodeType==3){C=C.parentNode}}return C};Editor.getSpecialElement=function(E,F){var D=null;var A=Editor.getElement();if(A){if(typeof(E)=="string"){E=[E]}while(A&&A.tagName){for(var C=E.length-1;C>=0;C--){if(E[C]==A.tagName.toLowerCase()){D=A;break}}if(D){break}else{A=A.parentNode}}}if(F&&D){if(window.isIEBool){Editor.rangeCache=false;var B=Editor.editorWin.document.body.createTextRange();B.moveToElementText(D);B.select()}else{var G=Editor.editorWin.getSelection();if(G){var B=G.getRangeAt(0);B.selectNode(D);G.removeAllRanges();G.addRange(B)}}}return D};Editor.showCrBrow=function(){var B=Editor.controls.emot;if(!B.sohu.lister){var A={init:function(C,D){CrEmote.init({parent:C,output:"url",callback:function(E,F){if(E){D('<img src="'+E+'" title="'+F+'" alt="'+F+'" />')}else{D()}},matrix:{"20":[10,7],"42":[6,4]},stat:"editor"})},type:"function"};B.sohu.lister=new Lister(B,A,8,Config.lister.option)}B.sohu.lister.show();return -2};Editor.hideCrBrow=function(){var A=Editor.controls.emot;if(A.sohu.lister){A.sohu.lister.cancel(false)}return 1};Editor.addCrBrow=function(A){if(A){var B="&nbsp;"+A+"&nbsp;";Editor.pasteHTML(B)}Editor.setState(null,0,"emot")};Editor.cancelCrBrowCall=function(){Editor.setState(null,0,"emot")};Editor.showCrForeColorList=function(){var A=Editor.controls.forecolor;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.colorCrData,6,Config.lister.option)}A.sohu.lister.show();return -2};Editor.showCrBackColorList=function(){var A=Editor.controls.backcolor;if(!A.sohu.lister){A.sohu.lister=new Lister(A,Config.lister.colorCrData,6,Config.lister.option)}A.sohu.lister.show();return -2};Editor.showCrLink=function(){var D=Editor.controls.url;var A=Editor.getSpecialElement("a",true);var G=Editor.getSelectedHTML();var C=Config.popupDialog.link;var E=[["height",C.height||"300"],["width",C.width||"470"],["center","yes"]];var B={win:window,controler:D,obj:A,linkStr:G};var F=Dom.showModalDialog(C.url+__EDITOR_DIALOG_PARAM.link||Config.contextPath+"link.html",B,E);return 0};Editor.addCrLink=function(D){if(D){var C="";var B=Editor.getSpecialElement("a");if(B){C=B.innerHTML}else{C=Editor.getSelectedHTML()}var A=D.link;if(!/^http(s)?:\/\//.test(A.toLowerCase())){A="http://"+A}if(B){B.href=A;B.innerHTML=D.desc}else{C='<a href="'+A+'" target="_blank">'+D.desc+"</a>";Editor.pasteHTML(C)}}};Editor.addFly=function(){var C=Editor.getSelectedHTML();if(!C.length){if(!window.isIEBool){alert("\u8bf7\u9009\u62e9\u9700\u8981\u98de\u884c\u7684\u5185\u5bb9,\u518d\u70b9\u51fb\u98de\u884c")}else{C="\u53cc\u51fb\u6b64\u533a\u57df,\u7f16\u8f91\u8981\u98de\u884c\u7684\u5185\u5bb9"}}var B=suf="<br>";var A=B+'<marquee behavior="ALTERNATE" scrollamount="3" width="90%">'+(C||"")+"</marquee>"+suf;Editor.pasteHTML(A);return 0};Editor.addMv=function(D,C,A,E){var B="[MP="+C+","+A+","+E+"][/MP]";Editor.pasteHTML(B)};Editor.addSound=function(B){var A="[SOUND]"+B+"[/SOUND]";Editor.pasteHTML(A)};Editor.addFlash=function(D,C,A){var B="[FLASH="+C+","+A+"]src[/FLASH]";Editor.pasteHTML(B)};Editor.showCrImg=function(){if(Config.groupPermission&&!Config.groupPermission.permission){alert(Config.groupPermission.text);return 0}var C=Editor.controls.simg;var E=Editor.getSpecialElement("img",true);var B=Config.popupDialog.simg;var D=[["height",B.height||"347"],["width",B.width||"500"],["center","yes"]];var A={win:window,controler:C,obj:E};var F=Dom.showModalDialog(B.url+__EDITOR_DIALOG_PARAM.img||Config.contextPath+"insert_image_cr.html",A,D);return 0};Editor.addCrImg=function(E){var C=E.isHtml;var D=E.urls;var B="";if(C){B=D}else{if(D&&D.length){for(var A=0;A<D.length;A++){B+='<img src="'+D[A]+'" /><br/>'}}}Editor.pasteHTML(B);Editor.setState(null,0,"simg")};Editor.showCrMv=function(){if(Config.groupPermission&&!Config.groupPermission.permission){alert(Config.groupPermission.text);return 0}var C=Editor.controls.svideo;var B=Config.popupDialog.svideo;var D=[["height",B.height||"280"],["width",B.width||"500"],["center","yes"]];var A={win:window,controler:C};var E=Dom.showModalDialog(B.url+__EDITOR_DIALOG_PARAM.video||Config.contextPath+"insert_media_cr.html",A,D);return 0};Editor.addCrMv=function(B){if(B.url&&B.url.length>10){var A='<embed src="'+B.url+'" width="'+(B.width||200)+'" height="'+(B.height||150)+'" autostart="'+(!!B.autostart)+'"/>';Editor.pasteHTML(A)}Editor.setState(null,0,"simg")};Editor.showAttach=function(){if(Config.groupPermission&&!Config.groupPermission.permission){alert(Config.groupPermission.text);return 0}var C=Editor.controls.relative_s;var B=Config.popupDialog.relative_s;var D=[["height",B.height||"287"],["width",B.width||"500"],["center","yes"]];var A={win:window,controler:C};var E=Dom.showModalDialog(B.url+__EDITOR_DIALOG_PARAM.attach||Config.contextPath+"uploadfiles.html",A,D);return 0};Editor.addAttach=function(A){Editor.pasteHTML(A.html);Editor.setState(null,0,"relative_s")};Editor.cancelAttachCall=function(){Editor.setState(null,0,"relative_s")};Editor.setEditorContent=function(A){Editor.editorWin.document.body.innerHTML="";Editor.setContent();Editor.pasteHTML(A);if((window.isChrome||window.isWebKit)&&!Editor.getEditorContent()){Editor.editorWin.document.execCommand("selectAll");Editor.editorWin.document.execCommand("insertHTML",false,A)}};Editor.getEditorContent=function(){Editor.setContent();return Editor.coder.value};Editor.getEditorContentNoP=function(){Editor.setContent();return Editor.coder.value.replace(/<p>/ig,"").replace(/<\/p>/ig,"")};Editor._trimedContent=function(){var B='<font size="2"><span style="font-family: \u5b8b\u4f53;"><br></span></font>';var A=Editor.getEditorContent();if(window.isGecko){if(A.replace(/\s/g,"").replace(/<br>/,"").length==0){A=B}}return A.replace(/(\s)*$/,"").replace(/^<P>/i,"").replace(/<\/P>$/i,"").replace(/(&nbsp;)*$/,"")};Editor.setCapture=function(){Editor._captureHTML=Editor._trimedContent()};Editor.checkCapture=function(){return Editor._trimedContent()==Editor._captureHTML};Editor.checkEmptyContent=function(){var A=Editor.getEditorContent();A=A.replace(/<[^(i|e)][^(>)]*>/ig,"").replace(/\s/ig,"").replace(/&nbsp;/ig,"");return !A};Editor.focusFirstLine=function(){if(window.isIEBool){var A=Editor.editorWin.document.body.createTextRange();A.setEndPoint("EndToStart",A);A.select()}else{Editor.editorWin.document.designMode="off";Editor.editorWin.document.designMode="on"}Editor.editorWin.focus()};var Lister=Class.create();Lister.now=false;Lister.prototype={initialize:function(B,D,C,A){this.controler=B;this.listData=D;this.colCount=C;this.containerClass=A.containerClass;this.itemClass=D.itemClass?D.itemClass:A.itemClass;this.itemOverClass=D.itemOverClass?D.itemOverClass:A.itemOverClass;if(!this.listData.text){this.listData.text=this.listData.value}this.clickEventObj=false;this.visibility=false;this.initContainer(this.containerClass)},initContainer:function(A){var B=document.createElement("div");B.className=A;B.style.visibility="hidden";this.container=B;this.initContent();document.body.appendChild(this.container)},initContent:function(){switch(this.listData.type){case"auto":for(var A=0;A<this.listData.value.length;A++){if(A%this.colCount==0&&A>0){Dom.create("div","newLine",this.container)}this.initListItem(A,this.container)}break;case"manual":for(var A=0;A<this.listData.value.length;A++){this.initListItem2(A,this.container)}break;case"manual2":this.container.innerHTML=this.listData.content;break;case"function":this.listData.init(this.container,this.selectedCall.bind(this));break}},initListItem:function(B,G){var I=this.listData.text[B];var F=this.listData.value[B];var D=this.listData.pattern;I=D.replace(/\$=text\$/ig,I).replace(/\$=value\$/ig,F);var A=Dom.create("div",this.itemClass,G);A.innerHTML=I;var H=this.selectedCall.bind(this,F);var E=this.itemMouseOver.bind(this,A);var C=this.itemMouseOut.bind(this,A);Event.observe(A,"click",H);Event.observe(A,"mouseover",E);Event.observe(A,"mouseout",C)},initListItem2:function(C,E){var H=this.listData.value[C][0];var F=this.listData.value[C][1];if(H){var D=Dom.create("div",this.itemClass,E);D.innerHTML=H;var B=this.selectedCall.bind(this,F);var A=this.itemMouseOver.bind(this,D);var G=this.itemMouseOut.bind(this,D);Event.observe(D,"click",B);Event.observe(D,"mouseover",A);Event.observe(D,"mouseout",G)}else{Dom.create("div","newLine",this.container)}},itemMouseOver:function(A){A.className=this.itemOverClass},itemMouseOut:function(A){A.className=this.itemClass},selectedCall:function(A){this.hide();this.controler.sohu.selectCall.call(Editor,A,this.controler)},cancel:function(B){if(this.visibility){var A=true;if(typeof(B)!="boolean"){B=window.event||B;if(B){eventEle=Event.element(B);while(eventEle){if(this.container==eventEle){A=false;break}eventEle=eventEle.parentElement}}}if(A){this.hide();this.controler.sohu.cancelCall.call(this.controler)}}},show:function(){if(!this.visibility){this.visibility=true;var rect=Dom.getRect(this.controler);var position={left:rect.left,top:rect.bottom};Dom.setPosition(this.container,position);this.clickEventObj=this.cancel.bind(this);Event.observe(document,"mouseup",this.clickEventObj);Event.observe(Editor.editorWin.document,"mouseup",this.clickEventObj);Dom.show(this.container);Lister.now=this;if(this.listData.init){eval(this.listData.init)}}},hide:function(){Lister.now=false;if(this.clickEventObj){Event.stopObserving(document,"mouseup",this.clickEventObj);Event.stopObserving(Editor.editorWin.document,"mouseup",this.clickEventObj);this.clickEventObj=false}this.visibility=false;Dom.hide(this.container)}};Editor.getElementPath=function(E){var A=function(I){var K=I.childNodes;for(var H=0,J=K.length;H<J;H++){var L=K[H];if(L.nodeType==1&&Editor.BlockElements[L.nodeName.toLowerCase()]){return true}}return false};var B=null;var D=null;var G=new Array();var F=E;while(F){if(F.nodeType==1){if(!this.LastElement){this.LastElement=F}var C=F.nodeName.toLowerCase();if(window.isIEBool&&F.scopeName!="HTML"){C=F.scopeName.toLowerCase()+":"+C}if(!D){if(!B&&Editor.PathBlockElements[C]!=null){B=F}if(Editor.PathBlockLimitElements[C]!=null){if(!B&&C=="div"&&!A(F)){B=F}else{D=F}}}G.push(F);if(C=="body"){break}}F=F.parentNode}return{block:B,blocklimit:D,elements:G}};Editor.GetBoundaryParentElement=function(D){if(this.GetType()=="Control"){return Editor.GetElement().parentNode}else{var A=this.GetSelection();if(A&&A.rangeCount>0){var B=A.getRangeAt(D?0:(A.rangeCount-1));var C=D?B.startContainer:B.endContainer;return(C.nodeType==1?C:C.parentNode)}}return null};Editor.GetSelection=function(){if(window.isIEBool){return Editor.editorWin.document.selection}else{return Editor.editorWin.getSelection()}};Editor.PathBlockElements={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,de:1};Editor.BlockElements={address:1,blockquote:1,center:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,marquee:1,noscript:1,ol:1,p:1,pre:1,script:1,table:1,ul:1};Editor.PathBlockLimitElements={body:1,div:1,td:1,th:1,caption:1,form:1};Editor.ControlTypeElements={img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1};Editor.GetType=function(){if(window.isIEBool){try{var E=this.GetSelection().type;if(E=="Control"||E=="Text"){return E}if(this.GetSelection().createRange().parentElement){return"Text"}}catch(D){}return"None"}else{var B="Text";var C;try{C=this.GetSelection()}catch(D){}if(C&&C.rangeCount==1){var A=C.getRangeAt(0);if(A.startContainer==A.endContainer&&(A.endOffset-A.startOffset)==1&&A.startContainer.nodeType==1&&Editor.ControlTypeElements[A.startContainer.childNodes[A.startOffset].nodeName.toLowerCase()]){B="Control"}}return B}};
