/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

(function(){CKEDITOR.plugins.add('forms',{init:function(a){var b=a.lang;a.addCss('form{border: 1px dotted #FF0000;padding: 2px;}');var c=function(e,f,g){a.addCommand(f,new CKEDITOR.dialogCommand(f));a.ui.addButton(e,{label:b.common[e.charAt(0).toLowerCase()+e.slice(1)],command:f});CKEDITOR.dialog.add(f,g);},d=this.path+'dialogs/';c('Form','form',d+'form.js');c('Checkbox','checkbox',d+'checkbox.js');c('Radio','radio',d+'radio.js');c('TextField','textfield',d+'textfield.js');c('Textarea','textarea',d+'textarea.js');c('Select','select',d+'select.js');c('Button','button',d+'button.js');c('ImageButton','imagebutton',CKEDITOR.plugins.getPath('image')+'dialogs/image.js');c('HiddenField','hiddenfield',d+'hiddenfield.js');if(a.addMenuItems)a.addMenuItems({form:{label:b.form.menu,command:'form',group:'form'},checkbox:{label:b.checkboxAndRadio.checkboxTitle,command:'checkbox',group:'checkbox'},radio:{label:b.checkboxAndRadio.radioTitle,command:'radio',group:'radio'},textfield:{label:b.textfield.title,command:'textfield',group:'textfield'},hiddenfield:{label:b.hidden.title,command:'hiddenfield',group:'hiddenfield'},imagebutton:{label:b.image.titleButton,command:'imagebutton',group:'imagebutton'},button:{label:b.button.title,command:'button',group:'button'},select:{label:b.select.title,command:'select',group:'select'},textarea:{label:b.textarea.title,command:'textarea',group:'textarea'}});if(a.contextMenu){a.contextMenu.addListener(function(e){if(e&&e.hasAscendant('form',true))return{form:2};});a.contextMenu.addListener(function(e){if(e){var f=e.getName();if(f=='select')return{select:2};if(f=='textarea')return{textarea:2};if(f=='input'){var g=e.getAttribute('type');if(g=='text'||g=='password')return{textfield:2};if(g=='button'||g=='submit'||g=='reset')return{button:2};if(g=='checkbox')return{checkbox:2};if(g=='radio')return{radio:2};if(g=='image')return{imagebutton:2};}if(f=='img'&&e.getAttribute('_cke_real_element_type')=='hiddenfield')return{hiddenfield:2};}});}},afterInit:function(a){if(CKEDITOR.env.ie){var b=a.dataProcessor,c=b&&b.htmlFilter;c&&c.addRules({elements:{input:function(d){var e=d.attributes,f=e.type;if(f=='checkbox'||f=='radio')e.value=='on'&&delete e.value;}}});}},requires:['image']});if(CKEDITOR.env.ie)CKEDITOR.dom.element.prototype.hasAttribute=function(a){var d=this;var b=d.$.attributes.getNamedItem(a);if(d.getName()=='input')switch(a){case 'class':return d.$.className.length>0;case 'checked':return!!d.$.checked;case 'value':var c=d.getAttribute('type');
if(c=='checkbox'||c=='radio')return d.$.value!='on';break;default:}return!!(b&&b.specified);};})();
