/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
HorizontalRule._pluginInfo={name:"HorizontalRule",version:"1.0",developer:"Nelson Bright",developer_url:"http://www.brightworkweb.com/",c_owner:"Nelson Bright",sponsor:"BrightWork, Inc.",sponsor_url:"http://www.brightworkweb.com/",license:"htmlArea"};function HorizontalRule(c){this.editor=c;var a=c.config;var d=a.toolbar;var b=this;a.registerButton({id:"edithorizontalrule",tooltip:this._lc("Insert/edit horizontal rule"),image:[_editor_url+"images/ed_buttons_main.gif",6,0],textMode:false,action:function(e){b.buttonPress(e)}});a.addToolbarElement("edithorizontalrule","inserthorizontalrule",0)}HorizontalRule.prototype._lc=function(a){return Xinha._lc(a,"HorizontalRule")};HorizontalRule.prototype.buttonPress=function(a){this.editor=a;this._editHorizontalRule()};HorizontalRule.prototype._editHorizontalRule=function(d){editor=this.editor;var c=editor._getSelection();var a=editor._createRange(c);var e=null;if(typeof d=="undefined"){d=editor.getParentElement();if(d&&!/^hr$/i.test(d.tagName)){d=null}}if(d){var b=d.style.width||d.width;e={f_size:parseInt(d.style.height,10)||d.size,f_widthUnit:(/(%|px)$/.test(b))?RegExp.$1:"px",f_width:parseInt(b,10),f_color:Xinha._colorToRgb(d.style.backgroundColor)||d.color,f_align:d.style.textAlign||d.align,f_noshade:(parseInt(d.style.borderWidth,10)==0)||d.noShade}}editor._popupDialog("plugin://HorizontalRule/edit_horizontal_rule.html",function(j){if(!j){return false}var g=d;if(!g){var f=editor._doc.createElement("hr");for(var i in j){var h=j[i];if(h==""){continue}switch(i){case"f_width":if(j.f_widthUnit=="%"){f.style.width=h+"%"}else{f.style.width=h+"px"}break;case"f_size":f.style.height=h+"px";break;case"f_align":f.style.textAlign=h;switch(h){case"left":f.style.marginLeft="0";break;case"right":f.style.marginRight="0";break;case"center":f.style.marginLeft="auto";f.style.marginRight="auto";break}break;case"f_color":f.style.backgroundColor=h;break;case"f_noshade":f.style.border="0";break}}if(Xinha.is_gecko){editor.execCommand("inserthtml",false,Xinha.getOuterHTML(f))}else{editor.insertNodeAtSelection(f)}}else{for(var i in j){var h=j[i];switch(i){case"f_width":if(j.f_widthUnit=="%"){g.style.width=h+"%"}else{g.style.width=h+"px"}break;case"f_size":g.style.height=h+"px";break;case"f_align":g.style.textAlign=h;switch(h){case"left":g.style.marginLeft="0";g.style.marginRight=null;break;case"right":g.style.marginRight="0";g.style.marginLeft=null;break;case"center":g.style.marginLeft="auto";g.style.marginRight="auto";break}break;case"f_color":g.style.backgroundColor=h;break;case"f_noshade":break}g.style.border=(j.f_noshade)?"0":null}}},e)};