function clickHandler(e,t,a){for(var r=0,n=e.length;r<n;r++)e[r].className="";a.className="focus";for(var c=a.getAttribute("tabSrc"),s=0,i=t.length;s<i;s++){var o=t[s],l=o.getAttribute("id");o.style.zIndex=l!=c?1:200}}function switchTab(e){for(var e=$G(e).children,t=e[0].children,a=e[1].children,r=0,n=t.length;r<n;r++){var c=t[r];"focus"===c.className&&clickHandler(t,a,c),c.onclick=function(){clickHandler(t,a,this)}}}function getMatchCase(e){return!!$G(e).checked}editor.firstForSR=0,editor.currentRangeForSR=null,$G("searchtab").onmousedown=function(){$G("search-msg").innerHTML="",$G("replace-msg").innerHTML=""},$G("nextFindBtn").onclick=function(e,t,a){var r=$G("findtxt").value;if(!r)return!1;r={searchStr:r,dir:1,casesensitive:getMatchCase("matchCase")},frCommond(r)||(r=editor.selection.getRange().createBookmark(),$G("search-msg").innerHTML=lang.getEnd,editor.selection.getRange().moveToBookmark(r).select())},$G("nextReplaceBtn").onclick=function(e,t,a){var r=$G("findtxt1").value;if(!r)return!1;r={searchStr:r,dir:1,casesensitive:getMatchCase("matchCase1")},frCommond(r)},$G("preFindBtn").onclick=function(e,t,a){var r=$G("findtxt").value;if(!r)return!1;r={searchStr:r,dir:-1,casesensitive:getMatchCase("matchCase")},frCommond(r)||($G("search-msg").innerHTML=lang.getStart)},$G("preReplaceBtn").onclick=function(e,t,a){var r=$G("findtxt1").value;if(!r)return!1;r={searchStr:r,dir:-1,casesensitive:getMatchCase("matchCase1")},frCommond(r)},$G("repalceBtn").onclick=function(){var e=$G("findtxt1").value.replace(/^\s|\s$/g,""),t=$G("replacetxt").value.replace(/^\s|\s$/g,"");return!!e&&(!(e==t||!getMatchCase("matchCase1")&&e.toLowerCase()==t.toLowerCase())&&(t={searchStr:e,dir:1,casesensitive:getMatchCase("matchCase1"),replaceStr:t},void frCommond(t)))},$G("repalceAllBtn").onclick=function(){var e=$G("findtxt1").value.replace(/^\s|\s$/g,""),t=$G("replacetxt").value.replace(/^\s|\s$/g,"");if(!e)return!1;if(e==t||!getMatchCase("matchCase1")&&e.toLowerCase()==t.toLowerCase())return!1;t={searchStr:e,casesensitive:getMatchCase("matchCase1"),replaceStr:t,all:!0},t=frCommond(t);t&&($G("replace-msg").innerHTML=lang.countMsg.replace("{#count}",t))};var frCommond=function(e){return editor.execCommand("searchreplace",e)};switchTab("searchtab");