/*! xhEditor v1.2.1 | (c) 2009, 2013 xheditor.com. Licence: http://xheditor.com/license/lgpl.txt */ (function(){var e={};window.XHEDITOR=e})(),function(e,t){e.mapLang={},e.setLang=function(i,s){s===t&&(s=i,i=""),""!==i&&(i+=".");var a,n;for(var o in s)n=s[o],a=i+o,"string"==typeof n||n instanceof Array?e.mapLang[a]=n:e.setLang(a,n)},e.getLang=function(i){var s=e.mapLang[i];if(s===t&&(s=i.replace(/{#([^{}]+)}/g,function(t,i){var s=e.mapLang[i];return s?s:i})),"string"==typeof s){var a=arguments;s=s.replace(/{\$(\d+)}/g,function(e,i){var s=a[parseInt(i,10)+1];return s!==t?s:e})}return s}}(XHEDITOR),function(XHEDITOR,$,undefined){var agent=navigator.userAgent.toLowerCase(),bMobile=/mobile/i.test(agent),browser=$.browser,browerVer=parseFloat(browser.version),isIE=browser.msie,isMozilla=browser.mozilla,isWebkit=browser.webkit,isOpera=browser.opera,isChrome=browser.chrome,bAir=agent.indexOf(" adobeair/")>-1,xCount=0,bShowPanel=!1,bClickCancel=!0,bShowModal=!1,bCheckEscInit=!1,_jPanel,_jShadow,_jCntLine,_jPanelButton,jModal,jModalShadow,layerShadow,jOverlay,jHideSelect,onModalRemove,editorRoot,getLang=XHEDITOR.getLang;if($("script[src*=xheditor]").each(function(){var e=this.src;return e.match(/xheditor[^\/]*\.js/i)?(editorRoot=e.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1"),!1):undefined}),isIE){try{document.execCommand("BackgroundImageCache",!1,!0)}catch(e){}var jqueryVer=$.fn.jquery;jqueryVer&&jqueryVer.match(/^1\.[67]/)&&($.attrHooks.width=$.attrHooks.height=null)}var specialKeys={27:"esc",9:"tab",32:"space",13:"enter",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},arrAlign=[{v:"justifyleft"},{v:"justifycenter"},{v:"justifyright"},{v:"justifyfull"}],arrList=[{v:"insertOrderedList"},{v:"insertUnorderedList"}],htmlPastetext='
',htmlLink='',htmlAnchor='',htmlImg='"),undefined):(_this.pasteHTML("
"),isIE&&t.length>0&&2===_this.getRng().parentElement().childNodes.length&&_this.pasteHTML("
"),!1)}function fixFullHeight(){isMozilla||isWebkit||(bFullscreen&&_jArea.height("100%").css("height",_jArea.outerHeight()-_jTools.outerHeight()),isIE&&_jTools.hide().show())}function fixAppleSel(e){if(e=e.target,e.tagName.match(/(img|embed)/i)){var t=_this.getSel(),i=_this.getRng(!0);i.selectNode(e),t.removeAllRanges(),t.addRange(i)}}function xheAttr(e,t,i){if(!t)return!1;var s="_xhe_"+t;return i&&(urlType&&(i=getLocalUrl(i,urlType,urlBase)),e.attr(t,urlBase?getLocalUrl(i,"abs",urlBase):i).removeAttr(s).attr(s,i)),e.attr(s)||e.attr(t)}function clickCancelPanel(){bClickCancel&&_this.hidePanel()}function checkShortcuts(e){if(bSource)return!0;var t=e.which,i=specialKeys[t],s=i?i:String.fromCharCode(t).toLowerCase();sKey="",sKey+=e.ctrlKey?"ctrl+":"",sKey+=e.altKey?"alt+":"",sKey+=e.shiftKey?"shift+":"",sKey+=s;var a,n=arrShortCuts[sKey];for(a in n){if(a=n[a],!$.isFunction(a))return _this.exec(a),!1;if(a.call(_this)===!1)return!1}}function is(e,t){var i=typeof e;return t?"array"===t&&e.hasOwnProperty&&e instanceof Array?!0:i===t:"undefined"!=i}function getLocalUrl(e,t,i){if(e.match(/^(\w+):\/\//i)&&!e.match(/^https?:/i)||/^#/i.test(e)||/^data:/i.test(e))return e;var s=i?$('')[0]:location,a=s.protocol,n=s.host,o=s.hostname,l=s.port,r=s.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");if(""===l&&(l="80"),""===r?r="/":"/"!==r.charAt(0)&&(r="/"+r),e=$.trim(e),"abs"!==t&&(e=e.replace(RegExp(a+"\\/\\/"+o.replace(/\./g,"\\.")+"(?::"+l+")"+("80"===l?"?":"")+"(/|$)","i"),"/")),"rel"===t&&(e=e.replace(RegExp("^"+r.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"")),"rel"!==t&&(e.match(/^(https?:\/\/|\/)/i)||(e=r+e),"/"===e.charAt(0))){var h,c,d=[],u=e.split("/"),p=u.length;for(c=0;p>c;c++)h=u[c],".."===h?d.pop():""!==h&&"."!==h&&d.push(h);""===u[p-1]&&d.push(""),e="/"+d.join("/")}return"abs"!==t||e.match(/^https?:\/\//i)||(e=a+"//"+n+e),e=e.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,"$1$2")}function checkFileExt(e,t){return"*"===t||e.match(RegExp(".("+t.replace(/,/g,"|")+")$","i"))?!0:(alert(getLang("upload.extLimit",t)),!1)}function formatBytes(e){var t=["Byte","KB","MB","GB","TB","PB"],i=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,Math.floor(i))).toFixed(2)+t[i]}function returnFalse(){return!1}var _this=this,_text=textarea,_jText=$(_text),_jForm=_jText.closest("form"),_jTools,_jArea,_win,_jWin,_doc,_jDoc,bookmark,bInit=!1,bSource=!1,bFullscreen=!1,bCleanPaste=!1,outerScroll,bShowBlocktag=!1,sLayoutStyle="",ev=null,timer,bDisableHoverExec=!1,bQuickHoverExec=!1,lastPoint=null,lastAngle=null,editorHeight=0,settings=_this.settings=$.extend({},XHEDITOR.settings,options),plugins=settings.plugins,strPlugins=[];if(plugins&&(arrTools=$.extend({},arrTools,plugins),$.each(plugins,function(e){strPlugins.push(e)}),strPlugins=strPlugins.join(",")),settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var toolsTheme=toolsThemes[$.trim(settings.tools)];settings.tools=settings.tools.match(/m?full/i)&&plugins?toolsTheme.replace("Table","Table,"+strPlugins):toolsTheme}settings.tools.match(/(^|,)\s*About\s*(,|$)/i)||(settings.tools+=",About"),settings.tools=settings.tools.split(","),settings.editorRoot&&(editorRoot=settings.editorRoot),bAir===!1&&(editorRoot=getLocalUrl(editorRoot,"abs")),settings.urlBase&&(settings.urlBase=getLocalUrl(settings.urlBase,"abs"));var idCSS="xheCSS_"+settings.skin,idContainer="xhe"+xCount+"_container",idTools="xhe"+xCount+"_Tool",idIframeArea="xhe"+xCount+"_iframearea",idIframe="xhe"+xCount+"_iframe",idFixFFCursor="xhe"+xCount+"_fixffcursor",headHTML="",bodyClass="",skinPath=editorRoot+"xheditor_skin/"+settings.skin+"/",arrEmots=itemEmots,urlType=settings.urlType,urlBase=settings.urlBase,emotPath=settings.emotPath,emotPath=emotPath?emotPath:editorRoot+"xheditor_emot/",selEmotGroup="";arrEmots=$.extend({},arrEmots,settings.emots),emotPath=getLocalUrl(emotPath,"rel",urlBase?urlBase:null),bShowBlocktag=settings.showBlocktag,bShowBlocktag&&(bodyClass+=" showBlocktag");var arrShortCuts=[];this.init=function(){function e(e){var t,i=$(e.target);(t=i.css("width"))&&i.css("width","").attr("width",t.replace(/[^0-9%]+/g,"")),(t=i.css("height"))&&i.css("height","").attr("height",t.replace(/[^0-9%]+/g,""))}0===$("#"+idCSS).length&&$("head").append('');var t=_jText.outerWidth(),i=_jText.outerHeight(),s=settings.width||_text.style.width||(t>10?t:0);editorHeight=settings.height||_text.style.height||(i>10?i:150),/^\d+(?:\.\d+)?$/.test(s)&&(s+="px"),is(editorHeight,"string")&&(editorHeight=editorHeight.replace(/[^\d]+/g,""));var a,n,o=settings.background||_text.style.background,l=[''],r=/\||\//i;$.each(settings.tools,function(e,t){if(t.match(r)&&l.push(''),"|"===t)l.push('');else if("/"===t)l.push("
");else{if(a=arrTools[t],!a)return;n=a.c?a.c:"xheIcon xheBtn"+t,l.push(''+a.t+""),a.s&&_this.addShortcuts(a.s,t)}t.match(r)&&l.push('')}),l.push('
'),_jText.after($(' ')),_jTools=$("#"+idTools),_jArea=$("#"+idIframeArea),headHTML='';var h=settings.loadCSS;if(h)if(is(h,"array"))for(var c in h)headHTML+='';else headHTML+=h.match(/\s*"),d+='