function __(a){return a}function $BK(a){"string"==typeof a&&(a=document.getElementById(a));return a&&!a.appendTo?bkExtend(a,bkElement.prototype):a}function bkClass(){}var bkExtend=function(){var a=arguments;1==a.length&&(a=[this,a[0]]);for(var b in a[1])a[0][b]=a[1][b];return a[0]};bkClass.prototype.construct=function(){};
bkClass.extend=function(a){var b=function(){if(arguments[0]!==bkClass)return this.construct.apply(this,arguments)},c=new this(bkClass);bkExtend(c,a);b.prototype=c;b.extend=this.extend;return b};
var bkElement=bkClass.extend({construct:function(a,b){"string"==typeof a&&(a=(b||document).createElement(a));return a=$BK(a)},appendTo:function(a){a.appendChild(this);return this},appendBefore:function(a){a.parentNode.insertBefore(this,a);return this},addEvent:function(a,b){bkLib.addEvent(this,a,b);return this},setContent:function(a){this.innerHTML=a;return this},pos:function(){var a=curtop=0;obj=this;if(obj.offsetParent){do a+=obj.offsetLeft,curtop+=obj.offsetTop;while(obj=obj.offsetParent)}var b=
window.opera?0:parseInt(this.getStyle("border-width")||this.style.border)||0;return[a+b,curtop+b+this.offsetHeight]},noSelect:function(){bkLib.noSelect(this);return this},parentTag:function(a){var b=this;do{if(b&&b.nodeName&&b.nodeName.toUpperCase()==a)return b;b=b.parentNode}while(b);return!1},hasClass:function(a){return this.className.match(RegExp("(\\s|^)owEdit-"+a+"(\\s|$)"))},addClass:function(a){this.hasClass(a)||(this.className+=" owEdit-"+a);return this},removeClass:function(a){this.hasClass(a)&&
(this.className=this.className.replace(RegExp("(\\s|^)owEdit-"+a+"(\\s|$)")," "));return this},setStyle:function(a){var b=this.style,c;for(c in a)switch(c){case "float":b.cssFloat=b.styleFloat=a[c];break;case "opacity":b.opacity=a[c];b.filter="alpha(opacity="+Math.round(100*a[c])+")";break;case "className":this.className=a[c];break;default:b[c]=a[c]}return this},getStyle:function(a,b){var c=b?b:document.defaultView;if(1==this.nodeType)return c&&c.getComputedStyle?c.getComputedStyle(this,null).getPropertyValue(a):
this.currentStyle[bkLib.camelize(a)]},remove:function(){this.parentNode.removeChild(this);return this},setAttributes:function(a){for(var b in a)this[b]=a[b];return this}}),bkLib={isMSIE:-1!=navigator.appVersion.indexOf("MSIE"),addEvent:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},toArray:function(a){for(var b=a.length,c=Array(b);b--;)c[b]=a[b];return c},noSelect:function(a){a.setAttribute&&("input"!=a.nodeName.toLowerCase()&&"textarea"!=a.nodeName.toLowerCase())&&
a.setAttribute("unselectable","on");for(var b=0;b<a.childNodes.length;b++)bkLib.noSelect(a.childNodes[b])},camelize:function(a){return a.replace(/\-(.)/g,function(a,c){return c.toUpperCase()})},inArray:function(a,b){return null!=bkLib.search(a,b)},search:function(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return c;return null},cancelEvent:function(a){a=a||window.event;a.preventDefault&&a.stopPropagation&&(a.preventDefault(),a.stopPropagation());return!1},domLoad:[],domLoaded:function(){if(!arguments.callee.done)for(arguments.callee.done=
!0,i=0;i<bkLib.domLoad.length;i++)bkLib.domLoad[i]()},onDomLoaded:function(a){this.domLoad.push(a);document.addEventListener?document.addEventListener("DOMContentLoaded",bkLib.domLoaded,null):bkLib.isMSIE&&(document.write("<style>.owEdit-main p { margin: 0; }</style><script id=__ie_onload defer "+("https:"==location.protocol?"src='javascript:void(0)'":"src=//0")+">\x3c/script>"),$BK("__ie_onload").onreadystatechange=function(){"complete"==this.readyState&&bkLib.domLoaded()});window.onload=bkLib.domLoaded}},
bkEvent={addEvent:function(a,b){b&&(this.eventList=this.eventList||{},this.eventList[a]=this.eventList[a]||[],this.eventList[a].push(b));return this},fireEvent:function(){var a=bkLib.toArray(arguments),b=a.shift();if(this.eventList&&this.eventList[b])for(var c=0;c<this.eventList[b].length;c++)this.eventList[b][c].apply(this,a)}};Function.prototype.closure=function(){var a=this,b=bkLib.toArray(arguments),c=b.shift();return function(){if("undefined"!=typeof bkLib)return a.apply(c,b.concat(bkLib.toArray(arguments)))}};
Function.prototype.closureListener=function(){var a=this,b=bkLib.toArray(arguments),c=b.shift();return function(d){d=d||window.event;return a.apply(c,[d,d.target?d.target:d.srcElement].concat(b))}};
var owEditorConfig=bkClass.extend({buttons:{bold:{name:__("Gras"),command:"Bold",tags:["B","STRONG"],css:{"font-weight":"bold"},key:"b"},italic:{name:__("Italique"),command:"Italic",tags:["EM","I"],css:{"font-style":"italic"},key:"i"},underline:{name:__("Souligner"),command:"Underline",tags:["U"],css:{"text-decoration":"underline"},key:"u"},left:{name:__("Alignement \u00e0 gauche"),command:"justifyleft",noActive:!0},center:{name:__("Centrer"),command:"justifycenter",noActive:!0},right:{name:__("Alignement \u00e0 droite"),
command:"justifyright",noActive:!0},justify:{name:__("Alignement justifi\u00e9"),command:"justifyfull",noActive:!0},ol:{name:__("Liste num\u00e9rot\u00e9e"),command:"insertorderedlist",tags:["OL"]},ul:{name:__("Liste simple"),command:"insertunorderedlist",tags:["UL"]},subscript:{name:__("Mettre en exposant"),command:"subscript",tags:["SUB"]},superscript:{name:__("Mettre en indice"),command:"superscript",tags:["SUP"]},strikethrough:{name:__("Rayer"),command:"strikeThrough",css:{"text-decoration":"line-through"}},
removeformat:{name:__("Retirer le formatage"),command:"removeformat",noActive:!0},indent:{name:__("Indenter"),command:"indent",noActive:!0},outdent:{name:__("Retirer l'indentation"),command:"outdent",noActive:!0},hr:{name:__("Ligne horizontale"),command:"insertHorizontalRule",noActive:!0}},iconsPath:"owEditor/owEditor.gif",buttonList:"save bold italic underline left center right justify ol ul fontSize fontFamily fontFormat indent outdent image upload link unlink forecolor bgcolor".split(" "),iconList:{xhtml:1,
bgcolor:2,forecolor:3,bold:4,center:5,hr:6,indent:7,italic:8,justify:9,left:10,ol:11,outdent:12,removeformat:13,right:14,save:25,strikethrough:16,subscript:17,superscript:18,ul:19,underline:20,image:21,link:22,unlink:23,close:24,arrow:26,upload:27}}),owEditors={owPlugins:[],editors:[],registerPlugin:function(a,b){this.owPlugins.push({p:a,o:b})},allTextAreas:function(a){for(var b=document.getElementsByTagName("textarea"),c=0;c<b.length;c++)owEditors.editors.push((new owEditor(a)).panelInstance(b[c]));
return owEditors.editors},findEditor:function(a){for(var b=owEditors.editors,c=0;c<b.length;c++)if(b[c].instanceById(a))return b[c].instanceById(a)}},owEditor=bkClass.extend({construct:function(a){this.options=new owEditorConfig;bkExtend(this.options,a);this.owInstances=[];this.loadedPlugins=[];a=owEditors.owPlugins;for(var b=0;b<a.length;b++)this.loadedPlugins.push(new a[b].p(this,a[b].o));owEditors.editors.push(this);bkLib.addEvent(document.body,"mousedown",this.selectCheck.closureListener(this))},
panelInstance:function(a,b){a=this.checkReplace($BK(a));var c=(new bkElement("DIV")).setStyle({width:(parseInt(a.getStyle("width"))||a.clientWidth)+"px"}).appendBefore(a);this.setPanel(c);return this.addInstance(a,b)},checkReplace:function(a){var b=owEditors.findEditor(a);b&&(b.removeInstance(a),b.removePanel());return a},addInstance:function(a,b){a=this.checkReplace($BK(a));var c=a.contentEditable||window.opera?new owEditorInstance(a,b,this):new owEditorIFrameInstance(a,b,this);this.owInstances.push(c);
return this},removeInstance:function(a){a=$BK(a);for(var b=this.owInstances,c=0;c<b.length;c++)b[c].e==a&&(b[c].remove(),this.owInstances.splice(c,1))},removePanel:function(a){this.owPanel&&(this.owPanel.remove(),this.owPanel=null)},instanceById:function(a){a=$BK(a);for(var b=this.owInstances,c=0;c<b.length;c++)if(b[c].e==a)return b[c]},setPanel:function(a){this.owPanel=new owEditorPanel($BK(a),this.options,this);this.fireEvent("panel",this.owPanel);return this},owCommand:function(a,b){this.selectedInstance&&
this.selectedInstance.owCommand(a,b)},getIcon:function(a,b){var c=this.options.iconList[a],d=b.iconFiles?b.iconFiles[a]:"";return{backgroundImage:"url('"+(c?this.options.iconsPath:d)+"')",backgroundPosition:(c?-18*(c-1):0)+"px 0px"}},selectCheck:function(a,b){do if(b.className&&-1!=b.className.indexOf("owEdit"))return!1;while(b=b.parentNode);this.fireEvent("blur",this.selectedInstance,b);this.lastSelectedInstance=this.selectedInstance;this.selectedInstance=null;return!1}}),owEditor=owEditor.extend(bkEvent),
owEditorInstance=bkClass.extend({isSelected:!1,construct:function(a,b,c){this.ne=c;this.elm=this.e=a;this.options=b||{};newX=parseInt(a.getStyle("width"))||a.clientWidth;newY=parseInt(a.getStyle("height"))||a.clientHeight;this.initialHeight=newY-8;if((c="textarea"==a.nodeName.toLowerCase())||this.options.hasPanel){b=bkLib.isMSIE&&!("undefined"!=typeof document.body.style.maxHeight&&"CSS1Compat"==document.compatMode);var d={width:newX+"px",backgroundColor:"#fff",borderTop:0,overflowY:"auto",overflowX:"hidden"};
d[b?"height":"maxHeight"]=this.ne.options.maxHeight?this.ne.options.maxHeight+"px":null;this.editorContain=(new bkElement("DIV")).setStyle(d).appendBefore(a);d=(new bkElement("DIV")).setStyle({margin:"4px",minHeight:newY+"px"}).addClass("main").appendTo(this.editorContain);d.setAttribute("id","owEdit-main");a.setStyle({display:"none"});d.innerHTML=a.innerHTML;c&&(d.setContent(a.value),this.copyElm=a,(a=a.parentTag("FORM"))&&bkLib.addEvent(a,"submit",this.saveContent.closure(this)));d.setStyle(b?{height:newY+
"px"}:{overflow:"hidden"});this.elm=d}this.ne.addEvent("blur",this.blur.closure(this));this.init();this.blur()},init:function(){this.elm.setAttribute("contentEditable","true");""==this.getContent()&&this.setContent("<br />");this.instanceDoc=document.defaultView;this.elm.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keypress",this.keyDown.closureListener(this)).addEvent("focus",this.selected.closure(this)).addEvent("blur",this.blur.closure(this)).addEvent("keyup",this.selected.closure(this));
this.ne.fireEvent("add",this)},remove:function(){this.saveContent();if(this.copyElm||this.options.hasPanel)this.editorContain.remove(),this.e.setStyle({display:"block"}),this.ne.removePanel();this.disable();this.ne.fireEvent("remove",this)},disable:function(){this.elm.setAttribute("contentEditable","false")},getSel:function(){return window.getSelection?window.getSelection():document.selection},getRng:function(){var a=this.getSel();return a?0<a.rangeCount?a.getRangeAt(0):a.createRange():null},selRng:function(a,
b){window.getSelection?(b.removeAllRanges(),b.addRange(a)):a.select()},selElm:function(){var a=this.getRng();if(a.startContainer){var b=a.startContainer;if(1==a.cloneContents().childNodes.length)for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c].ownerDocument.createRange();d.selectNode(b.childNodes[c]);if(1!=a.compareBoundaryPoints(Range.START_TO_START,d)&&-1!=a.compareBoundaryPoints(Range.END_TO_END,d))return $BK(b.childNodes[c])}return $BK(b)}return $BK("Control"==this.getSel().type?a.item(0):
a.parentElement())},saveRng:function(){this.savedRange=this.getRng();this.savedSel=this.getSel()},restoreRng:function(){this.savedRange&&this.selRng(this.savedRange,this.savedSel)},keyDown:function(a,b){a.ctrlKey&&this.ne.fireEvent("key",this,a)},selected:function(a,b){b||(b=this.selElm());if(!a.ctrlKey){var c=this.ne.selectedInstance;c!=this&&(c&&this.ne.fireEvent("blur",c,b),this.ne.selectedInstance=this,this.ne.fireEvent("focus",c,b));this.ne.fireEvent("selected",c,b);this.isFocused=!0;this.elm.addClass("selected")}return!1},
blur:function(){this.isFocused=!1;this.elm.removeClass("selected")},saveContent:function(){if(this.copyElm||this.options.hasPanel)this.ne.fireEvent("save",this),this.copyElm?this.copyElm.value=this.getContent():this.e.innerHTML=this.getContent()},getElm:function(){return this.elm},getContent:function(){this.content=this.getElm().innerHTML;this.ne.fireEvent("get",this);return"<br />"==this.content||"<br />"==this.content?"":this.content},setContent:function(a){this.content=a;this.ne.fireEvent("set",
this);this.elm.innerHTML=this.content},owCommand:function(a,b){document.execCommand(a,!1,b)}}),owEditorIFrameInstance=owEditorInstance.extend({savedStyles:[],init:function(){var a=this.elm.innerHTML.replace(/^\s+|\s+$/g,"");this.elm.innerHTML="";a?a:a="<br />";this.initialContent=a;this.elmFrame=(new bkElement("iframe")).setAttributes({src:"javascript:;",frameBorder:0,allowTransparency:"true",scrolling:"no"}).setStyle({height:"100px"}).addClass("frame").appendTo(this.elm);this.copyElm&&this.elmFrame.setStyle({width:this.elm.offsetWidth-
4+"px"});a=["font-size","font-family","font-weight","color"];for(itm in a)this.savedStyles[bkLib.camelize(itm)]=this.elm.getStyle(itm);setTimeout(this.initFrame.closure(this),50)},disable:function(){this.elm.innerHTML=this.getContent()},initFrame:function(){var a=$BK(this.elmFrame.contentWindow.document);a.designMode="on";a.open();var b=this.ne.options.externalCSS;a.write("<html><head>"+(b?'<link href="'+b+'" rel="stylesheet" type="text/css" />':"")+'</head><body id="owEditContent" style="margin: 0 !important; background-color: transparent !important;">'+
this.initialContent+"</body></html>");a.close();this.frameDoc=a;this.frameWin=$BK(this.elmFrame.contentWindow);this.frameContent=$BK(this.frameWin.document.body).setStyle(this.savedStyles);this.instanceDoc=this.frameWin.document.defaultView;this.heightUpdate();this.frameDoc.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keyup",this.heightUpdate.closureListener(this)).addEvent("keydown",this.keyDown.closureListener(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",
this)},getElm:function(){return this.frameContent},setContent:function(a){this.content=a;this.ne.fireEvent("set",this);this.frameContent.innerHTML=this.content;this.heightUpdate()},getSel:function(){return this.frameWin?this.frameWin.getSelection():this.frameDoc.selection},heightUpdate:function(){this.elmFrame.style.height=Math.max(this.frameContent.offsetHeight,this.initialHeight)+"px"},owCommand:function(a,b){this.frameDoc.execCommand(a,!1,b);setTimeout(this.heightUpdate.closure(this),100)}}),owEditorPanel=
bkClass.extend({construct:function(a,b,c){this.elm=a;this.options=b;this.ne=c;this.panelButtons=[];this.buttonList=bkExtend([],this.ne.options.buttonList);this.panelContain=(new bkElement("DIV")).setStyle({overflow:"hidden"}).addClass("panelContain");this.panelElm=(new bkElement("DIV")).setStyle({margin:"2px",marginTop:"0px",zoom:1,overflow:"hidden"}).addClass("panel").appendTo(this.panelContain);this.panelContain.appendTo(a);b=this.ne.options;c=b.buttons;for(button in c)this.addButton(button,b,!0);
this.reorder();a.noSelect()},addButton:function(a,b,c){c=b.buttons[a];c=c.type?eval("(typeof("+c.type+') == "undefined") ? null : '+c.type+";"):owEditorButton;var d=bkLib.inArray(this.buttonList,a);c&&(d||this.ne.options.fullPanel)&&(this.panelButtons.push(new c(this.panelElm,a,b,this.ne)),d||this.buttonList.push(a))},findButton:function(a){for(var b=0;b<this.panelButtons.length;b++)if(this.panelButtons[b].name==a)return this.panelButtons[b]},reorder:function(){for(var a=this.buttonList,b=0;b<a.length;b++){var c=
this.findButton(a[b]);c&&this.panelElm.appendChild(c.margin)}},remove:function(){this.elm.remove()}}),owEditorButton=bkClass.extend({construct:function(a,b,c,d){this.options=c.buttons[b];this.name=b;this.ne=d;this.elm=a;this.margin=(new bkElement("DIV")).setStyle({"float":"left",marginTop:"2px"}).appendTo(a);this.contain=(new bkElement("DIV")).setStyle({width:"20px",height:"20px"}).addClass("buttonContain").appendTo(this.margin);this.border=(new bkElement("DIV")).setStyle({backgroundColor:"#fff",
border:"1px solid #efefef"}).appendTo(this.contain);this.button=(new bkElement("DIV")).setStyle({width:"18px",height:"18px",overflow:"hidden",zoom:1,cursor:"pointer"}).addClass("button").setStyle(this.ne.getIcon(b,c)).appendTo(this.border);this.button.addEvent("mouseover",this.hoverOn.closure(this)).addEvent("mouseout",this.hoverOff.closure(this)).addEvent("mousedown",this.mouseClick.closure(this)).noSelect();window.opera||(this.button.onmousedown=this.button.onclick=bkLib.cancelEvent);d.addEvent("selected",
this.enable.closure(this)).addEvent("blur",this.disable.closure(this)).addEvent("key",this.key.closure(this));this.disable();this.init()},init:function(){},hide:function(){this.contain.setStyle({display:"none"})},updateState:function(){this.isDisabled?this.setBg():this.isHover?this.setBg("hover"):this.isActive?this.setBg("active"):this.setBg()},setBg:function(a){switch(a){case "hover":var b={border:"1px solid #666",backgroundColor:"#ddd"};break;case "active":b={border:"1px solid #666",backgroundColor:"#ccc"};
break;default:b={border:"1px solid #efefef",backgroundColor:"#efefef"}}this.border.setStyle(b).addClass("button-"+a)},checkNodes:function(a){var b=a;do if(this.options.tags&&bkLib.inArray(this.options.tags,b.nodeName))return this.activate(),!0;while(b=b.parentNode&&"owEdit"!=b.className);for(b=$BK(a);3==b.nodeType;)b=$BK(b.parentNode);if(this.options.css)for(itm in this.options.css)if(b.getStyle(itm,this.ne.selectedInstance.instanceDoc)==this.options.css[itm])return this.activate(),!0;this.deactivate();
return!1},activate:function(){this.isDisabled||(this.isActive=!0,this.updateState(),this.ne.fireEvent("buttonActivate",this))},deactivate:function(){this.isActive=!1;this.updateState();this.isDisabled||this.ne.fireEvent("buttonDeactivate",this)},enable:function(a,b){this.isDisabled=!1;this.contain.setStyle({opacity:1}).addClass("buttonEnabled");this.updateState();this.checkNodes(b)},disable:function(a,b){this.isDisabled=!0;this.contain.setStyle({opacity:0.6}).removeClass("buttonEnabled");this.updateState()},
toggleActive:function(){this.isActive?this.deactivate():this.activate()},hoverOn:function(){this.isDisabled||(this.isHover=!0,this.updateState(),this.ne.fireEvent("buttonOver",this))},hoverOff:function(){this.isHover=!1;this.updateState();this.ne.fireEvent("buttonOut",this)},mouseClick:function(){this.options.command&&(this.ne.owCommand(this.options.command,this.options.commandArgs),this.options.noActive||this.toggleActive());this.ne.fireEvent("buttonClick",this)},key:function(a,b){this.options.key&&
(b.ctrlKey&&String.fromCharCode(b.keyCode||b.charCode).toLowerCase()==this.options.key)&&(this.mouseClick(),b.preventDefault&&b.preventDefault())}}),owPlugin=bkClass.extend({construct:function(a,b){this.options=b;this.ne=a;this.ne.addEvent("panel",this.loadPanel.closure(this));this.init()},loadPanel:function(a){var b=this.options.buttons,c;for(c in b)a.addButton(c,this.options);a.reorder()},init:function(){}}),owPaneOptions={},owEditorPane=bkClass.extend({construct:function(a,b,c,d){this.ne=b;this.elm=
a;this.pos=a.pos();this.contain=(new bkElement("div")).setStyle({zIndex:"99999",overflow:"hidden",position:"absolute",left:this.pos[0]+"px",top:this.pos[1]+"px"});this.pane=(new bkElement("div")).setStyle({fontSize:"12px",border:"1px solid #ccc",overflow:"hidden",padding:"4px",textAlign:"left",backgroundColor:"#ffffc9"}).addClass("pane").setStyle(c).appendTo(this.contain);d&&!d.options.noClose&&(this.close=(new bkElement("div")).setStyle({"float":"right",height:"16px",width:"16px",cursor:"pointer"}).setStyle(this.ne.getIcon("close",
owPaneOptions)).addEvent("mousedown",d.removePane.closure(this)).appendTo(this.pane));this.contain.noSelect().appendTo(document.body);this.position();this.init()},init:function(){},position:function(){if(this.ne.owPanel){var a=this.ne.owPanel.elm,a=a.pos()[0]+parseInt(a.getStyle("width"))-(parseInt(this.pane.getStyle("width"))+8);a<this.pos[0]&&this.contain.setStyle({left:a+"px"})}},toggle:function(){this.isVisible=!this.isVisible;this.contain.setStyle({display:this.isVisible?"block":"none"})},remove:function(){this.contain&&
(this.contain.remove(),this.contain=null)},append:function(a){a.appendTo(this.pane)},setContent:function(a){this.pane.setContent(a)}}),owEditorAdvancedButton=owEditorButton.extend({init:function(){this.ne.addEvent("selected",this.removePane.closure(this)).addEvent("blur",this.removePane.closure(this))},mouseClick:function(){this.isDisabled||(this.pane&&this.pane.pane?this.removePane():(this.pane=new owEditorPane(this.contain,this.ne,{width:this.width||"270px",backgroundColor:"#fff"},this),this.addPane(),
this.ne.selectedInstance.saveRng()))},addForm:function(a,b){this.form=(new bkElement("form")).addEvent("submit",this.submit.closureListener(this));this.pane.append(this.form);this.inputs={};for(itm in a){var c=a[itm],d="";b&&(d=b.getAttribute(itm));d||(d=c.value||"");var f=a[itm].type;if("title"==f)(new bkElement("div")).setContent(c.txt).setStyle({fontSize:"14px",fontWeight:"bold",padding:"0px",margin:"2px 0"}).appendTo(this.form);else{var e=(new bkElement("div")).setStyle({overflow:"hidden",clear:"both"}).appendTo(this.form);
c.txt&&(new bkElement("label")).setAttributes({"for":itm}).setContent(c.txt).setStyle({margin:"2px 4px",fontSize:"13px",width:"50px",lineHeight:"20px",textAlign:"right","float":"left"}).appendTo(e);switch(f){case "text":this.inputs[itm]=(new bkElement("input")).setAttributes({id:itm,value:d,type:"text"}).setStyle({margin:"2px 0",fontSize:"13px","float":"left",height:"20px",border:"1px solid #ccc",overflow:"hidden"}).setStyle(c.style).appendTo(e);break;case "select":this.inputs[itm]=(new bkElement("select")).setAttributes({id:itm}).setStyle({border:"1px solid #ccc",
"float":"left",margin:"2px 0"}).appendTo(e);for(opt in c.options)(new bkElement("option")).setAttributes({value:opt,selected:opt==d?"selected":""}).setContent(c.options[opt]).appendTo(this.inputs[itm]);break;case "content":this.inputs[itm]=(new bkElement("textarea")).setAttributes({id:itm}).setStyle({border:"1px solid #ccc","float":"left"}).setStyle(c.style).appendTo(e),this.inputs[itm].value=d}}}(new bkElement("input")).setAttributes({type:"submit"}).setStyle({backgroundColor:"#efefef",border:"1px solid #ccc",
margin:"3px 0","float":"left",clear:"both"}).appendTo(this.form);this.form.onsubmit=bkLib.cancelEvent},submit:function(){},findElm:function(a,b,c){a=this.ne.selectedInstance.getElm().getElementsByTagName(a);for(var d=0;d<a.length;d++)if(a[d].getAttribute(b)==c)return $BK(a[d])},removePane:function(){this.pane&&(this.pane.remove(),this.pane=null,this.ne.selectedInstance.restoreRng())}}),owButtonTips=bkClass.extend({construct:function(a){this.ne=a;a.addEvent("buttonOver",this.show.closure(this)).addEvent("buttonOut",
this.hide.closure(this))},show:function(a){this.timer=setTimeout(this.create.closure(this,a),400)},create:function(a){this.timer=null;this.pane||(this.pane=new owEditorPane(a.button,this.ne,{fontSize:"12px",marginTop:"5px"}),this.pane.setContent(a.options.name))},hide:function(a){this.timer&&clearTimeout(this.timer);this.pane&&(this.pane=this.pane.remove())}});owEditors.registerPlugin(owButtonTips);
var owSelectOptions={buttons:{fontSize:{name:__("Taille"),type:"owEditorFontSizeSelect",command:"fontsize"},fontFamily:{name:__("Famille"),type:"owEditorFontFamilySelect",command:"fontname"},fontFormat:{name:__("Format"),type:"owEditorFontFormatSelect",command:"formatBlock"}}},owEditorSelect=bkClass.extend({construct:function(a,b,c,d){this.options=c.buttons[b];this.elm=a;this.ne=d;this.name=b;this.selOptions=[];this.margin=(new bkElement("div")).setStyle({"float":"left",margin:"2px 1px 0 1px"}).appendTo(this.elm);
this.contain=(new bkElement("div")).setStyle({width:"90px",height:"20px",cursor:"pointer",overflow:"hidden"}).addClass("selectContain").addEvent("click",this.toggle.closure(this)).appendTo(this.margin);this.items=(new bkElement("div")).setStyle({overflow:"hidden",zoom:1,border:"1px solid #ccc",paddingLeft:"3px",backgroundColor:"#fff"}).appendTo(this.contain);this.control=(new bkElement("div")).setStyle({overflow:"hidden","float":"right",height:"18px",width:"16px"}).addClass("selectControl").setStyle(this.ne.getIcon("arrow",
c)).appendTo(this.items);this.txt=(new bkElement("div")).setStyle({overflow:"hidden","float":"left",width:"66px",height:"14px",marginTop:"1px",fontFamily:"sans-serif",textAlign:"center",fontSize:"12px"}).addClass("selectTxt").appendTo(this.items);window.opera||(this.contain.onmousedown=this.control.onmousedown=this.txt.onmousedown=bkLib.cancelEvent);this.margin.noSelect();this.ne.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this));this.disable();this.init()},
disable:function(){this.isDisabled=!0;this.close();this.contain.setStyle({opacity:0.6})},enable:function(a){this.isDisabled=!1;this.close();this.contain.setStyle({opacity:1})},setDisplay:function(a){this.txt.setContent(a)},toggle:function(){this.isDisabled||(this.pane?this.close():this.open())},open:function(){this.pane=new owEditorPane(this.items,this.ne,{width:"88px",padding:"0px",borderTop:0,borderLeft:"1px solid #ccc",borderRight:"1px solid #ccc",borderBottom:"0px",backgroundColor:"#fff"});for(var a=
0;a<this.selOptions.length;a++){var b=this.selOptions[a],c=(new bkElement("div")).setStyle({overflow:"hidden",borderBottom:"1px solid #ccc",width:"88px",textAlign:"left",overflow:"hidden",cursor:"pointer"}),d=(new bkElement("div")).setStyle({padding:"0px 4px"}).setContent(b[1]).appendTo(c).noSelect();d.addEvent("click",this.update.closure(this,b[0])).addEvent("mouseover",this.over.closure(this,d)).addEvent("mouseout",this.out.closure(this,d)).setAttributes("id",b[0]);this.pane.append(c);window.opera||
(d.onmousedown=bkLib.cancelEvent)}},close:function(){this.pane&&(this.pane=this.pane.remove())},over:function(a){a.setStyle({backgroundColor:"#ccc"})},out:function(a){a.setStyle({backgroundColor:"#fff"})},add:function(a,b){this.selOptions.push([a,b])},update:function(a){this.ne.owCommand(this.options.command,a);this.close()}}),owEditorFontSizeSelect=owEditorSelect.extend({sel:{1:"1 (8pt)",2:"2 (10pt)",3:"3 (12pt)",4:"4 (14pt)",5:"5 (18pt)",6:"6 (24pt)"},init:function(){this.setDisplay("Taille...");
for(itm in this.sel)this.add(itm,'<font size="'+itm+'">'+this.sel[itm]+"</font>")}}),owEditorFontFamilySelect=owEditorSelect.extend({sel:{arial:"Arial","comic sans ms":"Comic Sans","courier new":"Courier New",georgia:"Georgia",helvetica:"Helvetica",impact:"Impact","times new roman":"Times","trebuchet ms":"Trebuchet",verdana:"Verdana"},init:function(){this.setDisplay("Famille...");for(itm in this.sel)this.add(itm,'<font face="'+itm+'">'+this.sel[itm]+"</font>")}}),owEditorFontFormatSelect=owEditorSelect.extend({sel:{p:"Paragraph",
pre:"Pre",h6:"Heading 6",h5:"Heading 5",h4:"Heading 4",h3:"Heading 3",h2:"Heading 2",h1:"Heading 1"},init:function(){this.setDisplay("Format...");for(itm in this.sel){var a=itm.toUpperCase();this.add("<"+a+">","<"+itm+' style="padding: 0px; margin: 0px;">'+this.sel[itm]+"</"+a+">")}}});owEditors.registerPlugin(owPlugin,owSelectOptions);
var owLinkOptions={buttons:{link:{name:"Ajouter un lien",type:"owLinkButton",tags:["A"]},unlink:{name:"Retirer un lien",command:"unlink",noActive:!0}}},owLinkButton=owEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open In",options:{"":"Current Window",_blank:"New Window"},
style:{width:"100px"}}},this.ln)},submit:function(a){a=this.inputs.href.value;if("http://"==a||""==a)return alert("You must enter a URL to Create a Link"),!1;this.removePane();this.ln||(this.ne.owCommand("createlink","javascript:owTemp();"),this.ln=this.findElm("A","href","javascript:owTemp();"));this.ln&&this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value})}});
owEditors.registerPlugin(owPlugin,owLinkOptions);
var owColorOptions={buttons:{forecolor:{name:__("Changer couleur du texte"),type:"owEditorColorButton",noClose:!0},bgcolor:{name:__("Changer couleur du fond de texte"),type:"owEditorBgColorButton",noClose:!0}}},owEditorColorButton=owEditorAdvancedButton.extend({addPane:function(){var a={0:"00",1:"33",2:"66",3:"99",4:"CC",5:"FF"},b=(new bkElement("DIV")).setStyle({width:"270px"}),c;for(c in a)for(var d in a)for(var f in a){var e="#"+a[c]+a[f]+a[d],g=(new bkElement("DIV")).setStyle({cursor:"pointer",
height:"15px","float":"left"}).appendTo(b),l=(new bkElement("DIV")).setStyle({border:"2px solid "+e}).appendTo(g),e=(new bkElement("DIV")).setStyle({backgroundColor:e,overflow:"hidden",width:"11px",height:"11px"}).addEvent("click",this.colorSelect.closure(this,e)).addEvent("mouseover",this.on.closure(this,l)).addEvent("mouseout",this.off.closure(this,l,e)).appendTo(l);window.opera||(g.onmousedown=e.onmousedown=bkLib.cancelEvent)}this.pane.append(b.noSelect())},colorSelect:function(a){this.ne.owCommand("foreColor",
a);this.removePane()},on:function(a){a.setStyle({border:"2px solid #000"})},off:function(a,b){a.setStyle({border:"2px solid "+b})}}),owEditorBgColorButton=owEditorColorButton.extend({colorSelect:function(a){this.ne.owCommand("hiliteColor",a);this.removePane()}});owEditors.registerPlugin(owPlugin,owColorOptions);
var owImageOptions={buttons:{image:{name:"Ajouter une image",type:"owImageButton",tags:["IMG"]}}},owImageButton=owEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Ajouter/Editer une image"},src:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},alt:{type:"text",txt:"Desc.",style:{width:"100px"}},align:{type:"select",txt:"Align.",options:{none:"Basique",left:"Gauche",right:"Droite"}}},this.im)},
submit:function(a){a=this.inputs.src.value;if(""==a||"http://"==a)return alert("You must enter a Image URL to insert"),!1;this.removePane();this.im||(this.ne.owCommand("insertImage","javascript:owImTemp();"),this.im=this.findElm("IMG","src","javascript:owImTemp();"));this.im&&this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}});owEditors.registerPlugin(owPlugin,owImageOptions);
var owSaveOptions={buttons:{save:{name:__("Sauvegarder le contenu"),type:"owEditorSaveButton"}}},owEditorSaveButton=owEditorButton.extend({init:function(){this.ne.options.onSave||this.margin.setStyle({display:"none"})},mouseClick:function(){var a=this.ne.options.onSave,b=this.ne.selectedInstance;a(b.getContent(),b.elm.id,b)}});owEditors.registerPlugin(owPlugin,owSaveOptions);
var owUploadOptions={buttons:{upload:{name:"Uploader une image",type:"owUploadButton"}}},owUploadButton=owEditorAdvancedButton.extend({owURI:"owEditor/upload.php",addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.myID=Math.round(Math.random()*Math.pow(10,15));this.requestInterval=1E3;this.uri=this.ne.options.uploadURI||this.owURI;owUploadButton.lastPlugin=this;this.myFrame=(new bkElement("iframe")).setAttributes({height:"100px",frameBorder:0,scrolling:"no"}).setStyle({border:0}).appendTo(this.pane.pane);
this.progressWrapper=(new bkElement("div")).setStyle({display:"none",height:"20px",border:"1px solid #ccc"}).appendTo(this.pane.pane);this.progress=(new bkElement("div")).setStyle({width:"0%",height:"20px",backgroundColor:"#ccc"}).setContent("&nbsp").appendTo(this.progressWrapper);setTimeout(this.addForm.closure(this),50)},addForm:function(){var a=this.myDoc=this.myFrame.contentWindow.document;a.open();a.write("<html><body>");a.write('<form method="post" action="'+this.uri+"?id="+this.myID+'" enctype="multipart/form-data">');
a.write('<input type="hidden" name="APC_UPLOAD_PROGRESS" value="'+this.myID+'" />');a.write('<div style="font-size: 14px; font-weight: bold; padding-top: 5px;">Inserer une image</div>');a.write('<input name="owImage" type="file" style="margin-top: 10px;" />');a.write("</form>");a.write("</body></html>");a.close();this.myBody=a.body;this.myForm=$BK(this.myBody.getElementsByTagName("form")[0]);this.myInput=$BK(this.myBody.getElementsByTagName("input")[1]).addEvent("change",this.startUpload.closure(this));
this.myStatus=(new bkElement("div",this.myDoc)).setStyle({textAlign:"center",fontSize:"14px"}).appendTo(this.myBody)},startUpload:function(){this.myForm.setStyle({display:"none"});this.myStatus.setContent('<img src="owEditor/loader.gif" style="float: right; margin-right: 40px;" /><strong>Upload en cours...</strong><br />Patientez...');this.myForm.submit();setTimeout(this.makeRequest.closure(this),this.requestInterval)},makeRequest:function(){if(this.pane&&this.pane.pane){owUploadButton.lastPlugin=
this;var a=(new bkElement("script")).setAttributes({type:"text/javascript",src:this.uri+"?check="+this.myID+"&rand="+Math.round(Math.random()*Math.pow(10,15))}).addEvent("load",function(){a.parentNode.removeChild(a)}).appendTo(document.getElementsByTagName("head")[0]);this.requestInterval&&setTimeout(this.makeRequest.closure(this),this.requestInterval)}},setProgress:function(a){this.progressWrapper.setStyle({display:"block"});this.progress.setStyle({width:a+"%"})},update:function(a){if(!1==a)this.progressWrapper.setStyle({display:"none"});
else if(a.url){this.setProgress(100);this.requestInterval=!1;this.im||(this.ne.selectedInstance.restoreRng(),this.ne.owCommand("insertImage","javascript:owImTemp();"),this.im=this.findElm("IMG","src","javascript:owImTemp();"));var b=parseInt(this.ne.selectedInstance.elm.getStyle("width"));this.im&&this.im.setAttributes({src:a.url,width:b&&a.width?Math.min(b,a.width):""});this.removePane()}else if(a.error)this.requestInterval=!1,this.setProgress(100),alert("There was an error uploading your image ("+
a.error+")."),this.removePane();else if(a.noprogress){if(this.progressWrapper.setStyle({display:"none"}),-1==this.uri.indexOf("http:")||-1!=this.uri.indexOf(window.location.host))this.requestInterval=!1}else this.setProgress(Math.round(75*(a.current/a.total))),a.interval&&(this.requestInterval=a.interval)}});owUploadButton.statusCb=function(a){owUploadButton.lastPlugin.update(a)};owEditors.registerPlugin(owPlugin,owUploadOptions);
var owXHTML=bkClass.extend({stripAttributes:["_moz_dirty","_moz_resizing","_extended"],noShort:["style","title","script","textarea","a"],cssReplace:{"font-weight:bold;":"strong","font-style:italic;":"em"},sizes:{1:"xx-small",2:"x-small",3:"small",4:"medium",5:"large",6:"x-large"},construct:function(a){this.ne=a;this.ne.options.xhtml&&a.addEvent("get",this.cleanup.closure(this))},cleanup:function(a){var b=a.getElm(),b=this.toXHTML(b);a.content=b},toXHTML:function(a,b,c){var d=c="",f="",e=a.nodeType,
g=a.nodeName.toLowerCase(),l=a.hasChildNodes&&a.hasChildNodes(),n=[];switch(e){case 1:var p=a.attributes;switch(g){case "b":g="strong";break;case "i":g="em";break;case "font":g="span"}if(b){for(e=0;e<p.length;e++){var k=p[e],m=k.nodeName.toLowerCase(),h=k.nodeValue;if(k.specified&&h&&!bkLib.inArray(this.stripAttributes,m)&&"function"!=typeof h){switch(m){case "style":k=h.replace(/ /g,"");for(itm in this.cssReplace)-1!=k.indexOf(itm)&&(n.push(this.cssReplace[itm]),k=k.replace(itm,""));f+=k;h="";break;
case "class":h=h.replace("Apple-style-span","");break;case "size":f+="font-size:"+this.sizes[h]+";",h=""}h&&(d+=" "+m+'="'+h+'"')}}f&&(d+=' style="'+f+'"');for(e=0;e<n.length;e++)c+="<"+n[e]+">";""==d&&"span"==g&&(b=!1);b&&(c+="<"+g,"br /"!=g&&(c+=d))}if(l||bkLib.inArray(this.noShort,m))for(b&&(c+=">"),e=0;e<a.childNodes.length;e++)(m=this.toXHTML(a.childNodes[e],!0,!0))&&(c+=m);else b&&(c+=" />");b&&l&&(c+="</"+g+">");for(e=0;e<n.length;e++)c+="</"+n[e]+">";break;case 3:c+=a.nodeValue}return c}});
owEditors.registerPlugin(owXHTML);
var owBBCode=bkClass.extend({construct:function(a){this.ne=a;if(this.ne.options.bbCode)for(itm in a.addEvent("get",this.bbGet.closure(this)),a.addEvent("set",this.bbSet.closure(this)),a=this.ne.loadedPlugins,a)a[itm].toXHTML&&(this.xhtml=a[itm])},bbGet:function(a){var b=this.xhtml.toXHTML(a.getElm());a.content=this.toBBCode(b)},bbSet:function(a){a.content=this.fromBBCode(a.content)},toBBCode:function(a){function b(b,d){a=a.replace(b,d)}b(/\n/gi,"");b(/<strong>(.*?)<\/strong>/gi,"[b]$1[/b]");b(/<em>(.*?)<\/em>/gi,
"[i]$1[/i]");b(/<span.*?style="text-decoration:underline;">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<ul>(.*?)<\/ul>/gi,"[list]$1[/list]");b(/<li>(.*?)<\/li>/gi,"[*]$1[]");b(/<ol>(.*?)<\/ol>/gi,"[list=1]$1[/list]");b(/<img.*?src="(.*?)".*?>/gi,"[img]$1[/img]");b(/<a.*?href="(.*?)".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<br.*?>/gi,"\n");b(/<.*?>.*?<\/.*?>/gi,"");return a},fromBBCode:function(a){function b(b,d){a=a.replace(b,d)}b(/\[b\](.*?)\[\/b\]/gi,"<strong>$1</strong>");b(/\[i\](.*?)\[\/i\]/gi,"<em>$1</em>");
b(/\[u\](.*?)\[\/u\]/gi,'<span style="text-decoration:underline;">$1</span>');b(/\[list\](.*?)\[\/list\]/gi,"<ul>$1</ul>");b(/\[list=1\](.*?)\[\/list\]/gi,"<ol>$1</ol>");b(/\[\*\](.*?)\[\/\*\]/gi,"<li>$1</li>");b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');b(/\[url=(.*?)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');b(/\n/gi,"<br />");return a}});owEditors.registerPlugin(owBBCode);
var owEditor=owEditor.extend({floatingPanel:function(){this.floating=(new bkElement("DIV")).setStyle({position:"absolute",top:"-1000px"}).appendTo(document.body);this.addEvent("focus",this.reposition.closure(this)).addEvent("blur",this.hide.closure(this));this.setPanel(this.floating)},reposition:function(){var a=this.selectedInstance.e;this.floating.setStyle({width:(parseInt(a.getStyle("width"))||a.clientWidth)+"px"});var b=a.offsetTop-this.floating.offsetHeight;0>b&&(b=a.offsetTop+a.offsetHeight);
this.floating.setStyle({top:b+"px",left:a.offsetLeft+"px",display:"block"})},hide:function(){this.floating.setStyle({top:"-1000px"})}}),owCodeOptions={buttons:{xhtml:{name:"Modifier le code source HTML",type:"owCodeButton"}}},owCodeButton=owEditorAdvancedButton.extend({width:"350px",addPane:function(){this.addForm({"":{type:"title",txt:"Edit HTML"},code:{type:"content",value:this.ne.selectedInstance.getContent(),style:{width:"340px",height:"200px"}}})},submit:function(a){this.ne.selectedInstance.setContent(this.inputs.code.value);
this.removePane()}});owEditors.registerPlugin(owPlugin,owCodeOptions);