function titleize(t){return null==t?t:(parts=[],$.each(t.replace(/\./,"").replace(/[-_]/," ").split(" "),function(t,e){parts.push(e.substring(0,1).toUpperCase()+e.substring(1))}),parts.join(" "))}if(!WYMeditor)var WYMeditor={};!function(){if(window.console&&console.firebug)WYMeditor.console=window.console;else{var t=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];WYMeditor.console={};for(var e=0;e"+WYMeditor.TOOLS+"
"+WYMeditor.CONTAINERS+WYMeditor.CLASSES+"
"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"
"+WYMeditor.LOGO+"
",logoHtml:"WYMeditor",iframeHtml:"",editorStyles:[],toolsHtml:"",toolsItemHtml:""+WYMeditor.TOOL_TITLE+"",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css:"wym_tools_table"},{name:"Paste",title:"Paste_From_Word",css:"wym_tools_paste"},{name:"ToggleHtml",title:"HTML",css:"wym_tools_html"},{name:"Preview",title:"Preview",css:"wym_tools_preview"}],containersHtml:"{Containers}
"+WYMeditor.CONTAINERS_ITEMS+"
",containersItemHtml:""+WYMeditor.CONTAINER_TITLE+"",containersItems:[{name:"P",title:"Paragraph",css:"wym_containers_p"},{name:"H1",title:"Heading_1",css:"wym_containers_h1"},{name:"H2",title:"Heading_2",css:"wym_containers_h2"},{name:"H3",title:"Heading_3",css:"wym_containers_h3"},{name:"H4",title:"Heading_4",css:"wym_containers_h4"},{name:"H5",title:"Heading_5",css:"wym_containers_h5"},{name:"H6",title:"Heading_6",css:"wym_containers_h6"},{name:"PRE",title:"Preformatted",css:"wym_containers_pre"},{name:"BLOCKQUOTE",title:"Blockquote",css:"wym_containers_blockquote"},{name:"TH",title:"Table_Header",css:"wym_containers_th"}],classesHtml:"{Classes}
"+WYMeditor.CLASSES_ITEMS+"
",classesItemHtml:""+WYMeditor.CLASS_TITLE+"",classesItems:[],statusHtml:"{Status}
",htmlHtml:"{Source_Code}
",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",iframeBodySelector:".wym_iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",classUnhiddenSelector:".wym_classes",classHiddenSelector:".wym_classes_hidden",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",targetSelector:".wym_target",altSelector:".wym_alt",textSelector:".wym_text",sizeSelector:".wym_size",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",summarySelector:".wym_summary",submitSelector:".wym_submit",cancelSelector:".wym_cancel",previewSelector:"",dialogTypeSelector:".wym_dialog_type",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:{width:560,height:300},dialogFeaturesPreview:"menubar=no,titlebar=no,toolbar=no,resizable=no,scrollbars=yes,width=560,height=300,top=0,left=0",dialogHtml:""+WYMeditor.DIALOG_TITLE+""+WYMeditor.DIALOG_BODY+"",dialogLinkHtml:"",dialogImageHtml:"",dialogTableHtml:"",dialogPasteHtml:"",dialogPreviewHtml:"",dialogStyles:[],stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},t),this.each(function(){new WYMeditor.editor($(this),t)})},$.extend({wymeditors:function(t){return WYMeditor.INSTANCES[t]}}),WYMeditor.loadCss=function(t){$("").attr("href",t).appendTo($("head").get(0))},WYMeditor.INIT_DIALOG=function(i,t){t=t||i.selected();var e=$("#"+i._options.dialogId),s=$(e.find("iframe").contents());e.find("#wym_dialog_type").val();if(i._selected_image)var o=$(i._selected_image);else o=$(i._doc.body).find("#"+i._current_unique_stamp);e.find("input[type=text], textarea").first().focus(),s.find("body").addClass("wym_iframe_body").find("#cancel_button").add(e.find(".close_dialog")).click(function(t){i.close_dialog(t,!0)}),$(".ui-dialog-titlebar .ui-dialog-titlebar-close").click(function(t){i.close_dialog(t,!0)}),$.isFunction(i._options.preInitDialog)&&i._options.preInitDialog(i,window),$(i._options.dialogLinkSelector).find(i._options.submitSelector).click(function(t){if(0<(sUrl=$(i._options.hrefSelector).val()).length)if(null!=o.get(0)){var e=$("").attr({href:sUrl,title:$(i._options.titleSelector).val()});null!=(target=$(i._options.targetSelector).val())&&0").append(e).html()))}else i._exec(WYMeditor.CREATE_LINK,i._current_unique_stamp),$("a[href="+i._current_unique_stamp+"]",i._doc.body).attr(WYMeditor.HREF,sUrl).attr(WYMeditor.TITLE,$(i._options.titleSelector).val()).attr(WYMeditor.TARGET,$(i._options.targetSelector).val());i.close_dialog(t)}),i._selected_image&&(imgDialog=$(i._options.dialogImageSelector),img=$(i._selected_image),size=img.attr(WYMeditor.REL)||s.find("#existing_image_size_area li.selected a").attr(WYMeditor.REL)||s.find("#existing_image_size_area li.selected a").attr("rel")||"",src=img.attr(WYMeditor.SRC),0"].join("")),span.html())),(node=$(this._doc.body).find("#"+this._current_unique_stamp))&&(node.attr("id",node.attr("_id_before_replaceable")||""),node.removeAttr("_id_before_replaceable")),1==this._undo_on_cancel?this._exec("undo"):1==this._redo_on_cancel&&this._exec("redo")),$.browser.msie&&parseInt($.browser.version)<8&&this._iframe.contentWindow.focus(),$("#"+wym._options.dialogId).dialog("close").remove(),$(this._doc).find("a[href]").click(function(t){t.preventDefault()}),t&&t.preventDefault()},RegExp.escape=function(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},WYMeditor.editor.prototype.init=function(){if($.browser.msie)var WymClass=new WYMeditor.WymClassExplorer(this);else if($.browser.mozilla)var WymClass=new WYMeditor.WymClassMozilla(this);else if($.browser.opera)var WymClass=new WYMeditor.WymClassOpera(this);else if($.browser.webkit)var WymClass=new WYMeditor.WymClassSafari(this);if(WymClass){$.isFunction(this._options.preInit)&&this._options.preInit(this);var SaxListener=new WYMeditor.XhtmlSaxListener;for(var prop in $.extend(SaxListener,WymClass),this.parser=new WYMeditor.XhtmlParser(SaxListener),(this._options.styles||this._options.stylesheet)&&this.configureEditorUsingRawCss(),this.helper=new WYMeditor.XmlHelper,WymClass)this[prop]=WymClass[prop];this._box=$(this._element).hide().after(this._options.boxHtml).next().addClass("wym_box_"+this._index),$.isFunction($.fn.data)&&($.data(this._box.get(0),WYMeditor.WYM_INDEX,this._index),$.data(this._element.get(0),WYMeditor.WYM_INDEX,this._index));var h=WYMeditor.Helper,iframeHtml=this._options.iframeHtml;iframeHtml=h.replaceAll(iframeHtml,WYMeditor.INDEX,this._index),iframeHtml=h.replaceAll(iframeHtml,WYMeditor.IFRAME_BASE_PATH,this._options.iframeBasePath);var boxHtml=$(this._box).html();boxHtml=h.replaceAll(boxHtml,WYMeditor.LOGO,this._options.logoHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.TOOLS,this._options.toolsHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.CONTAINERS,this._options.containersHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.CLASSES,this._options.classesHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.HTML,this._options.htmlHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.IFRAME,iframeHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.STATUS,this._options.statusHtml);for(var aTools=eval(this._options.toolsItems),sTools="",i=0;i"+WYMeditor.APPLY_CLASS+"<",">"+this._options.stringDelimiterLeft+WYMeditor.APPLY_CLASS+this._options.stringDelimiterRight+"<"),boxHtml=h.replaceAll(boxHtml,WYMeditor.CLASSES_ITEMS,sClasses);for(var aContainers=eval(this._options.containersItems),sContainers="",i=0;i").join(">\n")});s=s.replace(/src=\"system\/images/g,'src="/system/images'),$(s).find(bad_spans="span[id|=wym], span[id=undefined]").add($(s).filter(bad_spans)).each(function(t,e){html_to_replace_with=i.parser.parse($(e).html()),html_to_replace=i.parser.parse($(e).wrap("").parent().html()),$.browser.msie&&(html_to_replace=new RegExp(html_to_replace.replace(/(\ [^\=]+\=)([^\ >]+)/,'$1"$2"'),"ig")),s=s.replace(html_to_replace,html_to_replace_with)}),s=(s=(s=s.replace(/(\ ?id=(\"|\')last\_paste(\"|\'))/gim,"")).replace(/[%$]+wym-[^%$]*[%$]+/gim,"")).replace(/^
$/,""),$(i._element).val(s),$(i._box).find(i._options.htmlValSelector).not(".hasfocus").val(s)},WYMeditor.editor.prototype.dialog=function(t){var e=this;e.update();var i=this._wym._options.dialogPath+t+"?wymeditor=true&"+window.location.href.match(/switch_locale=[a-z]{2}(?:-[A-Z]{2})?/);e._current_unique_stamp=e.uniqueStamp(),e._undo_on_cancel=!1,e._redo_on_cancel=!1;var s=this.selected();t!=WYMeditor.DIALOG_TABLE&&e.format_block(),t==WYMeditor.DIALOG_LINK&&$.browser.mozilla&&(selection=e._iframe.contentWindow.getSelection(),matches=$($(s).html().match(new RegExp(RegExp.escape(selection.anchorNode.textContent)+"(.*)"+RegExp.escape(selection.focusNode.textContent)))),null!=matches&&0selection.focusOffset?(start_node=selection.focusNode,start=selection.focusOffset,end_node=selection.anchorNode,end=selection.anchorOffset):(start_node=selection.anchorNode,start=selection.anchorOffset,end_node=selection.focusNode,end=selection.focusOffset),"undefined"==typeof start_node.insertData){for(var r=start_node.childNodes.length-1,a=start_node;"function"!=typeof end_node.insertData||!r;)start_node=a.childNodes[r--];start=0}if("undefined"==typeof end_node.insertData){for(var n=end_node.childNodes.length-1,l=end_node;"function"!=typeof end_node.insertData||!n;)end_node=l.childNodes[n--];end=end_node.length}start_tag="%%"+e._current_unique_stamp+"%%",end_tag="$$"+e._current_unique_stamp+"$$",start_node===end_node&&(end+=start_tag.length),start_node.insertData(start,start_tag),end_node.insertData(end,end_tag),$(s).html($(s).html().replace(start_tag,"").replace(end_tag,""))}else e.wrap("","");else e.wrap("","")}else e._selected_image||(o._id_before_replaceable=o.id,o.id=""+this._current_unique_stamp,$(o).attr("_id_before_replaceable",o._id_before_replaceable)),t!=WYMeditor.DIALOG_PASTE&&t!=WYMeditor.DIALOG_TABLE&&(i+=-1==i.indexOf("?")?"?":"&",port=0"),t){case WYMeditor.DIALOG_TABLE:dialog_container.html(e.replaceStrings(e._options.dialogTableHtml)).dialog($.extend(e._options.dialogInlineFeatures,{title:dialog_title})),ajax_loaded_callback();break;case WYMeditor.DIALOG_PASTE:dialog_container.html(e.replaceStrings(e._options.dialogPasteHtml)).dialog($.extend(e._options.dialogInlineFeatures,{title:dialog_title})),ajax_loaded_callback();break;default:$("").appendTo(dialog_container),dialog_container.dialog($.extend(e._options.dialogFeatures,{title:dialog_title})).load(i,ajax_loaded_callback)}},WYMeditor.editor.prototype.dialog_ajax_callback=function(t){wym=this,_selected=t,$("#"+wym._options.dialogId+".editor_dialog").css("height","auto"),(iframes=$("#"+this._options.dialogId).find("iframe")).load(function(){WYMeditor.INIT_DIALOG(wym,_selected,!0),$(this).unbind("load")}),0==iframes.length&&WYMeditor.INIT_DIALOG(this,t)},WYMeditor.editor.prototype.toggleHtml=function(){$(this._box).find(this._options.htmlSelector).toggle()},WYMeditor.editor.prototype.uniqueStamp=function(){return"wym-"+(new Date).getTime()},WYMeditor.editor.prototype.paste=function(t){var e;wym=this,wym.format_block(),replaceable=$(wym._doc.body).find("#"+wym._current_unique_stamp),container=replaceable.get(0)||this.selected();var i=t.replace(/&/g,"&").replace(//g,">").split(wym._newLine+wym._newLine),s=new RegExp(wym._newLine,"g");if(container&&container.tagName.toLowerCase()!=WYMeditor.BODY)for(contentAfterBreak="",insertedContentAfterBreak="",x=i.length-1;0<=x;x--)if(e=i[x].replace(s,"
"),0==x)1.*")),e=matches[1]+e+$(container).html(),p.html(e),null!=insertedContentAfterBreak&&0"+contentAfterBreak+""))):$(container).html($(container).html().replace(/^
$/,"")+e);else{if(i.length-1==x){var o=$(container).parent().html().match(new RegExp(".*([\\s\\S]*)"));o&&o[1]&&(contentAfterBreak=o[1].split("")[0]),e=""+e+"
"}else e=""+e+"
";""==insertedContentAfterBreak?insertedContentAfterBreak+=e:insertedContentAfterBreak=e+insertedContentAfterBreak}else for(x=0;x"),0==x&&0==$(container).html().replace(/
/,"").length?$(container).html(e):$(wym._doc.body).append(""+e+"
");null!=replaceable.get(0)&&("span"==replaceable.get(0).tagName.toLowerCase()&&replaceable.replaceWith(replaceable.html()),replaceable.attr("id",replaceable.get(0)._id_before_replaceable||null))},WYMeditor.editor.prototype.insert=function(t){null!=this._iframe.contentWindow.getSelection().focusNode?this._exec(WYMeditor.INSERT_HTML,t):this.paste(t)},WYMeditor.editor.prototype.wrap=function(t,e,i){t=void 0!==t?t:"",e=void 0!==e?e:"",null==i&&(i=this._iframe.contentWindow.getSelection()),null!=i.focusNode&&this._exec(WYMeditor.INSERT_HTML,t+i.toString()+e)},WYMeditor.editor.prototype.unwrap=function(t){null==t&&(t=this._iframe.contentWindow.getSelection()),null!=t.focusNode&&this._exec(WYMeditor.INSERT_HTML,t.toString())},WYMeditor.editor.prototype.setFocusToNode=function(t,e){var i=this._doc.createRange(),s=this._iframe.contentWindow.getSelection();e=e?0:1,i.selectNodeContents(t),s.addRange(i),s.collapse(t,e),this._iframe.contentWindow.focus()},WYMeditor.editor.prototype.addCssRules=function(t,e){var i=t.styleSheets[0];if(i)for(var s=0;s":" />")},WYMeditor.XmlHelper.prototype.contentTag=function(t,e,i){return"<"+t+((i=i||!1)?this.tagOptions(i):"")+">"+e+""+t+">"},WYMeditor.XmlHelper.prototype.cdataSection=function(t){return""},WYMeditor.XmlHelper.prototype.escapeOnce=function(t){return this._fixDoubleEscape(this.escapeEntities(t))},WYMeditor.XmlHelper.prototype._fixDoubleEscape=function(t){return t.replace(/&([a-z]+|(#\d+));/gi,"&$1;")},WYMeditor.XmlHelper.prototype.tagOptions=function(t){var e=this;for(var i in e._formated_options="",t){var s=t[i];"function"!=typeof s&&0\s]*))/g);if(i.toString()!=t)for(var s in i){var o=i[s];if("function"!=typeof o&&0!=o.length){var r=new RegExp("(\\w+)\\s*"+o);if(match=t.match(r)){var a=o.replace(/^[\s=]+/,""),n=a.charAt(0);""!=(n='"'==n?'"':"'"==n?"'":"")&&(a='"'==n?a.replace(/^"|"+$/g,""):a.replace(/^'|'+$/g,"")),t=t.replace(match[0],""),e.push([match[1],a])}}}return e},WYMeditor.ParallelRegex=function(t){return this._case=t,this._patterns=[],this._labels=[],this._regex=null,this},WYMeditor.ParallelRegex.prototype.addPattern=function(t,e){e=e||!0;var i=this._patterns.length;this._patterns[i]=t,this._labels[i]=e,this._regex=null},WYMeditor.ParallelRegex.prototype.match=function(t){if(0==this._patterns.length)return[!1,""];var e=t.match(this._getCompoundedRegex());if(!e)return[!1,""];for(var i=e[0],s=1;s","Comment")},WYMeditor.XhtmlLexer.prototype.addScriptTokens=function(t){this.addEntryPattern(""+WYMeditor.DIALOG_BODY+"