var EDITBOX_ID="topic";var EDITBOX_PREF_ROWS_ID="EditTextareaRows";var EDITBOX_CHANGE_STEP_SIZE=4;var EDITBOX_MIN_ROWCOUNT=4;var EDITBOX_PREF_FONTSTYLE_ID="EditTextareaFontStyle";var EDITBOX_FONTSTYLE_MONO="mono";var EDITBOX_FONTSTYLE_PROPORTIONAL="proportional";var EDITBOX_FONTSTYLE_MONO_STYLE="foswikiEditboxStyleMono";var EDITBOX_FONTSTYLE_PROPORTIONAL_STYLE="foswikiEditboxStyleProportional";(function(a){foswiki.Edit={textareaInited:false,fontStyle:null,validateSuppressed:false};foswiki.Edit.getFontStyle=function(){if(foswiki.Edit.fontStyle){return foswiki.Edit.fontStyle}var b=foswiki.Pref.getPref(EDITBOX_PREF_FONTSTYLE_ID);if(!b||(b!==EDITBOX_FONTSTYLE_PROPORTIONAL&&b!==EDITBOX_FONTSTYLE_MONO)){b=EDITBOX_FONTSTYLE_PROPORTIONAL}return b};foswiki.Edit.setFontStyle=function(b){if(b===EDITBOX_FONTSTYLE_MONO){a("#"+EDITBOX_ID).removeClass(EDITBOX_FONTSTYLE_PROPORTIONAL_STYLE).addClass(EDITBOX_FONTSTYLE_MONO_STYLE)}if(b===EDITBOX_FONTSTYLE_PROPORTIONAL){a("#"+EDITBOX_ID).removeClass(EDITBOX_FONTSTYLE_MONO_STYLE).addClass(EDITBOX_FONTSTYLE_PROPORTIONAL_STYLE)}foswiki.Edit.fontStyle=b;foswiki.Pref.setPref(EDITBOX_PREF_FONTSTYLE_ID,b)};foswiki.Edit.changeEditBox=function(c){var b=a("#"+EDITBOX_ID).attr("rows");b=parseInt(b);b+=(c*EDITBOX_CHANGE_STEP_SIZE);b=(b<EDITBOX_MIN_ROWCOUNT)?EDITBOX_MIN_ROWCOUNT:b;a("#"+EDITBOX_ID).attr("rows",b);foswiki.Pref.setPref(EDITBOX_PREF_ROWS_ID,b);return false};foswiki.Edit.validateMandatoryFields=function(){if(foswiki.Edit.validateSuppressed){return true}var b=[];a("select.foswikiMandatory").each(function(d,f){var e=false;var c;for(c=0;c<f.options.length;c=c+1){if(f.options[c].selected){e=true;break}}if(!e){b.push("The required form field '"+f.name+"' has no value.")}});a("textarea.foswikiMandatory, input.foswikiMandatory").each(function(c,d){if(d.value===null||d.value.length===0){b.push("The required form field '"+d.name+"' has no value.")}});if(b.length>0){alert(b.join("\n"));return false}else{return true}};a(function(){try{document.main.text.focus()}catch(d){}var c=foswiki.Pref.getPref(EDITBOX_PREF_ROWS_ID);if(c){a("#"+EDITBOX_ID).attr("rows",parseInt(c,10))}var b=foswiki.Edit.getFontStyle();foswiki.Edit.setFontStyle(b);a(document.forms[name="main"]).submit(function(f){return foswiki.Edit.validateMandatoryFields()});a(".foswikiTextarea").keydown(function(g){var f;if(g.keyCode){f=g.keyCode}return(f!==27)});a(".foswikiButtonCancel").click(function(f){foswiki.Edit.validateSuppressed=true})})}(jQuery));