!function(e){e.fn.jqte=function(t){function s(e,t,s,a,i){var n=d.length+1;return d.push({name:e,cls:n,command:t,key:s,tag:a,emphasis:i})}var a=[{title:"Text Format"},{title:"Font Size"},{title:"Color"},{title:"Bold",hotkey:"B"},{title:"Italic",hotkey:"I"},{title:"Underline",hotkey:"U"},{title:"Ordered List",hotkey:"."},{title:"Unordered List",hotkey:","},{title:"Subscript",hotkey:"down arrow"},{title:"Superscript",hotkey:"up arrow"},{title:"Outdent",hotkey:"left arrow"},{title:"Indent",hotkey:"right arrow"},{title:"Justify Left"},{title:"Justify Center"},{title:"Justify Right"},{title:"Strike Through",hotkey:"K"},{title:"Add Link",hotkey:"L"},{title:"Remove Link"},{title:"Cleaner Style",hotkey:"Delete"},{title:"Horizontal Rule",hotkey:"H"},{title:"Source"}],i=[["p","Normal"],["h1","Header 1"],["h2","Header 2"],["h3","Header 3"],["h4","Header 4"],["h5","Header 5"],["h6","Header 6"],["pre","Preformatted"]],n=["10","12","16","18","20","24","28"],l=["0,0,0","68,68,68","102,102,102","153,153,153","204,204,204","238,238,238","243,243,243","255,255,255",null,"255,0,0","255,153,0","255,255,0","0,255,0","0,255,255","0,0,255","153,0,255","255,0,255",null,"244,204,204","252,229,205","255,242,204","217,234,211","208,224,227","207,226,243","217,210,233","234,209,220","234,153,153","249,203,156","255,229,153","182,215,168","162,196,201","159,197,232","180,167,214","213,166,189","224,102,102","246,178,107","255,217,102","147,196,125","118,165,175","111,168,220","142,124,195","194,123,160","204,0,0","230,145,56","241,194,50","106,168,79","69,129,142","61,133,198","103,78,167","166,77,121","153,0,0","180,95,6","191,144,0","56,118,29","19,79,92","11,83,148","53,28,117","116,27,71","102,0,0","120,63,4","127,96,0","39,78,19","12,52,61","7,55,99","32,18,77","76,17,48"],o=["Web Address","E-mail Address","Picture URL"],c=e.extend({status:!0,css:"jqte",title:!0,titletext:a,button:"OK",format:!0,formats:i,fsize:!0,fsizes:n,funit:"px",color:!0,linktypes:o,b:!0,i:!0,u:!0,ol:!0,ul:!0,sub:!0,sup:!0,outdent:!0,indent:!0,left:!0,center:!0,right:!0,strike:!0,link:!0,unlink:!0,remove:!0,rule:!0,source:!0,placeholder:!1,br:!0,p:!0,change:"",focus:"",blur:""},t);e.fn.jqteVal=function(t){e(this).closest("."+c.css).find("."+c.css+"_editor").html(t)};var r=navigator.userAgent.toLowerCase();/msie [1-7]./.test(r)&&(c.title=!1);var d=[];return s("format","formats","","",!1),s("fsize","fSize","","",!1),s("color","colors","","",!1),s("b","Bold","B",["b","strong"],!0),s("i","Italic","I",["i","em"],!0),s("u","Underline","U",["u"],!0),s("ol","insertorderedlist","¾",["ol"],!0),s("ul","insertunorderedlist","¼",["ul"],!0),s("sub","subscript","(",["sub"],!0),s("sup","superscript","&",["sup"],!0),s("outdent","outdent","%",["blockquote"],!1),s("indent","indent","'",["blockquote"],!0),s("left","justifyLeft","","",!1),s("center","justifyCenter","","",!1),s("right","justifyRight","","",!1),s("strike","strikeThrough","K",["strike"],!0),s("link","linkcreator","L",["a"],!0),s("unlink","unlink","",["a"],!1),s("remove","removeformat",".","",!1),s("rule","inserthorizontalrule","H",["hr"],!1),s("source","displaysource","","",!1),this.each(function(){function t(){return window.getSelection?window.getSelection():document.selection&&document.selection.createRange&&"None"!=document.selection.type?document.selection.createRange():void 0}function s(e,s){var a,n=t();window.getSelection?(n.anchorNode&&n.getRangeAt&&(a=n.getRangeAt(0)),a&&(n.removeAllRanges(),n.addRange(a)),r.match(/msie/)||document.execCommand("StyleWithCSS",!1,!1),document.execCommand(e,!1,s)):document.selection&&document.selection.createRange&&"None"!=document.selection.type&&(a=document.selection.createRange(),a.execCommand(e,!1,s)),i(!1,!1)}function a(s,a,n){if(q.not(":focus")&&q.focus(),window.getSelection){var l,o,c,r=t();r.anchorNode&&r.getRangeAt&&(l=r.getRangeAt(0),o=document.createElement(s),e(o).attr(a,n),c=l.extractContents(),o.appendChild(c),l.insertNode(o),r.removeAllRanges(),"style"==a?i(e(o),n):i(e(o),!1))}else if(document.selection&&document.selection.createRange&&"None"!=document.selection.type){var d=document.selection.createRange(),u=d.htmlText,f="<"+s+" "+a+'="'+n+'">'+u+"";document.selection.createRange().pasteHTML(f)}}function i(e,t){var s=te();if(s=s?s:e,s&&0==t)s.parent().is("[style]")&&s.attr("style",s.parent().attr("style")),s.is("[style]")&&s.find("*").attr("style",s.attr("style"));else if(e&&t&&e.is("[style]")){var a=t.split(";");a=a[0].split(":"),e.is("[style*="+a[0]+"]")&&e.find("*").css(a[0],a[1]),n(e)}}function n(t){if(t){var t=t[0];if(document.body.createTextRange){var s=document.body.createTextRange();s.moveToElementText(t),s.select()}else if(window.getSelection){var a=window.getSelection(),s=document.createRange();"undefined"!=t&&null!=t&&(s.selectNodeContents(t),a.removeAllRanges(),a.addRange(s),e(t).is(":empty")&&(e(t).append(" "),n(e(t))))}}}function o(){if(O.data("sourceOpened"))f(!1);else{var t=te(),s="http://";if(f(!0),t){var i=t.prop("tagName").toLowerCase();"a"==i&&t.is("[href]")?(s=t.attr("href"),t.attr(W,"")):a("a",W,"")}else H.val(s).focus();j.click(function(t){(e(t.target).hasClass(c.css+"_linktypetext")||e(t.target).hasClass(c.css+"_linktypearrow"))&&h(!0)}),I.find("a").click(function(){var t=e(this).attr(c.css+"-linktype");I.data("linktype",t),U.find("."+c.css+"_linktypetext").html(I.find("a:eq("+I.data("linktype")+")").text()),m(s),h()}),m(s),H.focus().val(s).bind("keypress keyup",function(e){return 13==e.keyCode?(u(F.find("["+W+"]")),!1):void 0}),$.click(function(){u(F.find("["+W+"]"))})}}function u(t){H.focus(),n(t),t.removeAttr(W),"2"!=I.data("linktype")?s("createlink",H.val()):(s("insertImage",H.val()),q.find("img").each(function(){var t=e(this).prev("a"),s=e(this).next("a");t.length>0&&""==t.html()?t.remove():s.length>0&&""==s.html()&&s.remove()})),f(),q.trigger("change")}function f(e){g("["+W+"]:not([href])"),F.find("["+W+"][href]").removeAttr(W),e?(O.data("linkOpened",!0),T.show()):(O.data("linkOpened",!1),T.hide()),h()}function h(e){e?I.show():I.hide()}function m(e){var t=I.data("linktype");H.val("1"!=t||"http://"!=H.val()&&!H.is("[value^=http://]")&&H.is("[value^=mailto]")?"1"==t||H.is("[value^=http://]")?e:"http://":"mailto:")}function p(t){O.data("sourceOpened")?v(styleField,!1):("fSize"==t?styleField=Z:"colors"==t&&(styleField=ee),v(styleField,!0),styleField.find("a").unbind("click").click(function(){var s=e(this).attr(c.css+"-styleval");"fSize"==t?(styleType="font-size",s+=c.funit):"colors"==t&&(styleType="color",s="rgb("+s+")");var i=y(styleType);a("span","style",styleType+":"+s+";"+i),v("",!1),e("."+c.css+"_title").remove(),q.trigger("change")})),f(!1)}function v(e,t){var s="",a=[{d:"fsizeOpened",f:Z},{d:"cpallOpened",f:ee}];if(""!=e)for(var i=0;i"),k(!1)})}function k(e){var t=e?!0:!1;t=e&&Y.data("status")?!0:!1,t||!e?Y.data("status",!1).slideUp(200):Y.data("status",!0).slideDown(200)}function b(e){var t=Y.closest("."+c.css+"_tool").find("."+c.css+"_tool_label").find("."+c.css+"_tool_text");e.length>10&&(e=e.substr(0,7)+"..."),t.html(e)}function C(e){var t,s,a;for(t=e.replace(/\n/gim,"").replace(/\r/gim,"").replace(/\t/gim,"").replace(/ /gim," "),s=[/\(.*?)<\/span><\/span>/gim,/<(\w*[^p])\s*[^\/>]*>\s*<\/\1>/gim,/\(.*?)\<\/strong>/gim,/\(.*?)\<\/em>/gim],a=["$3","","$2

","$2","$2"],P=0;5>P;P++)for(var i=0;i(.*?)\<\/p>/gi,"
$2")),!c.br){s=[/\
(.*?)/gi,/\(.*?)/gi],a=["

$1

","

$1

"];for(var i=0;i(.*?)\<\/p>/gi,"
$1
")),t}function w(){var e=""==q.text()&&q.html().length<12?"":q.html();z.val(C(e))}function x(){q.html(C(z.val()))}function R(t){var s,a=!1,i=te();return i?(e.each(t,function(t,n){s=i.prop("tagName").toLowerCase(),s==n?a=!0:i.parents().each(function(){s=e(this).prop("tagName").toLowerCase(),s==n&&(a=!0)})}),a):!1}function A(t){for(var s=0;s0&&R(n)){b(c.formats[i][1]),a=!0;break}}a||b(c.formats[0][1])}v("",!1),k(!1)}if(e(this).data("jqte")&&null!=e(this).data("jqte")&&"undefined"!=e(this).data("jqte")?e(this).data("jqte",!1):e(this).data("jqte",!0),c.status&&e(this).data("jqte")){var z=e(this),S=e(this).prop("tagName").toLowerCase();e(this).attr("data-origin",S);var N=e(this).is("[value]")||"textarea"==S?e(this).val():e(this).html();N=N.replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),e(this).after('
');var F=e(this).next("."+c.css);F.html('
'),e(".lr-editor-format-container").html('