CKEDITOR.dialog.add("textfield",function(a){function h(f){f=f.element;var e=this.getValue();e?f.setAttribute(this.id,e):f.removeAttribute(this.id)}function d(b){this.setValue(b.hasAttribute(this.id)&&b.getAttribute(this.id)||"")}var c={email:1,password:1,search:1,tel:1,text:1,url:1};return{title:a.lang.forms.textfield.title,minWidth:350,minHeight:150,onShow:function(){delete this.textField;var b=this.getParentEditor().getSelection().getSelectedElement();!b||"input"!=b.getName()||!c[b.getAttribute("type")]&&b.getAttribute("type")||(this.textField=b,this.setupContent(b))},onOk:function(){var f=this.getParentEditor(),e=this.textField,g=!e;g&&(e=f.document.createElement("input"),e.setAttribute("type","text"));e={element:e};g&&f.insertElement(e.element);this.commitContent(e);g||f.getSelection().selectElement(e.element)},onLoad:function(){this.foreach(function(b){b.getValue&&(b.setup||(b.setup=d),!b.commit)&&(b.commit=h)})},contents:[{id:"info",label:a.lang.forms.textfield.title,title:a.lang.forms.textfield.title,elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"_cke_saved_name",type:"text",label:a.lang.forms.textfield.name,"default":"",accessKey:"N",setup:function(b){this.setValue(b.data("cke-saved-name")||b.getAttribute("name")||"")},commit:function(b){b=b.element;this.getValue()?b.data("cke-saved-name",this.getValue()):(b.data("cke-saved-name",!1),b.removeAttribute("name"))}},{id:"value",type:"text",label:a.lang.forms.textfield.value,"default":"",accessKey:"V",commit:function(b){if(CKEDITOR.env.ie&&!this.getValue()){var e=b.element,f=new CKEDITOR.dom.element("input",a.document);e.copyAttributes(f,{value:1});f.replace(e);b.element=f}else{h.call(this,b)}}}]},{type:"hbox",widths:["50%","50%"],children:[{id:"size",type:"text",label:a.lang.forms.textfield.charWidth,"default":"",accessKey:"C",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(a.lang.common.validateNumberFailed)},{id:"maxLength",type:"text",label:a.lang.forms.textfield.maxChars,"default":"",accessKey:"M",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(a.lang.common.validateNumberFailed)}],onLoad:function(){CKEDITOR.env.ie7Compat&&this.getElement().setStyle("zoom","100%")}},{id:"type",type:"select",label:a.lang.forms.textfield.type,"default":"text",accessKey:"M",items:[[a.lang.forms.textfield.typeEmail,"email"],[a.lang.forms.textfield.typePass,"password"],[a.lang.forms.textfield.typeSearch,"search"],[a.lang.forms.textfield.typeTel,"tel"],[a.lang.forms.textfield.typeText,"text"],[a.lang.forms.textfield.typeUrl,"url"]],setup:function(b){this.setValue(b.getAttribute("type"))},commit:function(b){var g=b.element;if(CKEDITOR.env.ie){var i=g.getAttribute("type"),f=this.getValue();i!=f&&(i=CKEDITOR.dom.element.createFromHtml('<input type="'+f+'"></input>',a.document),g.copyAttributes(i,{type:1}),i.replace(g),b.element=i)}else{g.setAttribute("type",this.getValue())}}},{id:"required",type:"checkbox",label:a.lang.forms.textfield.required,"default":"",accessKey:"Q",value:"required",setup:function(b){this.setValue(b.getAttribute("required"))},commit:function(b){b=b.element;this.getValue()?b.setAttribute("required","required"):b.removeAttribute("required")}}]}]}});