var Facebox=Class.create({initialize:function(a){this.settings={loading_image:"/images/facebox/loading.gif",close_image:"/images/facebox/closelabel.gif",image_types:new RegExp("."+["png","jpg","jpeg","gif"].join("|")+"$","i"),inited:true,facebox_html:' '};if(a){Object.extend(this.settings,a)}$(document.body).insert({bottom:this.settings.facebox_html});this.preload=[new Image(),new Image()];this.preload[0].src=this.settings.close_image;this.preload[1].src=this.settings.loading_image;f=this;$$("#facebox .b:first, #facebox .bl, #facebox .br, #facebox .tl, #facebox .tr").each(function(b){f.preload.push(new Image());f.preload.slice(-1).src=b.getStyle("background-image").replace(/url\((.+)\)/,"$1")});this.facebox=$("facebox");this.keyPressListener=this.watchKeyPress.bindAsEventListener(this);this.watchClickEvents();fb=this;Event.observe($$("#facebox .close").first(),"click",function(b){Event.stop(b);fb.close()});Event.observe($$("#facebox .close_image").first(),"click",function(b){Event.stop(b);fb.close()})},watchKeyPress:function(a){if(a.keyCode==27||!Event.element(a).descendantOf(this.facebox)){this.close()}},watchClickEvents:function(b){var a=this;$$("a[rel=facebox]").each(function(d,c){Event.observe(d,"click",function(g){Event.stop(g);a.click_handler(d,g)})})},loading:function(){if($$("#facebox .loading").length==1){return true}contentWrapper=$$("#facebox .content").first();contentWrapper.childElements().each(function(c,b){c.remove()});contentWrapper.insert({bottom:'
'});var a=document.viewport.getScrollOffsets();this.facebox.setStyle({top:a.top+(document.viewport.getHeight()/10)+"px",left:document.viewport.getWidth()/2-(this.facebox.getWidth()/2)+"px"});Event.observe(document,"keypress",this.keyPressListener);Event.observe(document,"click",this.keyPressListener)},reveal:function(b,a){this.loading();load=$$("#facebox .loading").first();if(load){load.remove()}contentWrapper=$$("#facebox .content").first();if(a){contentWrapper.addClassName(a)}contentWrapper.update(b);$$("#facebox .body").first().childElements().each(function(d,c){d.show()});if(!this.facebox.visible()){new Effect.Appear(this.facebox,{duration:0.3})}this.facebox.setStyle({left:document.viewport.getWidth()/2-(this.facebox.getWidth()/2)+"px"});Event.observe(document,"keypress",this.keyPressListener);Event.observe(document,"click",this.keyPressListener)},close:function(){new Effect.Fade("facebox",{duration:0.3})},click_handler:function(c,i){this.loading();Event.stop(i);var k=c.rel.match(/facebox\[\.(\w+)\]/);if(k){k=k[1]}new Effect.Appear(this.facebox,{duration:0.3});if(c.href.match(/#/)){var a=window.location.href.split("#")[0];var j=c.href.replace(a+"#","");var l=$(j);var h=new Element(l.tagName);h.innerHTML=l.innerHTML;this.reveal(h,k)}else{if(c.href.match(this.settings.image_types)){var g=new Image();b=this;g.onload=function(){b.reveal('
',k)};g.src=c.href}else{var b=this;var a=c.href;new Ajax.Request(a,{method:"get",onFailure:function(d){b.reveal(d.responseText,k)},onSuccess:function(d){b.reveal(d.responseText,k)}})}}}});var facebox;document.observe("dom:loaded",function(){facebox=new Facebox()});var WysiHat={};WysiHat.Editor={attach:function(a,c,e){c=$H(c);a=$(a);a.hide();var b=c.get("model")||WysiHat.iFrame;var d=e;return b.create(a,function(h){var g=h.getDocument();var i=h.getWindow();h.load();Event.observe(i,"focus",function(j){h.focus()});Event.observe(i,"blur",function(j){h.blur()});h._observeEvents();if(Prototype.Browser.Gecko){h.execCommand("undo",false,null)}if(d){d(h)}h.focus()})},include:function(a){this.includedModules=this.includedModules||$A([]);this.includedModules.push(a)},extend:function(b){var a=this.includedModules||$A([]);a.each(function(c){Object.extend(b,c)})}};WysiHat.Commands=(function(){function h(){this.execCommand("bold",false,null)}function r(){return this.queryCommandState("bold")}function z(){this.execCommand("underline",false,null)}function s(){return this.queryCommandState("underline")}function n(){this.execCommand("italic",false,null)}function x(){return this.queryCommandState("italic")}function q(){this.execCommand("strikethrough",false,null)}function d(){this.execCommand("blockquote",false,null)}function m(A){this.execCommand("fontname",false,A)}function p(A){this.execCommand("fontsize",false,A)}function y(A){this.execCommand("forecolor",false,A)}function l(A){if(Prototype.Browser.Gecko){this.execCommand("hilitecolor",false,A)}else{this.execCommand("backcolor",false,A)}}function w(A){this.execCommand("justify"+A)}function b(){var A=this.selection.getNode();return Element.getStyle(A,"textAlign")}function g(A){this.execCommand("createLink",false,A)}function i(){var A=this.selection.getNode();if(this.linkSelected()){this.selection.selectNode(A)}this.execCommand("unlink",false,null)}function v(){var A=this.selection.getNode();return A?A.tagName.toUpperCase()=="A":false}function o(A){this.execCommand("formatblock",false,A)}function k(){this.execCommand("insertorderedlist",false,null)}function j(){this.execCommand("insertunorderedlist",false,null)}function c(A){this.execCommand("insertImage",false,A)}function a(B){if(Prototype.Browser.IE){var A=this._selection.getRange();A.pasteHTML(B);A.collapse(false);A.select()}else{this.execCommand("insertHTML",false,B)}}function t(E,D,C){var A=this.getDocument();if(Prototype.Browser.IE){this.selection.restore()}var B=this.commands.get(E);if(B){B.bind(this)(C)}else{A.execCommand(E,D,C)}}function e(C){var A=this.getDocument();var B=this.queryCommands.get(C);if(B){return B.bind(this)()}else{return A.queryCommandState(C)}}function u(){var B=$H({});var A=this;A.styleSelectors.each(function(C){var D=A.selection.getNode();B.set(C.first(),Element.getStyle(D,C.last()))});return B}return{boldSelection:h,boldSelected:r,underlineSelection:z,underlineSelected:s,italicSelection:n,italicSelected:x,strikethroughSelection:q,blockquoteSelection:d,fontSelection:m,fontSizeSelection:p,colorSelection:y,backgroundColorSelection:l,alignSelection:w,alignSelected:b,linkSelection:g,unlinkSelection:i,linkSelected:v,formatblockSelection:o,insertOrderedList:k,insertUnorderedList:j,insertImage:c,insertHTML:a,execCommand:t,queryCommandState:e,getSelectedStyles:u,commands:$H({}),queryCommands:$H({link:v}),styleSelectors:$H({fontname:"fontFamily",fontsize:"fontSize",forecolor:"color",hilitecolor:"backgroundColor",backcolor:"backgroundColor"})}})();WysiHat.Editor.include(WysiHat.Commands);WysiHat.Events=(function(){var a=["click","dblclick","mousedown","mouseup","mouseover","mousemove","mouseout","keypress","keydown","keyup"];function b(j,k){a.each(function(l){Event.observe(j,l,function(m){k.fire("wysihat:"+l)})})}function g(l,j,k){Event.observe(j,"keydown",function(m){if(m.keyCode==86){k.fire("wysihat:paste")}});Event.observe(l,"paste",function(m){k.fire("wysihat:paste")})}function c(k,j){Event.observe(k,"focus",function(l){j.fire("wysihat:focus")});Event.observe(k,"blur",function(l){j.fire("wysihat:blur")})}function i(j,k){Event.observe(j,"mouseup",function(m){var l=k.selection.getRange();if(!l.collapsed){k.fire("wysihat:select")}})}function e(j,k){var l=k.rawContent();Event.observe(j,"keyup",function(n){var m=k.rawContent();if(l!=m){k.fire("wysihat:change");l=m}})}function d(j,l){var m=l.selection.getRange();var k=function(o){var n=l.selection.getRange();if(m!=n){l.fire("wysihat:cursormove");m=n}};Event.observe(j,"keyup",k);Event.observe(j,"mouseup",k)}function h(){if(this._observers_setup){return}var j=this.getDocument();var k=this.getWindow();b(j,this);g(k,j,this);c(k,this);i(j,this);e(j,this);d(j,this);this._observers_setup=true}return{_observeEvents:h}})();WysiHat.Editor.include(WysiHat.Events);WysiHat.Persistence=(function(){function h(i){return i.formatHTMLOutput()}function a(i){return i.formatHTMLInput()}function e(){return this.outputFilter(this.rawContent())}function d(i){this.setRawContent(this.inputFilter(i))}function c(){this.textarea.value=this.content()}function g(){this.setContent(this.textarea.value)}function b(){this.selection.setBookmark();this.save();this.load();this.selection.moveToBookmark()}return{outputFilter:h,inputFilter:a,content:e,setContent:d,save:c,load:g,reload:b}})();WysiHat.Editor.include(WysiHat.Persistence);WysiHat.Window=(function(){function c(){return this.contentDocument||this.contentWindow.document}function b(){if(this.contentDocument&&this.contentDocument.defaultView){return this.contentDocument.defaultView}else{if(this.contentWindow.document){return this.contentWindow}else{return null}}}function a(){this.getWindow().focus();if(this.hasFocus){return}this.hasFocus=true}function d(){this.hasFocus=false}return{getDocument:c,getWindow:b,focus:a,blur:d}})();WysiHat.Editor.include(WysiHat.Window);WysiHat.iFrame={create:function(a,c){var b=new Element("iframe",{id:a.id+"_editor","class":"editor"});Object.extend(b,WysiHat.iFrame.Methods);WysiHat.Editor.extend(b);b.attach(a,c);a.insert({before:b});return b}};WysiHat.iFrame.Methods={attach:function(a,b){this.textarea=a;this.observe("load",function(){try{var c=this.getDocument()}catch(d){return}this.selection=new WysiHat.Selection(this);if(this.ready&&c.designMode=="on"){return}this.setStyle({});c.designMode="on";b(this);this.ready=true;this.fire("wysihat:ready")})},unattach:function(){this.remove()},whenReady:function(b){if(this.ready){b(this)}else{var a=this;a.observe("wysihat:ready",function(){b(a)})}return this},setStyle:function(e){var a=this.getDocument();var c=this;if(!this.ready){return setTimeout(function(){c.setStyle(e)},1)}if(Prototype.Browser.IE){var d=a.createStyleSheet();d.addRule("body","border: 0");d.addRule("p","margin: 0");$H(e).each(function(h){var g=h.first().underscore().dasherize()+": "+h.last();d.addRule("body",g)})}else{if(Prototype.Browser.Opera){var d=Element("style").update("p { margin: 0; }");var b=a.getElementsByTagName("head")[0];b.appendChild(d)}else{Element.setStyle(a.body,e)}}return this},getStyle:function(b){var a=this.getDocument();return Element.getStyle(a.body,b)},rawContent:function(){var a=this.getDocument();if(a.body){return a.body.innerHTML}else{return""}},setRawContent:function(b){var a=this.getDocument();if(a.body){a.body.innerHTML=b}}};WysiHat.Editable={create:function(a,c){var b=new Element("div",{id:a.id+"_editor","class":"editor",contenteditable:"true"});b.textarea=a;WysiHat.Editor.extend(b);Object.extend(b,WysiHat.Editable.Methods);c(b);a.insert({before:b});return b}};WysiHat.Editable.Methods={getDocument:function(){return document},getWindow:function(){return window},rawContent:function(){return this.innerHTML},setRawContent:function(a){this.innerHTML=a}};Object.extend(String.prototype,(function(){function a(){var k=String(this);k=k.tidyXHTML();if(Prototype.Browser.WebKit){k=k.replace(/(
)+/g,"\n");k=k.replace(/(<\/div>)+/g,"");k=k.replace(/

\s*<\/p>/g,"");k=k.replace(/
(\n)*/g,"\n")}else{if(Prototype.Browser.Gecko){k=k.replace(/

/g,"");k=k.replace(/<\/p>(\n)?/g,"\n");k=k.replace(/
(\n)*/g,"\n")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){k=k.replace(/

( | |\s)<\/p>/g,"

");k=k.replace(/
/g,"");k=k.replace(/

/g,"");k=k.replace(/ /g,"");k=k.replace(/<\/p>(\n)?/g,"\n");k=k.gsub(/^

/,"");k=k.gsub(/<\/p>$/,"")}}}k=k.gsub(//,"");k=k.gsub(/<\/b>/,"");k=k.gsub(//,"");k=k.gsub(/<\/i>/,"");k=k.replace(/\n\n+/g,"

\n\n

");k=k.gsub(/(([^\n])(\n))(?=([^\n]))/,"#{2}
\n");k="

"+k+"

";k=k.replace(/

\s*/g,"

");k=k.replace(/\s*<\/p>/g,"

");var e=Element("body");e.innerHTML=k;if(Prototype.Browser.WebKit||Prototype.Browser.Gecko){var j;do{j=false;e.select("span").each(function(i){if(i.hasClassName("Apple-style-span")){i.removeClassName("Apple-style-span");if(i.className==""){i.removeAttribute("class")}j=true}else{if(i.getStyle("fontWeight")=="bold"){i.setStyle({fontWeight:""});if(i.style.length==0){i.removeAttribute("style")}i.update(""+i.innerHTML+"");j=true}else{if(i.getStyle("fontStyle")=="italic"){i.setStyle({fontStyle:""});if(i.style.length==0){i.removeAttribute("style")}i.update(""+i.innerHTML+"");j=true}else{if(i.getStyle("textDecoration")=="underline"){i.setStyle({textDecoration:""});if(i.style.length==0){i.removeAttribute("style")}i.update(""+i.innerHTML+"");j=true}else{if(i.attributes.length==0){i.replace(i.innerHTML);j=true}}}}}})}while(j)}var h=$A(["BR","IMG"]);for(var d=0;d(\n)*/g,"
\n");k=k.replace(/<\/p>\n

/g,"

\n\n

");k=k.replace(/

\s*<\/p>/g,"");k=k.replace(/\s*$/g,"");return k}function b(){var e=String(this);var d=Element("body");d.innerHTML=e;if(Prototype.Browser.Gecko||Prototype.Browser.WebKit){d.select("strong").each(function(g){g.replace(''+g.innerHTML+"")});d.select("em").each(function(g){g.replace(''+g.innerHTML+"")});d.select("u").each(function(g){g.replace(''+g.innerHTML+"")})}if(Prototype.Browser.WebKit){d.select("span").each(function(g){if(g.getStyle("fontWeight")=="bold"){g.addClassName("Apple-style-span")}if(g.getStyle("fontStyle")=="italic"){g.addClassName("Apple-style-span")}if(g.getStyle("textDecoration")=="underline"){g.addClassName("Apple-style-span")}})}e=d.innerHTML;e=e.tidyXHTML();e=e.replace(/<\/p>(\n)*

/g,"\n\n");e=e.replace(/(\n)?(\n)?/g,"\n");e=e.replace(/^

/g,"");e=e.replace(/<\/p>$/g,"");if(Prototype.Browser.Gecko){e=e.replace(/\n/g,"
");e=e+"
"}else{if(Prototype.Browser.WebKit){e=e.replace(/\n/g,"

");e="
"+e+"
";e=e.replace(/
<\/div>/g,"

")}else{if(Prototype.Browser.IE||Prototype.Browser.Opera){e=e.replace(/\n/g,"

\n

");e="

"+e+"

";e=e.replace(/

<\/p>/g,"

 

");e=e.replace(/(

 <\/p>)+$/g,"")}}}return e}function c(){var d=String(this);d=d.gsub(/\r\n?/,"\n");d=d.gsub(/<([A-Z]+)([^>]*)>/,function(e){return"<"+e[1].toLowerCase()+e[2]+">"});d=d.gsub(/<\/([A-Z]+)>/,function(e){return""});d=d.replace(/
/g,"
");return d}return{formatHTMLOutput:a,formatHTMLInput:b,tidyXHTML:c}})());Object.extend(String.prototype,{sanitize:function(a){return Element("div").update(this).sanitize(a).innerHTML.tidyXHTML()}});Element.addMethods({sanitize:function(c,b){c=$(c);b=$H(b);var a=$A(b.get("tags")||[]);var d=$A(b.get("attributes")||[]);var e=Element(c.nodeName);$A(c.childNodes).each(function(i){if(i.nodeType==1){var g=$(i).sanitize(b).childNodes;if(a.include(i.nodeName.toLowerCase())){var h=Element(i.nodeName);d.each(function(j){if((value=i.readAttribute(j))){h.writeAttribute(j,value)}});e.appendChild(h);$A(g).each(function(j){h.appendChild(j)})}else{$A(g).each(function(j){e.appendChild(j)})}}else{if(i.nodeType==3){e.appendChild(i)}}});return e}});if(typeof Range=="undefined"){Range=function(a){this.ownerDocument=a;this.startContainer=this.ownerDocument.documentElement;this.startOffset=0;this.endContainer=this.ownerDocument.documentElement;this.endOffset=0;this.collapsed=true;this.commonAncestorContainer=this._commonAncestorContainer(this.startContainer,this.endContainer);this.detached=false;this.START_TO_START=0;this.START_TO_END=1;this.END_TO_END=2;this.END_TO_START=3};Range.CLONE_CONTENTS=0;Range.DELETE_CONTENTS=1;Range.EXTRACT_CONTENTS=2;if(!document.createRange){document.createRange=function(){return new Range(this)}}Object.extend(Range.prototype,(function(){function r(){return e(this,Range.CLONE_CONTENTS)}function x(){try{var z=new Range(this.ownerDocument);z.startContainer=this.startContainer;z.startOffset=this.startOffset;z.endContainer=this.endContainer;z.endOffset=this.endOffset;z.collapsed=this.collapsed;z.commonAncestorContainer=this.commonAncestorContainer;z.detached=this.detached;return z}catch(y){return null}}function b(y){if(y){this.endContainer=this.startContainer;this.endOffset=this.startOffset;this.collapsed=true}else{this.startContainer=this.endContainer;this.startOffset=this.endOffset;this.collapsed=true}}function a(z,E){try{var A,D,C,y;A=this.commonAncestorContainer;D=E.commonAncestorContainer;C=A;while(C.parentNode){C=C.parentNode}y=D;while(y.parentNode){y=y.parentNode}switch(z){case this.START_TO_START:return p(this,this.startContainer,this.startOffset,E.startContainer,E.startOffset);break;case this.START_TO_END:return p(this,this.startContainer,this.startOffset,E.endContainer,E.endOffset);break;case this.END_TO_END:return p(this,this.endContainer,this.endOffset,E.endContainer,E.endOffset);break;case this.END_TO_START:return p(this,this.endContainer,this.endOffset,E.startContainer,E.startOffset);break}}catch(B){}return null}function w(){try{e(this,Range.DELETE_CONTENTS)}catch(y){}}function v(){this.detached=true}function o(){try{return e(this,Range.EXTRACT_CONTENTS)}catch(y){return null}}function k(y){try{var C,z,B;switch(this.startContainer.nodeType){case Node.CDATA_SECTION_NODE:case Node.TEXT_NODE:z=this.startContainer.splitText(this.startOffset);this.startContainer.parentNode.insertBefore(y,z);break;default:if(this.startContainer.childNodes.length==0){B=null}else{B=this.startContainer.childNodes(this.startOffset)}this.startContainer.insertBefore(y,B)}}catch(A){}}function d(y){this.setStartBefore(y);this.setEndAfter(y)}function u(y){this.setStart(y,0);this.setEnd(y,y.childNodes.length)}function q(y,C){try{var z,B;this.startContainer=y;this.startOffset=C;z=this.endContainer;while(z.parentNode){z=z.parentNode}B=this.startContainer;while(B.parentNode){B=B.parentNode}if(B!=z){this.collapse(true)}else{if(p(this,this.startContainer,this.startOffset,this.endContainer,this.endOffset)>0){this.collapse(true)}}this.collapsed=t(this);this.commonAncestorContainer=s(this.startContainer,this.endContainer)}catch(A){}}function n(y){this.setStart(y.parentNode,h(y)+1)}function j(y){this.setStart(y.parentNode,h(y))}function i(y,A){try{this.endContainer=y;this.endOffset=A;endRootContainer=this.endContainer;while(endRootContainer.parentNode){endRootContainer=endRootContainer.parentNode}startRootContainer=this.startContainer;while(startRootContainer.parentNode){startRootContainer=startRootContainer.parentNode}if(startRootContainer!=endRootContainer){this.collapse(false)}else{if(p(this,this.startContainer,this.startOffset,this.endContainer,this.endOffset)>0){this.collapse(false)}}this.collapsed=t(this);this.commonAncestorContainer=s(this.startContainer,this.endContainer)}catch(z){}}function g(y){this.setEnd(y.parentNode,h(y)+1)}function l(y){this.setEnd(y.parentNode,h(y))}function m(z){try{var B,y;while(z.firstChild){z.removeChild(z.firstChild)}y=this.extractContents();this.insertNode(z);z.appendChild(y);this.selectNode(z)}catch(A){}}function p(D,B,E,z,C){var G,A,y,F,H;if(B==z){if(E==C){return 0}else{if(E"+l.get("label")+"");m.addClassName(l.get("name"));n.appendChild(m);return m}function k(m,l){if(l.handler){return l.handler}else{if(l.get("handler")){return l.get("handler")}else{return function(n){n.execCommand(m)}}}}function g(l,m){var n=this;l.observe("click",function(o){m(n.editor);n.editor.fire("wysihat:change");n.editor.fire("wysihat:cursormove");Event.stop(o)})}function c(m,l){if(l.query){return l.query}else{if(l.get("query")){return l.get("query")}else{return function(n){return n.queryCommandState(m)}}}}function h(n,m,o){var p=this;var l=false;p.editor.observe("wysihat:cursormove",function(q){var r=o(p.editor);if(r!=l){l=r;p.updateButtonState(n,m,r)}})}function b(m,l,n){if(n){m.addClassName("selected")}else{m.removeClassName("selected")}}return{initialize:e,createToolbarElement:a,addButtonSet:d,addButton:j,createButtonElement:i,buttonHandler:k,observeButtonClick:g,buttonStateHandler:c,observeStateChanges:h,updateButtonState:b}})());WysiHat.Toolbar.ButtonSets={};WysiHat.Toolbar.ButtonSets.Basic=$A([{label:"Bold"},{label:"Underline"},{label:"Italic"}]);var editors=[];var WysihatHelper={faceboxFile:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});var b=facebox;var a="/wysihat_files/?editor="+this.id;new Ajax.Request(a,{method:"get",onFailure:function(c){b.reveal(c.responseText,null)},onSuccess:function(c){b.reveal(c.responseText,null)}})},faceboxFilez:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});var b=facebox;var a="/wysihat_files/?type=file&editor="+this.id;new Ajax.Request(a,{method:"get",onFailure:function(c){b.reveal(c.responseText,null)},onSuccess:function(c){b.reveal(c.responseText,null)}})},faceboxLink:function(){if(this.linkSelected()){this.unlinkSelection()}else{facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('',null);Event.observe("link_field","change",function(a){iframe.linkSelection($("link_field").value)})}},faceboxHTML:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('",null);Event.observe("html_editor","change",function(a){iframe.contentWindow.document.body.innerHTML=$("html_editor").value})},faceboxPaste:function(){facebox.loading();new Effect.Appear($("facebox"),{duration:0.3});iframe=this;facebox.reveal('',null);Event.observe("paste_editor","change",function(a){iframe.contentWindow.document.body.innerHTML=iframe.contentWindow.document.body.innerHTML+$("paste_editor").value.escapeHTML()})}};function wysiHatify(d,c){WysiHat.Editor.include(WysihatHelper);var a=WysiHat.Editor.attach(d);var b=new WysiHat.Toolbar(a);editors.push(a);$$("form").each(function(e){e.onsubmit=function(){editors.each(function(g){g.save()})}});c.each(function(e){switch(e.toLowerCase()){case"image":b.addButton({label:e.gsub("_","-").camelize().capitalize(),handler:function(g){return g.faceboxFile(g)}});break;case"file":b.addButton({label:e.gsub("_","-").camelize().capitalize(),handler:function(g){return g.faceboxFilez(g)}});break;case"link":b.addButton({label:e.gsub("_","-").camelize().capitalize(),handler:function(g){return g.faceboxLink(g)}});break;case"html":b.addButton({label:e.gsub("_","-").camelize().capitalize(),handler:function(g){return g.faceboxHTML(g)}});break;case"paste":b.addButton({label:e.gsub("_","-").camelize().capitalize(),handler:function(g){return g.faceboxPaste(g)}});break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":case"p":b.addButton({label:e.gsub("_","-").camelize().capitalize(),handler:function(g){return g.formatblockSelection(e.toLowerCase())}});break;default:b.addButton({label:e.gsub("_","-").camelize().capitalize()})}})};