1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
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<t.length;++e)WYMeditor.console[t[e]]=function(){}}}(),$.extend(WYMeditor,{VERSION:"0.5-rc1-refinery",INSTANCES:[],STRINGS:[],SKINS:[],NAME:"name",INDEX:"{Wym_Index}",WYM_INDEX:"wym_index",BASE_PATH:"{Wym_Base_Path}",CSS_PATH:"{Wym_Css_Path}",WYM_PATH:"{Wym_Wym_Path}",SKINS_DEFAULT_PATH:"/assets/wymeditor/skins/",SKINS_DEFAULT_CSS:"skin.css",SKINS_DEFAULT_JS:"skin.js",LANG_DEFAULT_PATH:"/assets/wymeditor/lang/",IFRAME_BASE_PATH:"{Wym_Iframe_Base_Path}",IFRAME_DEFAULT:"iframe/default/",JQUERY_PATH:"{Wym_Jquery_Path}",DIRECTION:"{Wym_Direction}",LOGO:"{Wym_Logo}",TOOLS:"{Wym_Tools}",TOOLS_ITEMS:"{Wym_Tools_Items}",TOOL_NAME:"{Wym_Tool_Name}",TOOL_TITLE:"{Wym_Tool_Title}",TOOL_CLASS:"{Wym_Tool_Class}",CLASSES:"{Wym_Classes}",CLASSES_ITEMS:"{Wym_Classes_Items}",CLASS_NAME:"{Wym_Class_Name}",CLASS_TITLE:"{Wym_Class_Title}",CONTAINERS:"{Wym_Containers}",CONTAINERS_ITEMS:"{Wym_Containers_Items}",CONTAINER_NAME:"{Wym_Container_Name}",CONTAINER_TITLE:"{Wym_Containers_Title}",CONTAINER_CLASS:"{Wym_Container_Class}",HTML:"{Wym_Html}",IFRAME:"{Wym_Iframe}",STATUS:"{Wym_Status}",DIALOG_TITLE:"{Wym_Dialog_Title}",DIALOG_BODY:"{Wym_Dialog_Body}",STRING:"string",BODY:"body",DIV:"div",P:"p",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",PRE:"pre",BLOCKQUOTE:"blockquote",A:"a",BR:"br",IMG:"img",TABLE:"table",TD:"td",TH:"th",UL:"ul",OL:"ol",LI:"li",CLASS:"class",HREF:"href",SRC:"src",TITLE:"title",TARGET:"target",ALT:"alt",REL:"data-rel",DIALOG_LINK:"Link",DIALOG_IMAGE:"Image",DIALOG_TABLE:"Table",DIALOG_PASTE:"Paste_From_Word",DIALOG_CLASS:"Css_Class",BOLD:"Bold",ITALIC:"Italic",CREATE_LINK:"CreateLink",INSERT_IMAGE:"InsertImage",INSERT_TABLE:"InsertTable",INSERT_HTML:"InsertHTML",APPLY_CLASS:"Apply_Style",PASTE:"Paste",INDENT:"Indent",OUTDENT:"Outdent",TOGGLE_HTML:"ToggleHtml",FORMAT_BLOCK:"FormatBlock",PREVIEW:"Preview",UNLINK:"Unlink",INSERT_UNORDEREDLIST:"InsertUnorderedList",INSERT_ORDEREDLIST:"InsertOrderedList",MAIN_CONTAINERS:new Array("p","h1","h2","h3","h4","h5","h6","pre","blockquote"),BLOCKS:new Array("address","blockquote","div","dl","fieldset","form","h1","h2","h3","h4","h5","h6","hr","noscript","ol","p","pre","table","ul","dd","dt","li","tbody","td","tfoot","th","thead","tr","meter","section","article","aside","details","header","footer","nav","dialog","figure","figcaption","address","hgroup","mark","time","canvas","audio","video","output","progress","ruby","rt","rp","summary","command"),KEY:{BACKSPACE:8,ENTER:13,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,CURSOR:new Array(37,38,39,40),DELETE:46},NODE:{ELEMENT:1,ATTRIBUTE:2,TEXT:3},editor:function(t,e){this._index=WYMeditor.INSTANCES.push(this)-1,this._element=t,this._options=e,this._html=$(t).val(),this._options.html&&(this._html=this._options.html),this._options.basePath=this._options.basePath||this.computeBasePath(),this._options.skinPath=this._options.skinPath||this._options.basePath+WYMeditor.SKINS_DEFAULT_PATH+this._options.skin+"/",this._options.cssCompiledSkinPath=this._options.cssCompiledSkinPath||(this._options.cssSkinPath||this._options.skinPath)+this._options.skin+"/",this._options.jsCompiledSkinPath=this._options.jsCompiledSkinPath||(this._options.jsSkinPath||this._options.skinPath)+this._options.skin+"/",this._options.wymPath=this._options.wymPath||this.computeWymPath(),this._options.langPath=this._options.langPath||this._options.basePath+WYMeditor.LANG_DEFAULT_PATH,this._options.iframeBasePath=this._options.iframeBasePath||this._options.basePath+WYMeditor.IFRAME_DEFAULT,this._options.jQueryPath=this._options.jQueryPath||this.computeJqueryPath(),this.init()}}),$.fn.wymeditor=function(t){return t=$.extend({html:"",basePath:!1,skinPath:!1,jsSkinPath:!1,cssSkinPath:!1,wymPath:!1,iframeBasePath:!1,jQueryPath:!1,styles:!1,stylesheet:!1,skin:"default",initSkin:!0,loadSkin:!0,lang:refinery.current_admin_locale,direction:"ltr",boxHtml:"<div class='wym_box'><div class='wym_area_top'>"+WYMeditor.TOOLS+"</div><div class='wym_area_left'></div><div class='wym_area_right'>"+WYMeditor.CONTAINERS+WYMeditor.CLASSES+"</div><div class='wym_area_main'>"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"</div><div class='wym_area_bottom'>"+WYMeditor.LOGO+"</div></div>",logoHtml:"<a class='wym_wymeditor_link' href='http://www.wymeditor.org/'>WYMeditor</a>",iframeHtml:"<div class='wym_iframe wym_section'><iframe src='"+WYMeditor.IFRAME_BASE_PATH+"wymiframe.html' onload='this.contentWindow.parent.WYMeditor.INSTANCES["+WYMeditor.INDEX+"].initIframe(this)'></iframe></div>",editorStyles:[],toolsHtml:"<div class='wym_tools wym_section'><h2>{Tools}</h2><ul>"+WYMeditor.TOOLS_ITEMS+"</ul></div>",toolsItemHtml:"<li class='"+WYMeditor.TOOL_CLASS+"'><a href='#' name='"+WYMeditor.TOOL_NAME+"' title='"+WYMeditor.TOOL_TITLE+"'>"+WYMeditor.TOOL_TITLE+"</a></li>",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:"<div class='wym_containers wym_section'><h2>{Containers}</h2><ul>"+WYMeditor.CONTAINERS_ITEMS+"</ul></div>",containersItemHtml:"<li class='"+WYMeditor.CONTAINER_CLASS+"'><a href='#' name='"+WYMeditor.CONTAINER_NAME+"'>"+WYMeditor.CONTAINER_TITLE+"</a></li>",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:"<div class='wym_classes wym_section'><h2>{Classes}</h2><ul>"+WYMeditor.CLASSES_ITEMS+"</ul></div>",classesItemHtml:"<li class='wym_classes_"+WYMeditor.CLASS_NAME+"'><a href='#' name='"+WYMeditor.CLASS_NAME+"'>"+WYMeditor.CLASS_TITLE+"</a></li>",classesItems:[],statusHtml:"<div class='wym_status wym_section'><h2>{Status}</h2></div>",htmlHtml:"<div class='wym_html wym_section'><h2>{Source_Code}</h2><textarea class='wym_html_val'></textarea></div>",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:"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html dir='"+WYMeditor.DIRECTION+"'><head><link rel='stylesheet' type='text/css' media='screen' href='"+WYMeditor.CSS_PATH+"' /><title>"+WYMeditor.DIALOG_TITLE+"</title><script type='text/javascript' src='"+WYMeditor.JQUERY_PATH+"'></script><script type='text/javascript' src='"+WYMeditor.WYM_PATH+"'></script></head>"+WYMeditor.DIALOG_BODY+"</html>",dialogLinkHtml:"<div class='wym_dialog wym_dialog_link'><form><fieldset><input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"+WYMeditor.DIALOG_LINK+"' /><legend>{Link}</legend><div class='row'><label>{URL}</label><input type='text' class='wym_href' value='' size='40' /></div><div class='row'><label>{Title}</label><input type='text' class='wym_title' value='' size='40' /></div><div class='row row-indent'><input class='wym_submit button' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></div>",dialogImageHtml:"<div class='wym_dialog wym_dialog_image'><form><fieldset><input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"+WYMeditor.DIALOG_IMAGE+"' /><legend>{Image}</legend><div class='row'><label>{URL}</label><input type='text' class='wym_src' value='' size='40' /></div><div class='row'><label>{Alternative_Text}</label><input type='text' class='wym_alt' value='' size='40' /></div><div class='row'><label>{Title}</label><input type='text' class='wym_title' value='' size='40' /></div><div class='row row-indent'><input class='wym_submit button' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></div>",dialogTableHtml:"<div class='wym_dialog wym_dialog_table'><form><input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"+WYMeditor.DIALOG_TABLE+"' /><div class='row'><label>{Caption}</label><input type='text' class='wym_caption' value='' size='40' /></div><div class='row'><label>{Summary}</label><input type='text' class='wym_summary' value='' size='40' /></div><div class='row'><label>{Number_Of_Rows}</label><input type='text' class='wym_rows' value='3' size='3' /></div><div class='row'><label>{Number_Of_Cols}</label><input type='text' class='wym_cols' value='2' size='3' /></div><div class='row row-indent'><input class='wym_submit button' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></form></div>",dialogPasteHtml:"<div class='wym_dialog wym_dialog_paste'><form><input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"+WYMeditor.DIALOG_PASTE+"' /><fieldset><legend>{Paste_From_Word}</legend><div class='row'><textarea class='wym_text' rows='10' cols='50'></textarea></div><div class='row'><input class='wym_submit button' type='button' value='{Submit}' /><input class='wym_cancel' type='button'value='{Cancel}' /></div></fieldset></form></div>",dialogPreviewHtml:"<div class='wym_dialog wym_dialog_preview'></div>",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){$("<link rel='stylesheet' />").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=$("<a></a>").attr({href:sUrl,title:$(i._options.titleSelector).val()});null!=(target=$(i._options.targetSelector).val())&&0<target.length&&e.attr("target",target),i._selected_image?null!=(parent=o.parent().get(0))&&"A"==parent.tagName.toUpperCase()?$(parent).attr({href:e.attr("href"),title:$(i._options.titleSelector).val(),target:target}):(o.before(e),$(e).append(o.get(0))):(e.attr({style:o.attr("style"),"class":o.attr("class")}),e.html(o.html()),o.replaceWith($("<div/>").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<size.length&&(src=src.replace("_"+size+".","."),s.find("#existing_image_size_area li.selected").removeClass("selected"),s.find("#existing_image_size_area li a[href='#"+size+"']").parents("li:first").addClass("selected")),imgDialog.find(i._options.srcSelector).val(src),imgDialog.find(i._options.titleSelector).val(img.attr(WYMeditor.TITLE)),imgDialog.find(i._options.altSelector).val(img.attr(WYMeditor.ALT)),imgDialog.find(i._options.sizeSelector).val(size),(src=src.split(".")).pop(),s.find("#existing_image_area_content li img[src^='"+src+"']").parents("li:first").addClass("selected")),$(i._options.dialogImageSelector).find(i._options.submitSelector).click(function(t){form=$(this.form),null!=(url=form.find(i._options.srcSelector).val())&&0<url.length?((image=$(i._doc.createElement("IMG"))).attr(WYMeditor.SRC,url).attr(WYMeditor.TITLE,form.find(i._options.titleSelector).val()).attr(WYMeditor.ALT,form.find(i._options.altSelector).val()).attr(WYMeditor.REL,form.find(i._options.sizeSelector).val()).load(function(){$(this).attr({width:$(this).width(),height:$(this).height()})}),null==o&&(o=$(i._doc.body).find("#"+i._current_unique_stamp)),null!=o&&o.after(image).remove(),i.close_dialog(t)):($("iframe").contents().find(".save-loader").remove(),alert("Please select an image to insert.")),t.preventDefault()}),$(i._options.dialogTableSelector).find(i._options.submitSelector).click(function(t){if(0<(iRows=$(i._options.rowsSelector).val())&&0<(iCols=$(i._options.colsSelector).val())){for((table=i._doc.createElement(WYMeditor.TABLE)).createCaption().innerHTML=$(i._options.captionSelector).val(),x=0;x<iRows;x++)for(newRow=table.insertRow(x),y=0;y<iCols;y++)newRow.insertCell(y);var e=$(i.findUp(i.container(),WYMeditor.MAIN_CONTAINERS)).get(0);e&&e.parentNode?$(e).after(table):$(i._doc.body).append(table)}i.close_dialog(t)}),$(i._options.dialogPasteSelector).find(i._options.submitSelector).click(function(t){i.paste($(i._options.textSelector).val()),i.close_dialog(t)}),$(i._options.dialogPreviewSelector).find(i._options.previewSelector).html(i.xhtml()),$.isFunction(i._options.postInitDialog)&&i._options.postInitDialog(i,window)},WYMeditor.editor.prototype.close_dialog=function(t,e){e&&(0<(span=$(this._doc.body).find("span#"+this._current_unique_stamp)).length&&span.parent().html(span.parent().html().replace(new RegExp(["<span(.+?)",span.attr("id"),"(.+?)</span>"].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<aTools.length;i++){var oTool=aTools[i];if(oTool.name&&oTool.title){var sTool=this._options.toolsItemHtml,sTool=h.replaceAll(sTool,WYMeditor.TOOL_NAME,oTool.name);sTool=h.replaceAll(sTool,WYMeditor.TOOL_TITLE,this._options.stringDelimiterLeft+oTool.title+this._options.stringDelimiterRight),sTool=h.replaceAll(sTool,WYMeditor.TOOL_CLASS,oTool.css),sTools+=sTool}}boxHtml=h.replaceAll(boxHtml,WYMeditor.TOOLS_ITEMS,sTools);for(var aClasses=eval(this._options.classesItems),sClasses="",i=0;i<aClasses.length;i++){var oClass=aClasses[i];if(oClass.name)if(oClass.rules&&0<oClass.rules.length){var sRules="",wym=this;$.each(oClass.rules,function(t,e){sClass=wym._options.classesItemHtml,sClass=h.replaceAll(sClass,WYMeditor.CLASS_NAME,oClass.name+(oClass.join||"")+(e.name||e)),sClass=h.replaceAll(sClass,WYMeditor.CLASS_TITLE,e.title||titleize(e.name||e)),sRules+=sClass});var sClassMultiple=this._options.classesItemHtmlMultiple;sClassMultiple=h.replaceAll(sClassMultiple,WYMeditor.CLASS_TITLE,oClass.title||titleize(oClass.name)),sClassMultiple=h.replaceAll(sClassMultiple,"{classesItemHtml}",sRules),sClasses+=sClassMultiple}else sClass=this._options.classesItemHtml,sClass=h.replaceAll(sClass,WYMeditor.CLASS_NAME,oClass.name),sClass=h.replaceAll(sClass,WYMeditor.CLASS_TITLE,oClass.title||titleize(oClass.name)),sClasses+=sClass}boxHtml=h.replaceAll(boxHtml,">"+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<aContainers.length;i++){var oContainer=aContainers[i];if(oContainer.name&&oContainer.title){var sContainer=this._options.containersItemHtml;sContainer=h.replaceAll(sContainer,WYMeditor.CONTAINER_NAME,oContainer.name),sContainer=h.replaceAll(sContainer,WYMeditor.CONTAINER_TITLE,this._options.stringDelimiterLeft+oContainer.title+this._options.stringDelimiterRight),sContainer=h.replaceAll(sContainer,WYMeditor.CONTAINER_CLASS,oContainer.css),sContainers+=sContainer}}boxHtml=h.replaceAll(boxHtml,WYMeditor.CONTAINERS_ITEMS,sContainers),boxHtml=this.replaceStrings(boxHtml),$(this._box).html(boxHtml),$(this._box).find(this._options.htmlSelector).hide(),this.loadSkin(),$(this._element).data("wymeditor",this)}},WYMeditor.editor.prototype.bindEvents=function(){var wym=this;$(this._box).find(this._options.toolSelector).click(function(){return wym._iframe.contentWindow.focus(),wym.exec($(this).attr(WYMeditor.NAME)),!1}),$(this._box).find(this._options.containerSelector).click(function(){return wym.container($(this).attr(WYMeditor.NAME)),!1}),$(this._box).find(this._options.htmlValSelector).keyup(function(){$(wym._doc.body).html($(this).val())}).focus(function(){$(this).toggleClass("hasfocus")}).blur(function(){$(this).toggleClass("hasfocus")}),$(this._box).find(this._options.classSelector).bind("click",function(e){var aClasses=eval(wym._options.classesItems),sName=$(this).attr(WYMeditor.NAME),oClass=WYMeditor.Helper.findByName(aClasses,sName),replacers=$([]);null==oClass&&$.each(aClasses,function(t,i){if(null==oClass&&i.rules&&0<i.rules.length){var s=sName.replace(i.name+(i.join||""),""),o=null;$.each(i.rules,function(t,e){s==(e.name||e)?o=t:replacers.push(i.name+(i.join||"")+(e.name||e))}),null!=o&&(oClass={expr:i.rules[o].expr||null})}}),oClass&&(replacers.each(function(t,e){wym.removeClass(e,oClass.expr)}),wym.toggleClass(sName,oClass.expr)),wym.exec(WYMeditor.APPLY_CLASS),wym._iframe.contentWindow.focus(),e.preventDefault()}),$(this._options.updateSelector).bind(this._options.updateEvent,function(){wym.update()})},WYMeditor.editor.prototype.ready=function(){return null!=this._doc},WYMeditor.editor.prototype.box=function(){return this._box},WYMeditor.editor.prototype.html=function(t){if("string"!=typeof t)return $(this._doc.body).html();$(this._doc.body).html(t)},WYMeditor.editor.prototype.intercept_paste=function(t){var e=WYMeditor.INSTANCES[this.title];e.format_block(),e.exec(WYMeditor.PASTE),t&&t.preventDefault()},WYMeditor.editor.prototype.xhtml=function(){return this.parser.parse(this.html())},WYMeditor.editor.prototype.exec=function(t){switch(t){case WYMeditor.CREATE_LINK:((container=this.container())||this._selected_image)&&this.dialog(WYMeditor.DIALOG_LINK);break;case WYMeditor.INSERT_IMAGE:this.dialog(WYMeditor.DIALOG_IMAGE);break;case WYMeditor.INSERT_TABLE:this.dialog(WYMeditor.DIALOG_TABLE);break;case WYMeditor.PASTE:this.dialog(WYMeditor.DIALOG_PASTE);break;case WYMeditor.TOGGLE_HTML:this.update(),this.toggleHtml();break;case WYMeditor.PREVIEW:this.dialog(WYMeditor.PREVIEW);break;case WYMeditor.APPLY_CLASS:wym=this,$(wym._box).find(this._options.classUnhiddenSelector).find("a[name]").each(function(t,e){$(wym.selected()).hasClass($(e).attr("name"))?$(e).parent().addClass("enabled"):$(e).parent().removeClass("enabled")});break;default:this._exec(t)}},WYMeditor.editor.prototype.container=function(t){if(!t)return this.selected();var e=null;if(t.toLowerCase()==WYMeditor.TH){switch((e=this.container()).tagName.toLowerCase()){case WYMeditor.TD:case WYMeditor.TH:break;default:var i=new Array(WYMeditor.TD,WYMeditor.TH);e=this.findUp(this.container(),i)}null!=e&&(t=e.tagName.toLowerCase()==WYMeditor.TD?WYMeditor.TH:WYMeditor.TD,this.switchTo(e,t),this.update())}else{i=new Array(WYMeditor.P,WYMeditor.H1,WYMeditor.H2,WYMeditor.H3,WYMeditor.H4,WYMeditor.H5,WYMeditor.H6,WYMeditor.PRE,WYMeditor.BLOCKQUOTE);if(e=this.findUp(this.container(),i)){var s=null;if(t.toLowerCase()==WYMeditor.BLOCKQUOTE){var o=this.findUp(this.container(),WYMeditor.BLOCKQUOTE);if(null==o)s=this._doc.createElement(t),e.parentNode.insertBefore(s,e),s.appendChild(e),this.setFocusToNode(s.firstChild);else{var r=o.childNodes,a=r.length,n=null;0<a&&(n=r.item(0));for(var l=0;l<a;l++)o.parentNode.insertBefore(r.item(0),o);o.parentNode.removeChild(o),n&&this.setFocusToNode(n)}}else this.setFocusToNode(this.switchTo(e,t));this.update()}}},WYMeditor.editor.prototype.toggleClass=function(t,e){var i=$(this._selected_image?this._selected_image:this.selected(!0));null!=e&&(i=$(i.parentsOrSelf(e))),i.toggleClass(t),i.attr(WYMeditor.CLASS)||i.removeAttr(this._class)},WYMeditor.editor.prototype.toggleClassSelector=function(){var t=this;$(t._box).find(t._options.classUnhiddenSelector).hasClass(t._options.classHiddenSelector.substring(1))?($(t._box).find(t._options.classUnhiddenSelector).removeClass(t._options.classHiddenSelector.substring(1)),$(t._box).find("a[name="+WYMeditor.APPLY_CLASS+"]").addClass("selected").parent().addClass("activated")):($(t._box).find(t._options.classUnhiddenSelector).addClass(t._options.classHiddenSelector.substring(1)),$(t._box).find("a[name="+WYMeditor.APPLY_CLASS+"]").removeClass("selected").parent().removeClass("activated")),t.exec(WYMeditor.APPLY_CLASS)},WYMeditor.editor.prototype.removeClass=function(t,e){var i=$(this._selected_image?this._selected_image:$(this.selected(!0)));null!=e&&(i=$(i.parentsOrSelf(e))),i.removeClass(t),i.attr(WYMeditor.CLASS)||i.removeAttr(this._class)},WYMeditor.editor.prototype.findUp=function(t,e){if(t){var i=t.tagName.toLowerCase();if(typeof e==WYMeditor.STRING)for(;i!=e&&i!=WYMeditor.BODY;)i=(t=t.parentNode).tagName.toLowerCase();else for(var s=!1;!s&&i!=WYMeditor.BODY;){for(var o=0;o<e.length;o++)if(i==e[o]){s=!0;break}s||(i=(t=t.parentNode).tagName.toLowerCase())}return i!=WYMeditor.BODY?t:null}return null},WYMeditor.editor.prototype.switchTo=function(t,e){t.getRangeAt&&(this.exec(WYMeditor.BOLD),t=t.focusNode.parentNode);var i=$(t).html(),s=this._doc.createElement(e);return void 0!==$(t).attr("class")&&$.each($(t).attr("class").split(" "),function(t,e){$(s).addClass(e)}),t.parentNode.replaceChild(s,t),$(s).html(i),this.setFocusToNode(s),s},WYMeditor.editor.prototype.replaceStrings=function(sVal){var wym=this;if(!WYMeditor.STRINGS[wym._options.lang])try{eval($.ajax({url:wym._options.langPath+wym._options.lang+".js",async:!1}).responseText)}catch(e){return WYMeditor.console&&WYMeditor.console.error("WYMeditor: error while parsing language file."),sVal}return $.each(WYMeditor.STRINGS[wym._options.lang],function(t,e){sVal=WYMeditor.Helper.replaceAll(sVal,wym.encloseString(t),e)}),sVal},WYMeditor.editor.prototype.encloseString=function(t){return this._options.stringDelimiterLeft+t+this._options.stringDelimiterRight},WYMeditor.editor.prototype.status=function(t){$(this._box).find(this._options.statusSelector).html(t)},WYMeditor.editor.prototype.update=function(){var i=this,s=i.xhtml().replace(/<\/([A-Za-z0-9]*)></g,function(t){return t.split(">").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("<div />").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(/^<br\ ?\/?>$/,""),$(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&&0<matches.length&&0<(possible_anchor_tag=matches.last()).length&&null!=(href_matches=possible_anchor_tag.get(0).match(/href="([^"]*)"/))&&null!=(href=$(href_matches).last().get(0))&&$(e._doc).find("a").each(function(t,e){$(e).html()==selection&&(s=e)})),ajax_loaded_callback=function(){e.dialog_ajax_callback(s)};var o=e._selected_image?e._selected_image.parentNode:s;if(null!=o)if(o.tagName.toLowerCase()!=WYMeditor.A){if(null==e._selected_image)if(null!=s&&s.tagName.toLowerCase()!=WYMeditor.A&&e._iframe.contentWindow.getSelection)if(selection=e._iframe.contentWindow.getSelection(),selection.focusNode.insertData){if(selection.anchorOffset>selection.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,"<span id='"+e._current_unique_stamp+"'>").replace(end_tag,"</span>"))}else e.wrap("<span id='"+e._current_unique_stamp+"'>","</span>");else e.wrap("<span id='"+e._current_unique_stamp+"'>","</span>")}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<window.location.port.length?":"+window.location.port:"",i+="current_link="+o.href.replace(window.location.protocol+"//"+window.location.hostname+port,""),i+="&target_blank="+("_blank"==o.target?"true":"false"));switch(dialog_title=e.replaceStrings(e.encloseString(t)),dialog_container=$("<div id='"+e._options.dialogId+"' class='editor_dialog'></div>"),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:$("<img id='dialog_loading' src='/assets/refinery/dialogLoadingAnimation-7e4f4da6094268bfbba789dade7a8552.gif' width='208' height='13' />").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,"<").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,"<br />"),0==x
)1<i.length&&"span"==$(container).get(0).tagName.toLowerCase()&&$(container).attr("id")==""+wym._current_unique_stamp&&"p"==$(container).parent().get(0).tagName.toLowerCase()?(p=$(container).parent(),matches=p.html().match(new RegExp("([\\s\\S]*)<span id=['|\"]"+wym._current_unique_stamp+"['|\"]>.*</span>")),e=matches[1]+e+$(container).html(),p.html(e),null!=insertedContentAfterBreak&&0<insertedContentAfterBreak.length&&p.after(insertedContentAfterBreak),null!=contentAfterBreak&&0<contentAfterBreak.length&&(1==(last_paste=p.parent().find("p#last_paste")).length?last_paste.attr("id",null).html(last_paste.html()+contentAfterBreak):p.next().after("<p>"+contentAfterBreak+"</p>"))):$(container).html($(container).html().replace(/^<br\/?>$/,"")+e);else{if(i.length-1==x){var o=$(container).parent().html().match(new RegExp("<span id=['|\"]"+wym._current_unique_stamp+"['|\"]>.*</span>([\\s\\S]*)"));o&&o[1]&&(contentAfterBreak=o[1].split("</p>")[0]),e="<p id='last_paste'>"+e+"</p>"}else e="<p>"+e+"</p>";""==insertedContentAfterBreak?insertedContentAfterBreak+=e:insertedContentAfterBreak=e+insertedContentAfterBreak}else for(x=0;x<i.length;x++)e=(e=i[x]).replace(s,"<br />"),0==x&&0==$(container).html().replace(/<br\ ?\/?>/,"").length?$(container).html(e):$(wym._doc.body).append("<p>"+e+"</p>");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<e.length;s++){var o=e[s];o.name&&o.css&&this.addCssRule(i,o)}},WYMeditor.editor.prototype.format_block=function(t){var e=this,i=t||e.selected()||$(e._iframe).contents().find("body").get(0),s=i.tagName.toLowerCase();-1<$.inArray(s,["strong","b","em","i","sub","sup","a"])&&(s=i.parentNode.tagName.toLowerCase()),s==WYMeditor.BODY&&(e._selected_image=null,$(e._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym"),e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P))},WYMeditor.editor.prototype.computeBasePath=function(){return null!=(script_path=this.computeWymPath())?(1<(src_parts=script_path.split("/")).length&&src_parts.pop(),src_parts.join("/")+"/"):null},WYMeditor.editor.prototype.computeWymPath=function(){return $("script[src*=jquery.refinery.wymeditor]").attr("src")},WYMeditor.editor.prototype.computeJqueryPath=function(){return $($.grep($("script"),function(t){return t.src&&t.src.match(/jquery(-(.*)){0,1}(\.pack|\.min|\.packed)?\.js(\?.*)?$/)})).attr("src")},WYMeditor.editor.prototype.computeCssPath=function(){return $($.grep($("link"),function(t){return t.href&&t.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/)})).attr("href")},WYMeditor.editor.prototype.configureEditorUsingRawCss=function(){var t=new WYMeditor.WymCssParser;this._options.stylesheet?t.parse($.ajax({url:this._options.stylesheet,async:!1}).responseText):t.parse(this._options.styles,!1),0==this._options.classesItems.length&&(this._options.classesItems=t.css_settings.classesItems),0==this._options.editorStyles.length&&(this._options.editorStyles=t.css_settings.editorStyles),0==this._options.dialogStyles.length&&(this._options.dialogStyles=t.css_settings.dialogStyles)},WYMeditor.editor.prototype.listen=function(){$(this._doc.body).bind("mousedown",this.mousedown);for(var t=this._doc.body.getElementsByTagName("img"),e=0;e<t.length;e++)$(t[e]).bind("mousedown",this.mousedown);$(this._doc).find("a[href]").click(function(t){t.preventDefault()})},WYMeditor.editor.prototype.mousedown=function(t){var e=WYMeditor.INSTANCES[this.ownerDocument.title];e._selected_image=t.target.tagName.toLowerCase()==WYMeditor.IMG?t.target:null,$(e._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym"),$.browser.mozilla||$(e._selected_image).addClass("selected_by_wym"),$.browser.webkit||t.stopPropagation()},WYMeditor.editor.prototype.loadSkin=function(){if(this._options.loadSkin&&!WYMeditor.SKINS[this._options.skin]){var found=!1,rExp=new RegExp(this._options.skin+"/"+WYMeditor.SKINS_DEFAULT_CSS+"([?].+?)?$");$("link").each(function(){this.href.match(rExp)&&(found=!0)}),found||WYMeditor.loadCss(this._options.cssCompiledSkinPath+WYMeditor.SKINS_DEFAULT_CSS)}$(this._box).addClass("wym_skin_"+this._options.skin),this._options.initSkin&&!WYMeditor.SKINS[this._options.skin]&&eval($.ajax({url:this._options.jsCompiledSkinPath+WYMeditor.SKINS_DEFAULT_JS,async:!1}).responseText),WYMeditor.SKINS[this._options.skin]&&WYMeditor.SKINS[this._options.skin].init&&WYMeditor.SKINS[this._options.skin].init(this)},WYMeditor.XmlHelper=function(){return this._entitiesDiv=document.createElement("div"),this},WYMeditor.XmlHelper.prototype.tag=function(t,e,i){return i=i||!1,"<"+t+((e=e||!1)?this.tagOptions(e):"")+(i?">":" />")},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"<![CDATA["+t+"]]>"},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.length&&(parseInt(i)==i&&"object"==typeof s&&(i=s.shift(),s=s.pop()),""!=i&&""!=s&&(e._formated_options+=" "+i+'="'+e.escapeOnce(s)+'"'))}return e._formated_options},WYMeditor.XmlHelper.prototype.escapeEntities=function(t,e){this._entitiesDiv.innerHTML=t,this._entitiesDiv.textContent=t;var i=this._entitiesDiv.innerHTML;return void 0===e&&(0!=e&&(i=i.replace('"',""")),1==e&&(i=i.replace('"',"'"))),i},WYMeditor.XmlHelper.prototype.parseAttributes=function(t){var e=[],i=t.split(/((=\s*")(")("))|((=\s*\')(\')(\'))|((=\s*[^>\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<e.length;s++)if(e[s])return[this._labels[s-1],i];return[!0,e[0]]},WYMeditor.ParallelRegex.prototype._getCompoundedRegex=function(){if(null==this._regex){for(var t=0,e=this._patterns.length;t<e;t++)this._patterns[t]="("+this._untokenizeRegex(this._tokenizeRegex(this._patterns[t]).replace(/([\/\(\)])/g,"\\$1"))+")";this._regex=new RegExp(this._patterns.join("|"),this._getPerlMatchingFlags())}return this._regex},WYMeditor.ParallelRegex.prototype._tokenizeRegex=function(t){return t.replace(/\(\?(i|m|s|x|U)\)/,"~~~~~~Tk1$1~~~~~~").replace(/\(\?(\-[i|m|s|x|U])\)/,"~~~~~~Tk2$1~~~~~~").replace(/\(\?\=(.*)\)/,"~~~~~~Tk3$1~~~~~~").replace(/\(\?\!(.*)\)/,"~~~~~~Tk4$1~~~~~~").replace(/\(\?\<\=(.*)\)/,"~~~~~~Tk5$1~~~~~~").replace(/\(\?\<\!(.*)\)/,"~~~~~~Tk6$1~~~~~~").replace(/\(\?\:(.*)\)/,"~~~~~~Tk7$1~~~~~~")},WYMeditor.ParallelRegex.prototype._untokenizeRegex=function(t){return t.replace(/~~~~~~Tk1(.{1})~~~~~~/,"(?$1)").replace(/~~~~~~Tk2(.{2})~~~~~~/,"(?$1)").replace(/~~~~~~Tk3(.*)~~~~~~/,"(?=$1)").replace(/~~~~~~Tk4(.*)~~~~~~/,"(?!$1)").replace(/~~~~~~Tk5(.*)~~~~~~/,"(?<=$1)").replace(/~~~~~~Tk6(.*)~~~~~~/,"(?<!$1)").replace(/~~~~~~Tk7(.*)~~~~~~/,"(?:$1)")},WYMeditor.ParallelRegex.prototype._getPerlMatchingFlags=function(){return this._case?"m":"mi"},WYMeditor.StateStack=function(t){return this._stack=[t],this},WYMeditor.StateStack.prototype.getCurrent=function(){return this._stack[this._stack.length-1]},WYMeditor.StateStack.prototype.enter=function(t){this._stack.push(t)},WYMeditor.StateStack.prototype.leave=function(){return 1!=this._stack.length&&(this._stack.pop(),!0)},WYMeditor.LEXER_ENTER=1,WYMeditor.LEXER_MATCHED=2,WYMeditor.LEXER_UNMATCHED=3,WYMeditor.LEXER_EXIT=4,WYMeditor.LEXER_SPECIAL=5,WYMeditor.Lexer=function(t,e,i){return e=e||"accept",this._case=i||!1,this._regexes={},this._parser=t,this._mode=new WYMeditor.StateStack(e),this._mode_handlers={},this._mode_handlers[e]=e,this},WYMeditor.Lexer.prototype.addPattern=function(t,e){e=e||"accept";"undefined"==typeof this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t),"undefined"==typeof this._mode_handlers[e]&&(this._mode_handlers[e]=e)},WYMeditor.Lexer.prototype.addEntryPattern=function(t,e,i){"undefined"==typeof this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t,i),"undefined"==typeof this._mode_handlers[i]&&(this._mode_handlers[i]=i)},WYMeditor.Lexer.prototype.addExitPattern=function(t,e){"undefined"==typeof this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t,"__exit"),"undefined"==typeof this._mode_handlers[e]&&(this._mode_handlers[e]=e)},WYMeditor.Lexer.prototype.addSpecialPattern=function(t,e,i){"undefined"==typeof this._regexes[e]&&(this._regexes[e]=new WYMeditor.ParallelRegex(this._case)),this._regexes[e].addPattern(t,"_"+i),"undefined"==typeof this._mode_handlers[i]&&(this._mode_handlers[i]=i)},WYMeditor.Lexer.prototype.mapHandler=function(t,e){this._mode_handlers[t]=e},WYMeditor.Lexer.prototype.parse=function(t){if("undefined"==typeof this._parser)return!1;for(var e,i=t.length;"object"==typeof(e=this._reduce(t));){t=e[0];var s=e[1],o=e[2],r=e[3];if(!this._dispatchTokens(s,o,r))return!1;if(""==t)return!0;if(t.length==i)return!1;i=t.length}return!!e&&this._invokeParser(t,WYMeditor.LEXER_UNMATCHED)},WYMeditor.Lexer.prototype._dispatchTokens=function(t,e,i){return i=i||!1,!!this._invokeParser(t,WYMeditor.LEXER_UNMATCHED)&&("boolean"==typeof i?this._invokeParser(e,WYMeditor.LEXER_MATCHED):this._isModeEnd(i)?!!this._invokeParser(e,WYMeditor.LEXER_EXIT)&&this._mode.leave():this._isSpecialMode(i)?(this._mode.enter(this._decodeSpecial(i)),!!this._invokeParser(e,WYMeditor.LEXER_SPECIAL)&&this._mode.leave()):(this._mode.enter(i),this._invokeParser(e,WYMeditor.LEXER_ENTER)))},WYMeditor.Lexer.prototype._isModeEnd=function(t){return"__exit"===t},WYMeditor.Lexer.prototype._isSpecialMode=function(t){return"_"==t.substring(0,1)},WYMeditor.Lexer.prototype._decodeSpecial=function(t){return t.substring(1)},WYMeditor.Lexer.prototype._invokeParser=function(t,e){if(""===t)return!0;var i=this._mode.getCurrent(),s=this._mode_handlers[i];return this._parser[s](t,e)},WYMeditor.Lexer.prototype._reduce=function(t){var e=this._regexes[this._mode.getCurrent()].match(t),i=e[1],s=e[0];if(s){var o=t.indexOf(i),r=t.substr(0,o);return[t=t.substring(o+i.length),r,i,s]}return!0},WYMeditor.XhtmlLexer=function(t){return $.extend(this,new WYMeditor.Lexer(t,"Text")),this.mapHandler("Text","Text"),this.addTokens(),this.init(),this},WYMeditor.XhtmlLexer.prototype.init=function(){},WYMeditor.XhtmlLexer.prototype.addTokens=function(){this.addCommentTokens("Text"),this.addScriptTokens("Text"),this.addCssTokens("Text"),this.addTagTokens("Text")},WYMeditor.XhtmlLexer.prototype.addCommentTokens=function(t){this.addEntryPattern("<!--",t,"Comment"),this.addExitPattern("-->","Comment")},WYMeditor.XhtmlLexer.prototype.addScriptTokens=function(t){this.addEntryPattern("<script",t,"Script"),this.addExitPattern("</script>","Script")},WYMeditor.XhtmlLexer.prototype.addCssTokens=function(t){this.addEntryPattern("<style",t,"Css"),this.addExitPattern("</style>","Css")},WYMeditor.XhtmlLexer.prototype.addTagTokens=function(t){this.addSpecialPattern("<\\s*[a-z0-9:-]+\\s*>",t,"OpeningTag"),this.addEntryPattern("<[a-z0-9:-]+[\\/ \\>]+",t,"OpeningTag"),this.addInTagDeclarationTokens("OpeningTag"),this.addSpecialPattern("</\\s*[a-z0-9:-]+\\s*>",t,"ClosingTag")},WYMeditor.XhtmlLexer.prototype.addInTagDeclarationTokens=function(t){this.addSpecialPattern("\\s+",t,"Ignore"),this.addAttributeTokens(t),this.addExitPattern("/>",t),this.addExitPattern(">",t)},WYMeditor.XhtmlLexer.prototype.addAttributeTokens=function(t){this.addSpecialPattern("\\s*[a-z-_0-9]*:?[a-z-_0-9]+\\s*(?==)\\s*",t,"TagAttributes"),this.addEntryPattern('=\\s*"',t,"DoubleQuotedAttribute"),this.addPattern('\\\\"',"DoubleQuotedAttribute"),this.addExitPattern('"',"DoubleQuotedAttribute"),this.addEntryPattern("=\\s*'",t,"SingleQuotedAttribute"),this.addPattern("\\\\'","SingleQuotedAttribute"),this.addExitPattern("'","SingleQuotedAttribute"),this.addSpecialPattern("=\\s*[^>\\s]*",t,"UnquotedAttribute")},WYMeditor.XhtmlParser=function(t,e){e=e||"Text";return this._Lexer=new WYMeditor.XhtmlLexer(this),this._Listener=t,this._mode=e,this._matches=[],this._last_match="",this._current_match="",this},WYMeditor.XhtmlParser.prototype.parse=function(t){return this._Lexer.parse(this.beforeParsing(t)),this.afterParsing(this._Listener.getResult())},WYMeditor.XhtmlParser.prototype.beforeParsing=function(t){return(t.match(/class="MsoNormal"/)||t.match(/ns = "urn:schemas-microsoft-com/))&&this._Listener.avoidStylingTagsAndAttributes(),this._Listener.beforeParsing(t)},WYMeditor.XhtmlParser.prototype.afterParsing=function(t){return this._Listener._avoiding_tags_implicitly&&this._Listener.allowStylingTagsAndAttributes(),this._Listener.afterParsing(t)},WYMeditor.XhtmlParser.prototype.Ignore=function(){return!0},WYMeditor.XhtmlParser.prototype.Text=function(t){return this._Listener.addContent(t),!0},WYMeditor.XhtmlParser.prototype.Comment=function(t,e){return this._addNonTagBlock(t,e,"addComment")},WYMeditor.XhtmlParser.prototype.Script=function(t,e){return this._addNonTagBlock(t,e,"addScript")},WYMeditor.XhtmlParser.prototype.Css=function(t,e){return this._addNonTagBlock(t,e,"addCss")},WYMeditor.XhtmlParser.prototype._addNonTagBlock=function(t,e,i){switch(e){case WYMeditor.LEXER_ENTER:this._non_tag=t;break;case WYMeditor.LEXER_UNMATCHED:this._non_tag+=t;break;case WYMeditor.LEXER_EXIT:switch(i){case"addComment":this._Listener.addComment(this._non_tag+t);break;case"addScript":this._Listener.addScript(this._non_tag+t);break;case"addCss":this._Listener.addCss(this._non_tag+t)}}return!0},WYMeditor.XhtmlParser.prototype.OpeningTag=function(t,e){switch(e){case WYMeditor.LEXER_ENTER:this._tag=this.normalizeTag(t),this._tag_attributes={};break;case WYMeditor.LEXER_SPECIAL:this._callOpenTagListener(this.normalizeTag(t));break;case WYMeditor.LEXER_EXIT:this._callOpenTagListener(this._tag,this._tag_attributes)}return!0},WYMeditor.XhtmlParser.prototype.ClosingTag=function(t){return this._callCloseTagListener(this.normalizeTag(t)),!0},WYMeditor.XhtmlParser.prototype._callOpenTagListener=function(t,e){e=e||{};this.autoCloseUnclosedBeforeNewOpening(t),this._Listener.isBlockTag(t)?(this._Listener._tag_stack.push(t),this._Listener.fixNestingBeforeOpeningBlockTag(t,e),this._Listener.openBlockTag(t,e),this._increaseOpenTagCounter(t)):this._Listener.isInlineTag(t)?this._Listener.inlineTag(t,e):(this._Listener.openUnknownTag(t,e),this._increaseOpenTagCounter(t)),this._Listener.last_tag=t,this._Listener.last_tag_opened=!0,this._Listener.last_tag_attributes=e},WYMeditor.XhtmlParser.prototype._callCloseTagListener=function(t){if(this._decreaseOpenTagCounter(t))if(this.autoCloseUnclosedBeforeTagClosing(t),this._Listener.isBlockTag(t)){var e=this._Listener._tag_stack.pop();if(0==e)return;e!=t&&(t=e),this._Listener.closeBlockTag(t)}else this._Listener.closeUnknownTag(t);else this._Listener.closeUnopenedTag(t);this._Listener.last_tag=t,this._Listener.last_tag_opened=!1},WYMeditor.XhtmlParser.prototype._increaseOpenTagCounter=function(t){this._Listener._open_tags[t]=this._Listener._open_tags[t]||0,this._Listener._open_tags[t]++},WYMeditor.XhtmlParser.prototype._decreaseOpenTagCounter=function(t){return!!this._Listener._open_tags[t]&&(this._Listener._open_tags[t]--,0==this._Listener._open_tags[t]&&(this._Listener._open_tags[t]=undefined),!0)},WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeNewOpening=function(t){this._autoCloseUnclosed(t,!1)},WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeTagClosing=function(t){this._autoCloseUnclosed(t,!0)},WYMeditor.XhtmlParser.prototype._autoCloseUnclosed=function(t,e){e=e||!1;if(this._Listener._open_tags)for(var i in this._Listener._open_tags){0<this._Listener._open_tags[i]&&this._Listener.shouldCloseTagAutomatically(i,t,e)&&this._callCloseTagListener(i,!0)}},WYMeditor.XhtmlParser.prototype.getTagReplacements=function(){return this._Listener.getTagReplacements()},WYMeditor.XhtmlParser.prototype.normalizeTag=function(t){t=t.replace(/^([\s<\/>]*)|([\s<\/>]*)$/gm,"").toLowerCase();var e=this._Listener.getTagReplacements();return e[t]?e[t]:t},WYMeditor.XhtmlParser.prototype.TagAttributes=function(t,e){return WYMeditor.LEXER_SPECIAL==e&&(this._current_attribute=t),!0},WYMeditor.XhtmlParser.prototype.DoubleQuotedAttribute=function(t,e){return WYMeditor.LEXER_UNMATCHED==e&&(this._tag_attributes[this._current_attribute]=t),!0},WYMeditor.XhtmlParser.prototype.SingleQuotedAttribute=function(t,e){return WYMeditor.LEXER_UNMATCHED==e&&(this._tag_attributes[this._current_attribute]=t),!0},WYMeditor.XhtmlParser.prototype.UnquotedAttribute=function(t){return this._tag_attributes[this._current_attribute]=t.replace(/^=/,""),!0},WYMeditor.XhtmlSaxListener=function(){return this.output="",this.helper=new WYMeditor.XmlHelper,this._open_tags={},this.validator=WYMeditor.XhtmlValidator,this._tag_stack=[],this.avoided_tags=["area"],this.entities={" ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"­","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","·":"·","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","×":"×","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","÷":"÷","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ƒ":"ƒ","ˆ":"ˆ","˜":"˜","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","ς":"ς","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"ϑ","ϒ":"ϒ","ϖ":"ϖ"," ":" "," ":" "," ":" ","‌":"‌","‍":"‍","‎":"‎","‏":"‏","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","…":"…","‰":"‰","′":"′","″":"″","‹":"‹","›":"›","‾":"‾","⁄":"⁄","€":"€","ℑ":"ℑ","℘":"℘","ℜ":"ℜ","™":"™","ℵ":"ℵ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"∏","∑":"∑","−":"−","∗":"∗","√":"√","∝":"∝","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"⋅","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","⟨":"〈","⟩":"〉","◊":"◊","♠":"♠","♣":"♣","♥":"♥","♦":"♦"},this.block_tags=["a","abbr","acronym","address","area","b","base","bdo","big","blockquote","body","button","caption","cite","code","col","colgroup","dd","del","div","dfn","dl","dt","em","fieldset","form","head","h1","h2","h3","h4","h5","h6","html","i","iframe","ins","kbd","label","legend","li","map","noscript","object","ol","optgroup","option","p","pre","q","samp","script","select","small","span","strong","style","sub","sup","table","tbody","td","textarea","tfoot","th","thead","title","tr","tt","ul","var","extends","meter","section","article","aside","details","header","footer","nav","dialog","figure","figcaption","address","hgroup","mark","time","canvas","audio","video","output","progress","ruby","rt","rp","summary","command"],this.inline_tags=["br","embed","hr","img","input","param","source","wbr"],this},WYMeditor.XhtmlSaxListener.prototype.shouldCloseTagAutomatically=function(t,e,i){i=i||!1;return!("td"!=t||!(i&&"tr"==e||!i&&"td"==e))||!("option"!=t||!(i&&"select"==e||!i&&"option"==e))},WYMeditor.XhtmlSaxListener.prototype.beforeParsing=function(t){return this.output="",t},WYMeditor.XhtmlSaxListener.prototype.afterParsing=function(t){return t=this.replaceNamedEntities(t),t=this.joinRepeatedEntities(t),t=this.removeEmptyTags(t)},WYMeditor.XhtmlSaxListener.prototype.replaceNamedEntities=function(t){for(var e in this.entities)t=t.replace(new RegExp(e,"g"),this.entities[e]);return t},WYMeditor.XhtmlSaxListener.prototype.joinRepeatedEntities=function(t){var e="em|strong|sub|sup|acronym|pre|del|address";return t.replace(new RegExp("</("+e+")><\\1>",""),"").replace(new RegExp("(s*<("+e+")>s*){2}(.*)(s*</\\2>s*){2}",""),"<$2>$3<$2>")},WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags=function(t){return t.replace(new RegExp("<("+this.block_tags.join("|").replace(/\|td/,"").replace(/\|th/,"")+")>(<br />| | |\\s)*</\\1>","g"),"")},WYMeditor.XhtmlSaxListener.prototype.removeBrInPre=function(t){var e=t.match(new RegExp("<pre[^>]*>(.*?)</pre>","gmi"));if(e)for(var i=0;i<e.length;i++)t=t.replace(e[i],e[i].replace(new RegExp("<br />","g"),String.fromCharCode(13,10)));return t},WYMeditor.XhtmlSaxListener.prototype.getResult=function(){return this.output},WYMeditor.XhtmlSaxListener.prototype.getTagReplacements=function(){return{b:"strong",i:"em"}},WYMeditor.XhtmlSaxListener.prototype.addContent=function(t){this.output+=t},WYMeditor.XhtmlSaxListener.prototype.addComment=function(t){this.remove_comments&&(this.output+=t)},WYMeditor.XhtmlSaxListener.prototype.addScript=function(t){this.remove_scripts||(this.output+=t)},WYMeditor.XhtmlSaxListener.prototype.addCss=function(t){this.remove_embeded_styles||(this.output+=t)},WYMeditor.XhtmlSaxListener.prototype.openBlockTag=function(t,e){this.output+=this.helper.tag(t,this.validator.getValidTagAttributes(t,e),!0)},WYMeditor.XhtmlSaxListener.prototype.inlineTag=function(t,e){this.output+=this.helper.tag(t,this.validator.getValidTagAttributes(t,e))},WYMeditor.XhtmlSaxListener.prototype.openUnknownTag=function(t,e){"area"===t&&(this.output+=this.helper.tag(t,e,!0))},WYMeditor.XhtmlSaxListener.prototype.closeBlockTag=function(t){this.output=this.output.replace(/<br \/>$/,"")+this._getClosingTagContent("before",t)+"</"+t+">"+this._getClosingTagContent("after",t)},WYMeditor.XhtmlSaxListener.prototype.closeUnknownTag=function(){},WYMeditor.XhtmlSaxListener.prototype.closeUnopenedTag=function(t){this.output+="</"+t+">"},WYMeditor.XhtmlSaxListener.prototype.avoidStylingTagsAndAttributes=function(){this.avoided_tags=["div","span"],this.validator.skipped_attributes=["style"],this.validator.skipped_attribute_values=["MsoNormal","main1"],this._avoiding_tags_implicitly=!0},WYMeditor.XhtmlSaxListener.prototype.allowStylingTagsAndAttributes=function(){this.avoided_tags=[],this.validator.skipped_attributes=[],this.validator.skipped_attribute_values=[],this._avoiding_tags_implicitly=!1},WYMeditor.XhtmlSaxListener.prototype.isBlockTag=function(t){return!WYMeditor.Helper.contains(this.avoided_tags,t)&&WYMeditor.Helper.contains(this.block_tags,t)},WYMeditor.XhtmlSaxListener.prototype.isInlineTag=function(t){return!WYMeditor.Helper.contains(this.avoided_tags,t)&&WYMeditor.Helper.contains(this.inline_tags,t)},WYMeditor.XhtmlSaxListener.prototype.insertContentAfterClosingTag=function(t,e){this._insertContentWhenClosingTag("after",t,e)},WYMeditor.XhtmlSaxListener.prototype.insertContentBeforeClosingTag=function(t,e){this._insertContentWhenClosingTag("before",t,e)},WYMeditor.XhtmlSaxListener.prototype.fixNestingBeforeOpeningBlockTag=function(t){"li"==t||"ul"!=t&&"ol"!=t||!this.last_tag||this.last_tag_opened||"li"!=this.last_tag||(this.output=this.output.replace(/<\/li>$/,""),this.insertContentAfterClosingTag(t,"</li>"))},WYMeditor.XhtmlSaxListener.prototype._insertContentWhenClosingTag=function(t,e,i){this["_insert_"+t+"_closing"]||(this["_insert_"+t+"_closing"]=[]),this["_insert_"+t+"_closing"][e]||(this["_insert_"+t+"_closing"][e]=[]),this["_insert_"+t+"_closing"][e].push(i)},WYMeditor.XhtmlSaxListener.prototype._getClosingTagContent=function(t,e){return this["_insert_"+t+"_closing"]&&this["_insert_"+t+"_closing"][e]&&0<this["_insert_"+t+"_closing"][e].length?this["_insert_"+t+"_closing"][e].pop():""},WYMeditor.WymCssLexer=function(t,e){e=void 0===e||e;return $.extend(this,new WYMeditor.Lexer(t,e?"Ignore":"WymCss")),this.mapHandler("WymCss","Ignore"),1==e&&(this.addEntryPattern("/\\*[<\\s]*WYMeditor[>\\s]*\\*/","Ignore","WymCss"),this.addExitPattern("/\\*[</\\s]*WYMeditor[>\\s]*\\*/","WymCss")),this.addSpecialPattern("[\\sa-z1-6]*\\.[a-z-_0-9]+","WymCss","WymCssStyleDeclaration"),this.addEntryPattern("/\\*","WymCss","WymCssComment"),this.addExitPattern("\\*/","WymCssComment"),this.addEntryPattern("{","WymCss","WymCssStyle"),this.addExitPattern("}","WymCssStyle"),this.addEntryPattern("/\\*","WymCssStyle","WymCssFeedbackStyle"),this.addExitPattern("\\*/","WymCssFeedbackStyle"),this},WYMeditor.WymCssParser=function(){return this._in_style=!1,this._has_title=!1,this.only_wym_blocks=!0,this.css_settings={classesItems:[],editorStyles:[],dialogStyles:[]},this},WYMeditor.WymCssParser.prototype.parse=function(t,e){e=void 0===e?this.only_wym_blocks:e;this._Lexer=new WYMeditor.WymCssLexer(this,e),this._Lexer.parse(t)},WYMeditor.WymCssParser.prototype.Ignore=function(){return!0},WYMeditor.WymCssParser.prototype.WymCssComment=function(t,e){return!t.match(/end[a-z0-9\s]*wym[a-z0-9\s]*/im)&&(e==WYMeditor.LEXER_UNMATCHED&&(this._in_style?this._current_item[this._current_element]&&(this._current_item[this._current_element].expressions?this._current_item[this._current_element].expressions.push(t):this._current_item[this._current_element].expressions=[t]):(this._has_title=!0,this._current_item={title:WYMeditor.Helper.trim(t)}),this._in_style=!0),!0)},WYMeditor.WymCssParser.prototype.WymCssStyle=function(t,e){return e==WYMeditor.LEXER_UNMATCHED?""!=(t=WYMeditor.Helper.trim(t))&&(this._current_item[this._current_element].style=t):e==WYMeditor.LEXER_EXIT&&(this._in_style=!1,this._has_title=!1,this.addStyleSetting(this._current_item)),!0},WYMeditor.WymCssParser.prototype.WymCssFeedbackStyle=function(t,e){return e==WYMeditor.LEXER_UNMATCHED&&(this._current_item[this._current_element].feedback_style=t.replace(/^([\s\/\*]*)|([\s\/\*]*)$/gm,"")),!0},WYMeditor.WymCssParser.prototype.WymCssStyleDeclaration=function(t){var e="";if(0<(t=t.replace(/^([\s\.]*)|([\s\.*]*)$/gm,"")).indexOf(".")){var i=t.split(".");this._current_element=i[1];e=i[0]}else this._current_element=t;return this._has_title||(this._current_item={title:(e?e.toUpperCase()+": ":"")+this._current_element},this._has_title=!0),this._current_item[this._current_element]||(this._current_item[this._current_element]={name:this._current_element}),e&&(this._current_item[this._current_element].tags?this._current_item[this._current_element].tags.push(e):this._current_item[this._current_element].tags=[e]),!0},WYMeditor.WymCssParser.prototype.addStyleSetting=function(t){for(var e in t){var i=t[e];"object"==typeof i&&"title"!=e&&(this.css_settings.classesItems.push({name:WYMeditor.Helper.trim(i.name),title:t.title,expr:WYMeditor.Helper.trim((i.expressions||i.tags).join(", "))}),i.feedback_style&&this.css_settings.editorStyles.push({name:"."+WYMeditor.Helper.trim(i.name),css:i.feedback_style}),i.style&&this.css_settings.dialogStyles.push({name:"."+WYMeditor.Helper.trim(i.name),css:i.style}))}},$.fn.isPhantomNode=function(){return 3==this[0].nodeType&&!/[^\t\n\r ]/.test(this[0].data)},WYMeditor.isPhantomNode=function(t){return 3==t.nodeType&&!/[^\t\n\r ]/.test(t.data)},WYMeditor.isPhantomString=function(t){return!/[^\t\n\r ]/.test(t)},$.fn.parentsOrSelf=function(t){var e=this;return 3==e[0].nodeType&&(e=e.parents().slice(0,1)),1==e.filter(t).size()?e:e.parents(t).slice(0,1)},WYMeditor.Helper={replaceAll:function(t,e,i){return t.replace(new RegExp(e,"g"),i)},insertAt:function(t,e,i){return t.substr(0,i)+e+t.substring(i)},trim:function(t){return t.replace(/^(\s*)|(\s*)$/gm,"")},contains:function(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},indexOf:function(t,e){for(var i=-1,s=0;s<t.length;s++)if(t[s]==e){i=s;break}return i},findByName:function(t,e){for(var i=0;i<t.length;i++){var s=t[i];if(s.name==e)return s}return null}},WYMeditor.XhtmlValidator={_attributes:{core:{except:["base","head","html","meta","param","script","style","title"],attributes:["class","id","style","title","accesskey",
"tabindex","data","^data-.*"]},language:{except:["base","br","hr","iframe","param","script"],attributes:{dir:["ltr","rtl"],0:"lang",1:"xml:lang"}},keyboard:{attributes:{accesskey:/^(\w){1}$/,tabindex:/^(\d)+$/}}},_events:{window:{only:["body"],attributes:["onload","onunload"]},form:{only:["form","input","textarea","select","a","label","button"],attributes:["onchange","onsubmit","onreset","onselect","onblur","onfocus"]},keyboard:{except:["base","bdo","br","frame","frameset","head","html","iframe","meta","param","script","style","title"],attributes:["onkeydown","onkeypress","onkeyup"]},mouse:{except:["base","bdo","br","head","html","meta","param","script","style","title"],attributes:["onclick","ondblclick","onmousedown","onmousemove","onmouseover","onmouseout","onmouseup"]}},_tags:{a:{attributes:{0:"charset",1:"coords",2:"href",3:"hreflang",4:"name",rel:/^(alternate|designates|stylesheet|start|next|nofollow|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon|moodalbox)+$/,rev:/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon|moodalbox)+$/,shape:/^(rect|rectangle|circ|circle|poly|polygon)$/,5:"type",target:/^(_blank)+$/}},0:"abbr",1:"acronym",2:"address",area:{attributes:{0:"alt",1:"coords",2:"href",nohref:/^(true|false)$/,shape:/^(rect|rectangle|circ|circle|poly|polygon)$/},required:["alt"]},3:"b",base:{attributes:["href"],required:["href"]},bdo:{attributes:{dir:/^(ltr|rtl)$/},required:["dir"]},4:"big",blockquote:{attributes:["cite"]},5:"body",6:"br",button:{attributes:{disabled:/^(disabled)$/,type:/^(button|reset|submit)$/,0:"value"},inside:"form"},7:"caption",8:"cite",9:"code",col:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",span:/^(\d)+$/,valign:/^(top|middle|bottom|baseline)$/,2:"width"},inside:"colgroup"},colgroup:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",span:/^(\d)+$/,valign:/^(top|middle|bottom|baseline)$/,2:"width"}},10:"dd",del:{attributes:{0:"cite",datetime:/^([0-9]){8}/}},11:"div",12:"dfn",13:"dl",14:"dt",15:"em",fieldset:{inside:"form"},form:{attributes:{0:"action",1:"accept",2:"accept-charset",3:"enctype",method:/^(get|post)$/},required:["action"]},head:{attributes:["profile"]},16:"h1",17:"h2",18:"h3",19:"h4",20:"h5",21:"h6",22:"hr",html:{attributes:["xmlns"]},23:"i",iframe:{attributes:["src","width","height","frameborder","scrolling","marginheight","marginwidth"],required:["src"]},img:{attributes:{align:/^(right|left|center|justify)$/,0:"alt",1:"src",2:"height",3:"ismap",4:"longdesc",5:"usemap",6:"width",7:"rel"},required:["alt","src"]},input:{attributes:{0:"accept",1:"alt",checked:/^(checked)$/,disabled:/^(disabled)$/,maxlength:/^(\d)+$/,2:"name",readonly:/^(readonly)$/,size:/^(\d)+$/,3:"src",type:/^(button|checkbox|file|hidden|image|password|radio|reset|submit|text|tel|search|url|email|datetime|date|month|week|time|datetime-local|number|range|color)$/,4:"value",5:"placeholder"},inside:"form"},ins:{attributes:{0:"cite",datetime:/^([0-9]){8}/}},24:"kbd",label:{attributes:["for"],inside:"form"},25:"legend",26:"li",link:{attributes:{0:"charset",1:"href",2:"hreflang",media:/^(all|braille|print|projection|screen|speech|,|;| )+$/i,
/*"rel":/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,*/
rel:/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|nofollow|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,rev:/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,3:"type"},inside:"head"},map:{attributes:["id","name"],required:["id"]},meta:{attributes:{0:"content","http-equiv":/^(content\-type|expires|refresh|set\-cookie)$/i,1:"name",2:"scheme"},required:["content"]},27:"noscript",28:"ol",optgroup:{attributes:{0:"label",disabled:/^(disabled)$/},required:["label"]},option:{attributes:{0:"label",disabled:/^(disabled)$/,selected:/^(selected)$/,1:"value"},inside:"select"},29:"p",param:{attributes:["type","value","name"],required:["name"],inside:"object"},embed:{attributes:["width","height","allowfullscreen","allowscriptaccess","wmode","type","src","flashvars"],inside:"object"},object:{attributes:["archive","classid","codebase","codetype","data","declare","height","name","standby","type","usemap","width"]},30:"pre",q:{attributes:["cite"]},31:"samp",script:{attributes:{type:/^(text\/ecmascript|text\/javascript|text\/jscript|text\/vbscript|text\/vbs|text\/xml)$/,0:"charset",defer:/^(defer)$/,1:"src"},required:["type"]},select:{attributes:{disabled:/^(disabled)$/,multiple:/^(multiple)$/,0:"name",1:"size"},inside:"form"},32:"small",33:"span",34:"strong",style:{attributes:{0:"type",media:/^(screen|tty|tv|projection|handheld|print|braille|aural|all)$/},required:["type"]},35:"sub",36:"sup",table:{attributes:{0:"border",1:"cellpadding",2:"cellspacing",frame:/^(void|above|below|hsides|lhs|rhs|vsides|box|border)$/,rules:/^(none|groups|rows|cols|all)$/,3:"summary",4:"width"}},tbody:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},td:{attributes:{0:"abbr",align:/^(left|right|center|justify|char)$/,1:"axis",2:"char",3:"charoff",colspan:/^(\d)+$/,4:"headers",rowspan:/^(\d)+$/,scope:/^(col|colgroup|row|rowgroup)$/,valign:/^(top|middle|bottom|baseline)$/}},textarea:{attributes:["cols","rows","disabled","name","readonly"],required:["cols","rows"],inside:"form"},tfoot:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom)$/,2:"baseline"}},th:{attributes:{0:"abbr",align:/^(left|right|center|justify|char)$/,1:"axis",2:"char",3:"charoff",colspan:/^(\d)+$/,4:"headers",rowspan:/^(\d)+$/,scope:/^(col|colgroup|row|rowgroup)$/,valign:/^(top|middle|bottom|baseline)$/}},thead:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},37:"title",tr:{attributes:{align:/^(right|left|center|justify|char)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},38:"tt",39:"ul",40:"var",41:"section",42:"article",43:"aside",44:"details",45:"header",46:"footer",47:"nav",48:"dialog",49:"figure",50:"figcaption",51:"address",52:"hgroup",53:"mark",54:"time",55:"canvas",56:"audio",57:"video",58:"source",59:"output",60:"progress",61:"ruby",62:"rt",63:"rp",64:"summary",65:"command",video:{attributes:{1:"poster",2:"width",3:"height",4:"source",5:"controls"}},source:{attributes:{1:"src",2:"type"}}},skipped_attributes:[],skipped_attribute_values:[],getValidTagAttributes:function(t,e){var i={},s=this.getPossibleTagAttributes(t),o=[];$.each(s||[],function(t,e){-1<e.indexOf("*")&&o.push(new RegExp(e))});var r=WYMeditor.Helper;for(var a in e){var n=e[a];r.contains(this.skipped_attributes,a)||r.contains(this.skipped_attribute_values,n)||"function"!=typeof n&&(r.contains(s,a)?this.doesAttributeNeedsValidation(t,a)?this.validateAttribute(t,a,n)&&(i[a]=n):i[a]=n:$.each(o,function(t,e){a.match(e)&&(i[a]=n)}))}return i},getUniqueAttributesAndEventsForTag:function(t){var e=[];if(this._tags[t]&&this._tags[t].attributes)for(k in this._tags[t].attributes)e.push(parseInt(k)==k?this._tags[t].attributes[k]:k);return e},getDefaultAttributesAndEventsForTags:function(){var t=[];for(var e in this._events)t.push(this._events[e]);for(var e in this._attributes)t.push(this._attributes[e]);return t},isValidTag:function(t){if(this._tags[t])return!0;for(var e in this._tags)if(this._tags[e]==t)return!0;return!1},getDefaultAttributesAndEventsForTag:function(t){var e=[];if(this.isValidTag(t)){var i=this.getDefaultAttributesAndEventsForTags();for(var s in i){var o=i[s];if("object"==typeof o){var r=WYMeditor.Helper;if(o.except&&r.contains(o.except,t)||o.only&&!r.contains(o.only,t))continue;var a=o.attributes?o.attributes:o.events;for(var n in a)e.push("string"!=typeof a[n]?n:a[n])}}}return e},doesAttributeNeedsValidation:function(t,e){return this._tags[t]&&(this._tags[t].attributes&&this._tags[t].attributes[e]||this._tags[t].required&&WYMeditor.Helper.contains(this._tags[t].required,e))},validateAttribute:function(t,e,i){return!(this._tags[t]&&this._tags[t].attributes&&this._tags[t].attributes[e]&&0<i.length&&!i.match(this._tags[t].attributes[e])||this._tags[t]&&this._tags[t].required&&WYMeditor.Helper.contains(this._tags[t].required,e)&&0==i.length)&&"undefined"!=typeof this._tags[t]},getPossibleTagAttributes:function(t){return this._possible_tag_attributes||(this._possible_tag_attributes={}),this._possible_tag_attributes[t]||(this._possible_tag_attributes[t]=this.getUniqueAttributesAndEventsForTag(t).concat(this.getDefaultAttributesAndEventsForTag(t))),this._possible_tag_attributes[t]}},
/*
* WYMeditor : what you see is What You Mean web-based editor
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
* Dual licensed under the MIT (MIT-license.txt)
* and GPL (GPL-license.txt) licenses.
*
* For further information visit:
* http://www.wymeditor.org/
*
* File Name:
* jquery.wymeditor.explorer.js
* MSIE specific class and functions.
* See the documentation for more info.
*
* File Authors:
* Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
* Bermi Ferrer (wymeditor a-t bermi dotorg)
* Frédéric Palluel-Lafleur (fpalluel a-t gmail dotcom)
* Jonatan Lundin (jonatan.lundin a-t gmail dotcom)
*/
WYMeditor.WymClassExplorer=function(t){this._wym=t,this._class="className",this._newLine="\r\n"},WYMeditor.WymClassExplorer.prototype.format_block=function(t){var e=this,i=t||e.selected()||$(e._iframe).contents().find("body").get(0),s=i.tagName.toLowerCase();-1<$.inArray(s,["strong","b","em","i","sub","sup","a"])&&(s=i.parentNode.tagName.toLowerCase()),s==WYMeditor.BODY&&(e._selected_image=null,$(e._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym"),e._exec(WYMeditor.FORMAT_BLOCK,"<"+WYMeditor.P+">"))},WYMeditor.WymClassExplorer.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,$("html",this._doc).attr("dir",this._options.direction),$("html",this._doc).addClass("ie"),$(this._doc.body).html(this._wym._html);var wym=this;this._doc.body.onfocus=function(){wym._doc.designMode="on",wym._doc=iframe.contentWindow.document},this._doc.onbeforedeactivate=function(){wym.saveCaret()},this._doc.onkeyup=function(){wym.saveCaret(),wym.keyup()},this._doc.onclick=function(){wym.saveCaret()},this._doc.body.onbeforepaste=function(){wym._iframe.contentWindow.event.returnValue=!1},this._doc.body.onpaste=function(){wym._iframe.contentWindow.event.returnValue=!1,wym.paste(window.clipboardData.getData("Text"))},this._initialized&&($.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),$.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()),this._initialized=!0,this._doc.designMode="on";try{this._doc=iframe.contentWindow.document}catch(e){}},WYMeditor.WymClassExplorer.prototype._exec=function(t,e){var i=this;switch(t){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var s=i.findUp(i.container(),WYMeditor.LI);if(s){var o=s.parentNode.parentNode;(1<s.parentNode.childNodes.length||-1<$.inArray(o.tagName.toLowerCase(),[WYMeditor.OL,WYMeditor.UL]))&&i._doc.execCommand(t)}break;default:e?i._doc.execCommand(t,!1,e):i._doc.execCommand(t)}},WYMeditor.WymClassExplorer.prototype.selected=function(){var t=this._iframe.contentWindow.document.caretPos;if(null!=t&&t.parentElement!=undefined)return t.parentElement()},WYMeditor.WymClassExplorer.prototype.saveCaret=function(){this._doc.caretPos=this._doc.selection.createRange()},WYMeditor.WymClassExplorer.prototype.addCssRule=function(t,e){t.addRule(e.name,e.css)},WYMeditor.WymClassExplorer.prototype.insert=function(t){var e=this._doc.selection.createRange();if($(e.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{e.pasteHTML(t)}catch(i){}else this.paste(t)},WYMeditor.WymClassExplorer.prototype.wrap=function(t,e){var i=this._doc.selection.createRange();if($(i.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{i.pasteHTML(t+i.text+e)}catch(s){}},WYMeditor.WymClassExplorer.prototype.unwrap=function(){var t=this._doc.selection.createRange();if($(t.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{var e=t.text;this._exec("Cut"),t.pasteHTML(e)}catch(i){}},WYMeditor.WymClassExplorer.prototype.keyup=function(){(wym=this)._selected_image=null,$(wym._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym"),wym.format_block()},WYMeditor.WymClassExplorer.prototype.setFocusToNode=function(t,e){(wym=this)._iframe.contentWindow.focus();var i=wym._doc.selection.createRange();e=!!e,i.moveToElementText(t),i.collapse(e),i.select(),t.focus()},
/*
* WYMeditor : what you see is What You Mean web-based editor
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
* Dual licensed under the MIT (MIT-license.txt)
* and GPL (GPL-license.txt) licenses.
*
* For further information visit:
* http://www.wymeditor.org/
*
* File Name:
* jquery.wymeditor.mozilla.js
* Gecko specific class and functions.
* See the documentation for more info.
*
* File Authors:
* Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
* Volker Mische (vmx a-t gmx dotde)
* Bermi Ferrer (wymeditor a-t bermi dotorg)
* Frédéric Palluel-Lafleur (fpalluel a-t gmail dotcom)
*/
WYMeditor.WymClassMozilla=function(t){this._wym=t,this._class="class",this._newLine="\n"},WYMeditor.WymClassMozilla.prototype.initIframe=function(iframe){var wym=this;this._iframe=iframe,this._doc=iframe.contentDocument;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,$("html",this._doc).attr("dir",this._options.direction),$(".fieldWithErrors iframe").contents().find("body").addClass("fieldWithErrors"),this.html(this._wym._html),this.enableDesignMode(),$.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),$(this._doc).bind("keydown",this.keydown),$(this._doc).bind("keyup",this.keyup),$(this._doc).bind("paste",this.intercept_paste),$(this._doc).bind("focus",function(){wym.enableDesignMode.call(wym)}),$.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassMozilla.prototype.html=function(t){if("string"!=typeof t)return $(this._doc.body).html();try{this._doc.designMode="off"}catch(e){}t=t.replace(/<em(\b[^>]*)>/gi,"<i$1>").replace(/<\/em>/gi,"</i>").replace(/<strong(\b[^>]*)>/gi,"<b$1>").replace(/<\/strong>/gi,"</b>"),$(this._doc.body).html(t),this.enableDesignMode()},WYMeditor.WymClassMozilla.prototype._exec=function(t,e){if(!this.selected())return!1;switch(t){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var i=this.selected(),s=this._iframe.contentWindow.getSelection().anchorNode;if("#text"==s.nodeName&&(s=s.parentNode),i=this.findUp(i,WYMeditor.BLOCKS),s=this.findUp(s,WYMeditor.BLOCKS),i&&i==s&&i.tagName.toLowerCase()==WYMeditor.LI){var o=i.parentNode.parentNode;(1<i.parentNode.childNodes.length||-1<$.inArray(o.tagName.toLowerCase(),[WYMeditor.OL,WYMeditor.UL]))&&this._doc.execCommand(t,"",null)}break;default:e?this._doc.execCommand(t,"",e):this._doc.execCommand(t,"",null)}this.selected().tagName.toLowerCase()==WYMeditor.BODY&&this._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)},WYMeditor.WymClassMozilla.prototype.selected=function(t){null!=t&&"true"==t.toString()||(t=!1);var e=this._iframe.contentWindow.getSelection(),s=e.focusNode;if(s){if("#text"==s.nodeName){if(t&&0<e.toString().length){if(actual_node=null,parent_node=e.focusNode.parentNode,null!=parent_node)for(i=0;i<parent_node.childNodes.length;i++)child_node=parent_node.childNodes[i],"#text"!=child_node.nodeName&&child_node.innerHTML==e.toString()&&(actual_node=child_node);return null==actual_node?this.switchTo(e,"span"):actual_node}return s.parentNode}return s}return null},WYMeditor.WymClassMozilla.prototype.addCssRule=function(t,e){t.insertRule(e.name+" {"+e.css+"}",t.cssRules.length)},WYMeditor.WymClassMozilla.prototype.keydown=function(t){var e=WYMeditor.INSTANCES[this.title];if(t.ctrlKey){if(66==t.keyCode)return e._exec(WYMeditor.BOLD),!1;if(73==t.keyCode)return e._exec(WYMeditor.ITALIC),!1}else 13==t.keyCode&&(t.shiftKey||(container=e.selected(),container&&container.tagName.toLowerCase()==WYMeditor.PRE&&(t.preventDefault(),e.insert("<p></p>"))))},WYMeditor.WymClassMozilla.prototype.keyup=function(t){if(null!=(wym=WYMeditor.INSTANCES[this.title])){wym._selected_image=null,$(wym._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym");var e=null;13!=t.keyCode||t.shiftKey?-1!=$.inArray(t.keyCode,[8,17,46,224])||t.metaKey||t.ctrlKey||wym.format_block():($(wym._doc.body).children(WYMeditor.BR).remove(),(e=wym.selected())&&e.tagName.toLowerCase()==WYMeditor.PRE&&wym._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P))}},WYMeditor.WymClassMozilla.prototype.enableDesignMode=function(){if("off"==this._doc.designMode)try{this._doc.designMode="on",this._doc.execCommand("styleWithCSS","",!1)}catch(t){}},WYMeditor.WymClassMozilla.prototype.openBlockTag=function(t,e){e=this.validator.getValidTagAttributes(t,e);if("span"===t&&e.style){var i=this.getTagForStyle(e.style);i&&(t=i,this._tag_stack.pop(),this._tag_stack.push(t),e.style="")}this.output+=this.helper.tag(t,e,!0)},WYMeditor.WymClassMozilla.prototype.getTagForStyle=function(t){return/bold/.test(t)?"strong":/italic/.test(t)?"em":/sub/.test(t)?"sub":!!/super/.test(t)&&"super"},
/*
* WYMeditor : what you see is What You Mean web-based editor
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
* Dual licensed under the MIT (MIT-license.txt)
* and GPL (GPL-license.txt) licenses.
*
* For further information visit:
* http://www.wymeditor.org/
*
* File Name:
* jquery.wymeditor.opera.js
* Opera specific class and functions.
* See the documentation for more info.
*
* File Authors:
* Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
*/
WYMeditor.WymClassOpera=function(t){this._wym=t,this._class="class",this._newLine="\r\n"},WYMeditor.WymClassOpera.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,$("html",this._doc).attr("dir",this._options.direction),this._doc.designMode="on",this.html(this._wym._html),$.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),$(this._doc).bind("keydown",this.keydown),$(this._doc).bind("keyup",this.keyup),$(this._doc).bind("paste",this.intercept_paste),$.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassOpera.prototype._exec=function(t,e){e?this._doc.execCommand(t,!1,e):this._doc.execCommand(t)},WYMeditor.WymClassOpera.prototype.selected=function(){var t=this._iframe.contentWindow.getSelection().focusNode;return t?"#text"==t.nodeName?t.parentNode:t:null},WYMeditor.WymClassOpera.prototype.addCssRule=function(t,e){t.insertRule(e.name+" {"+e.css+"}",t.cssRules.length)},WYMeditor.WymClassOpera.prototype.keydown=function(t){var e=WYMeditor.INSTANCES[this.title],i=e._iframe.contentWindow.getSelection();startNode=i.getRangeAt(0).startContainer,$(startNode).parentsOrSelf(WYMeditor.MAIN_CONTAINERS.join(","))[0]||$(startNode).parentsOrSelf("li")||t.keyCode==WYMeditor.KEY.ENTER||t.keyCode==WYMeditor.KEY.LEFT||t.keyCode==WYMeditor.KEY.UP||t.keyCode==WYMeditor.KEY.RIGHT||t.keyCode==WYMeditor.KEY.DOWN||t.keyCode==WYMeditor.KEY.BACKSPACE||t.keyCode==WYMeditor.KEY.DELETE||e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)},WYMeditor.WymClassOpera.prototype.keyup=function(){var t=WYMeditor.INSTANCES[this.title];t._selected_image=null,$(t._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym")},
/*
* WYMeditor : what you see is What You Mean web-based editor
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
* Dual licensed under the MIT (MIT-license.txt)
* and GPL (GPL-license.txt) licenses.
*
* For further information visit:
* http://www.wymeditor.org/
*
* File Name:
* jquery.wymeditor.safari.js
* Safari specific class and functions.
* See the documentation for more info.
*
* File Authors:
* Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
* Scott Lewis (lewiscot a-t gmail dotcom)
*/
WYMeditor.WymClassSafari=function(t){this._wym=t,this._class="class",this._newLine="\n"},WYMeditor.WymClassSafari.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentDocument;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,$("html",this._doc).attr("dir",this._options.direction),this._doc.designMode="on",this.html(this._wym._html),$.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),$(this._doc).bind("keydown",this.keydown),$(this._doc).bind("keyup",this.keyup),$(this._doc).bind("paste",this.intercept_paste),$.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassSafari.prototype._exec=function(t,e){var i=this;if(!i.selected())return!1;switch(t){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var s=i.selected(),o=i._iframe.contentWindow.getSelection().anchorNode;if("#text"==o.nodeName&&(o=o.parentNode),s=i.findUp(s,WYMeditor.BLOCKS),o=i.findUp(o,WYMeditor.BLOCKS),s&&s==o&&s.tagName.toLowerCase()==WYMeditor.LI){var r=s.parentNode.parentNode;(1<s.parentNode.childNodes.length||-1<$.inArray(r.tagName.toLowerCase(),[WYMeditor.OL,WYMeditor.UL]))&&i._doc.execCommand(t,"",null)}break;case WYMeditor.INSERT_ORDEREDLIST:case WYMeditor.INSERT_UNORDEREDLIST:this._doc.execCommand(t,"",null);s=this.selected();var a=this.findUp(s,WYMeditor.MAIN_CONTAINERS);a&&$(a).replaceWith($(a).html());break;default:e?this._doc.execCommand(t,"",e):this._doc.execCommand(t,"",null)}},WYMeditor.WymClassSafari.prototype.selected=function(t){null!=t&&"true"==t.toString()||(t=!1);var e=this._iframe.contentWindow.getSelection(),s=e.focusNode;if(s){if("#text"==s.nodeName){if(t&&0<e.toString().length){if(actual_node=null,parent_node=e.focusNode.parentNode,null!=parent_node)for(i=0;i<parent_node.childNodes.length;i++)child_node=parent_node.childNodes[i],child_node.textContent==e.toString()&&(actual_node=child_node.parentNode);return null==actual_node?(this._selected_item=this.switchTo(e,"span"),this._selected_item):actual_node}return s.parentNode}return s}return null},WYMeditor.WymClassSafari.prototype.toggleClass=function(t,e){var i=null;i=this._selected_image?$(this._selected_image):$(this.selected(!0)||this._selected_item),null!=e&&(i=$(i.parentsOrSelf(e))),i.toggleClass(t),i.attr(WYMeditor.CLASS)||i.removeAttr(this._class)},WYMeditor.WymClassSafari.prototype.addCssRule=function(t,e){t.insertRule(e.name+" {"+e.css+"}",t.cssRules.length)},WYMeditor.WymClassSafari.prototype.keydown=function(t){var e=WYMeditor.INSTANCES[this.title];t.ctrlKey?(66==t.keyCode&&(e._exec(WYMeditor.BOLD),t.preventDefault()),73==t.keyCode&&(e._exec(WYMeditor.ITALIC),t.preventDefault())):t.shiftKey&&13==t.keyCode&&(e._exec("InsertLineBreak"),t.preventDefault())},WYMeditor.WymClassSafari.prototype.keyup=function(t){var e=WYMeditor.INSTANCES[this.title];e._selected_image=null,$(e._iframe).contents().find(".selected_by_wym").removeClass("selected_by_wym");var i=null;13!=t.keyCode||t.shiftKey?-1!=$.inArray(t.keyCode,[8,17,46,224])||t.metaKey||t.ctrlKey||(i=e.selected())&&(name=i.tagName.toLowerCase())&&(-1<$.inArray(name,["strong","b","em","i","sub","sup","a","span"])&&(name=i.parentNode.tagName.toLowerCase()),-1<$.inArray(name,[WYMeditor.BODY,WYMeditor.DIV])&&e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)):($(e._doc.body).children(WYMeditor.BR).remove(),(i=e.selected())&&i.tagName.toLowerCase()==WYMeditor.PRE&&e._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P))},WYMeditor.WymClassSafari.prototype.openBlockTag=function(t,e){e=this.validator.getValidTagAttributes(t,e);if("span"==t&&e.style&&(new_tag=this.getTagForStyle(e.style),new_tag)){this._tag_stack.pop();t=new_tag;this._tag_stack.push(new_tag),e.style="","string"==typeof e["class"]&&(e["class"]=e["class"].replace(/apple-style-span/gi,""))}this.output+=this.helper.tag(t,e,!0)},WYMeditor.WymClassSafari.prototype.getTagForStyle=function(t){return/bold/.test(t)?"strong":/italic/.test(t)?"em":/sub/.test(t)?"sub":!!/super/.test(t)&&"sup"},onOpenDialog=function(){$(".ui-dialog").height()<$(window).height()&&(iframed()?$(parent.document.body).addClass("hide-overflow"):$(document.body).addClass("hide-overflow"))},onCloseDialog=function(){iframed()?$(parent.document.body).removeClass("hide-overflow"):$(document.body).removeClass("hide-overflow")},WYMeditor.onload_functions=[];var wymeditor_inputs=[],wymeditors_loaded=0;"undefined"==typeof custom_wymeditor_boot_options&&(custom_wymeditor_boot_options={});var form_actions="<div id='dialog-form-actions' class='form-actions'><div class='form-actions-left'><input id='submit_button' class='wym_submit button' type='submit' value='{Insert}' class='button' /><a href='' class='wym_cancel close_dialog button'>{Cancel}</a></div></div>",wymeditor_boot_options=$.extend({skin:"refinery",basePath:"/",wymPath:"/assets/wymeditor/jquery.refinery.wymeditor.js",cssSkinPath:"/assets/wymeditor/skins/",jsSkinPath:"/assets/wymeditor/skins/",langPath:"/assets/wymeditor/lang/",iframeBasePath:"/",classesItems:[{name:"text-align",rules:[{name:"left",title:"{Left}"},{name:"center",title:"{Center}"},{name:"right",title:"{Right}"},{name:"justify",title:"{Justify}"}],join:"-",title:"{Text_Align}"},{name:"image-align",rules:[{name:"left",title:"{Left}"},{name:"right",title:"{Right}"}],join:"-",title:"{Image_Align}"},{name:"font-size",rules:[{name:"small",title:"{Small}"},{name:"normal",title:"{Normal}"},{name:"large",title:"{Large}"}],join:"-",title:"{Font_Size}"}],containersItems:[{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:"p",title:"Paragraph",css:"wym_containers_p"}],toolsItems:[{name:"Bold",title:"Bold",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{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:"ToggleHtml",title:"HTML",css:"wym_tools_html"}],toolsHtml:"<ul class='wym_tools wym_section wym_buttons'>"+WYMeditor.TOOLS_ITEMS+"</ul>",toolsItemHtml:"<li class='"+WYMeditor.TOOL_CLASS+"'><a href='#' name='"+WYMeditor.TOOL_NAME+"' title='"+WYMeditor.TOOL_TITLE+"' class='no-tooltip'>"+WYMeditor.TOOL_TITLE+"</a></li>",classesHtml:"<ul class='wym_classes_container wym_section wym_buttons'><li class='wym_tools_class'><a href='#' name='"+WYMeditor.APPLY_CLASS+"' title='"+WYMeditor.APPLY_CLASS+"' class='no-tooltip'>"+WYMeditor.APPLY_CLASS+"</a><ul class='wym_classes wym_classes_hidden'>"+WYMeditor.CLASSES_ITEMS+"</ul></li></ul>",classesItemHtml:"<li><a href='#' name='"+WYMeditor.CLASS_NAME+"'>"+WYMeditor.CLASS_TITLE+"</a></li>",classesItemHtmlMultiple:"<li class='wym_tools_class_multiple_rules'><span>"+WYMeditor.CLASS_TITLE+"</span><ul>{classesItemHtml}</ul></li>",containersHtml:"<ul class='wym_containers wym_section'>"+WYMeditor.CONTAINERS_ITEMS+"</ul>",containersItemHtml:"<li class='"+WYMeditor.CONTAINER_CLASS+"'><a href='#' name='"+WYMeditor.CONTAINER_NAME+"' title='"+WYMeditor.CONTAINER_TITLE+"' class='no-tooltip'></a></li>",boxHtml:"<div class='wym_box'><div class='wym_area_top clearfix'>"+WYMeditor.CONTAINERS+WYMeditor.TOOLS+WYMeditor.CLASSES+"</div><div class='wym_area_main'>"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"</div></div>",iframeHtml:"<div class='wym_iframe wym_section'><iframe id='WYMeditor_"+WYMeditor.INDEX+"'"+($.browser.msie?" src='"+WYMeditor.IFRAME_BASE_PATH+"wymiframe'":"")+" frameborder='0' marginheight='0' marginwidth='0' border='0' onload='this.contentWindow.parent.WYMeditor.INSTANCES["+WYMeditor.INDEX+"].loadIframe(this);'></iframe></div>",dialogImageHtml:"",dialogLinkHtml:"",dialogTableHtml:"<div class='wym_dialog wym_dialog_table'><form><input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"+WYMeditor.DIALOG_TABLE+"' /><div class='field'><label for='wym_caption'>{Caption}</label><input type='text' id='wym_caption' class='wym_caption' value='' size='40' /></div><div class='field'><label for='wym_rows'>{Number_Of_Rows}</label><input type='text' id='wym_rows' class='wym_rows' value='3' size='3' /></div><div class='field'><label for='wym_cols'>{Number_Of_Cols}</label><input type='text' id='wym_cols' class='wym_cols' value='2' size='3' /></div>"+form_actions+"</form></div>",dialogPasteHtml:"<div class='wym_dialog wym_dialog_paste'><form><input type='hidden' id='wym_dialog_type' class='wym_dialog_type' value='"+WYMeditor.DIALOG_PASTE+"' /><div class='field'><textarea class='wym_text' rows='10' cols='50'></textarea></div>"+form_actions+"</form></div>",dialogPath:"/refinery/dialogs/",dialogFeatures:{width:866,height:455,modal:!0,draggable:!0,resizable:!1,autoOpen:!0,open:onOpenDialog,close:onCloseDialog},dialogInlineFeatures:{width:600,height:485,modal:!0,draggable:!0,resizable:!1,autoOpen:!0,open:onOpenDialog,close:onCloseDialog},dialogId:"editor_dialog",dialogHtml:"<!DOCTYPE html><html dir='"+WYMeditor.DIRECTION+"'><head><link rel='stylesheet' type='text/css' media='screen' href='"+WYMeditor.CSS_PATH+"' /><title>"+WYMeditor.DIALOG_TITLE+"</title><script type='text/javascript' src='"+WYMeditor.JQUERY_PATH+"'></script><script type='text/javascript' src='"+WYMeditor.WYM_PATH+"'></script></head><body><div id='page'>"+WYMeditor.DIALOG_BODY+"</div></body></html>",postInit:function(t){if(wymeditors_loaded+=1,WYMeditor.INSTANCES.length==wymeditors_loaded)for($(".wym_loading_overlay").remove(),i=0;i<WYMeditor.onload_functions.length;i++)WYMeditor.onload_functions[i]();$(t._iframe).contents().find("body").addClass("wym_iframe_body"),$(".field.hide-overflow").removeClass("hide-overflow").css("height","auto")},postInitDialog:function(){$.browser.msie&&($the_ui_dialog=$(".ui-dialog")).css("height",$the_ui_dialog.find("iframe").height()+$the_ui_dialog.find("iframe").contents().find(".form-actions").height()-12)},lang:refinery.current_admin_locale},custom_wymeditor_boot_options);WYMeditor.editor.prototype.loadIframe=function(t){var e=this,i=t.contentDocument||t.contentWindow;if(i.document&&(i=i.document),!$.browser.msie){i.open("text/html","replace"),html="<!DOCTYPE html> <html> <head> <title>WYMeditor</title> <meta charset='"+$("meta[charset]").attr("charset")+"' /> <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1' /> </head> <body class='wym_iframe'> </body> </html>",i.write(html),i.close();var s=i.head||$(i).find("head").get(0);$("<link href='/assets/wymeditor/skins/refinery/wymiframe-80caee6a424600a27d7803989c843a60.css' media='all' rel='stylesheet' />").appendTo(s),$("<link href='/assets/refinery/formatting-b44a4730207530562f26df85da80f491.css' media='all' rel='stylesheet' />").appendTo(s),$("<link href='/assets/refinery/theme-826827947dc7b4764fcddc0c4d777e60.css' media='all' rel='stylesheet' />").appendTo(s)}null!=(id_of_editor=e._element.parent().attr("id"))&&$(i.body).addClass(id_of_editor),e.initIframe(t)},WYMeditor.init=function(){(wymeditor_inputs=$(".wymeditor").filter(function(){for(i=0;i<WYMeditor.INSTANCES.length;i++)if(WYMeditor.INSTANCES[i]._element.attr("id")==$(this).attr("id"))return!1;return!0})).each(function(){0<(containing_field=$(this).parents(".field")).length&&""===containing_field.get(0).style.height.replace("auto","")&&containing_field.addClass("hide-overflow").css("height",$(this).outerHeight()-containing_field.offset().top+$(this).offset().top+45),$(this).hide()}),wymeditor_inputs.wymeditor(wymeditor_boot_options)},$(function(){WYMeditor.init()});
|