CKEDITOR.dialog.add("checkbox",function(e){return{title:e.lang.forms.checkboxAndRadio.checkboxTitle,minWidth:350,minHeight:140,getModel:function(e){return(e=e.getSelection().getSelectedElement())&&"checkbox"==e.getAttribute("type")?e:null},onShow:function(){var e=this.getModel(this.getParentEditor());e&&this.setupContent(e)},onOk:function(){var e=this.getParentEditor(),t=this.getModel(e);t||((t=e.document.createElement("input")).setAttribute("type","checkbox"),e.insertElement(t)),this.commitContent({element:t})},contents:[{id:"info",label:e.lang.forms.checkboxAndRadio.checkboxTitle,title:e.lang.forms.checkboxAndRadio.checkboxTitle,startupFocus:"txtName",elements:[{id:"txtName",type:"text",label:e.lang.common.name,default:"",accessKey:"N",setup:function(e){this.setValue(e.data("cke-saved-name")||e.getAttribute("name")||"")},commit:function(e){e=e.element,this.getValue()?e.data("cke-saved-name",this.getValue()):(e.data("cke-saved-name",!1),e.removeAttribute("name"))}},{id:"txtValue",type:"text",label:e.lang.forms.checkboxAndRadio.value,default:"",accessKey:"V",setup:function(e){e=e.getAttribute("value"),this.setValue(CKEDITOR.env.ie&&"on"==e?"":e)},commit:function(t){var c=t.element,i=this.getValue();!i||CKEDITOR.env.ie&&"on"==i?CKEDITOR.env.ie?(i=new CKEDITOR.dom.element("input",c.getDocument()),c.copyAttributes(i,{value:1}),i.replace(c),e.getSelection().selectElement(i),t.element=i):c.removeAttribute("value"):c.setAttribute("value",i)}},{id:"cmbSelected",type:"checkbox",label:e.lang.forms.checkboxAndRadio.selected,default:"",accessKey:"S",value:"checked",setup:function(e){this.setValue(e.getAttribute("checked"))},commit:function(t){var c=t.element;if(CKEDITOR.env.ie){var i=!!c.getAttribute("checked"),n=!!this.getValue();i!=n&&(i=CKEDITOR.dom.element.createFromHtml('<input type="checkbox"'+(n?' checked="checked"':"")+"/>",e.document),c.copyAttributes(i,{type:1,checked:1}),i.replace(c),e.getSelection().selectElement(i),t.element=i)}else t=this.getValue(),CKEDITOR.env.webkit&&(c.$.checked=t),t?c.setAttribute("checked","checked"):c.removeAttribute("checked")}},{id:"required",type:"checkbox",label:e.lang.forms.checkboxAndRadio.required,default:"",accessKey:"Q",value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute,commit:function(e){e=e.element,this.getValue()?e.setAttribute("required","required"):e.removeAttribute("required")}}]}]}});