Element.addMethods("input",{getRadioSiblings:function(b){b=$(b);var a=b.readAttribute("name");return $$("input[type=radio][name='"+a+"']").without(b)},setRadioChecked:function(a){a=$(a);a.getRadioSiblings().invoke("setRadioUnchecked");a.checked=true;return a},setRadioUnchecked:function(a){a=$(a);a.checked=false;return a}});Element.addMethods({vCenter:function(a){a=$(a);a.setStyle({position:"absolute",top:"50%",marginTop:-(a.getHeight()/2)+"px"});return a}});Event.observe(document,"dom:loaded",function(){if(document.activeElement){var a=$A();var b=$H();Element.addMethods(["INPUT","TEXTAREA"],{clearOnBackspace:function(c,e){c=$(c);a.include(c)||a.push(c);if(e&&Object.isFunction(e)){var d=c.identify();b.include(d)||b.set(d,$A());b.get(d).push(e)}return c},noClearOnBackspace:function(c){c=$(c);a=a.without(c);b.unset(c.identify());return c}});document.observe("keydown",function(d){var e=$(document.activeElement);if(e&&a.include(e)&&d.keyCode==Event.KEY_BACKSPACE){e.value=null;var f=e.identify();var c=b.get(f);if(c){c.each(function(g){g()})}}})}});Element.addMethods({zIndexFix:function(a){if(Prototype.Browser.IE){var b=1000;a=$(a);do{a.setStyle({zIndex:b--})}while((a=a.up())!=document)}}});Element.addMethods(["INPUT","TEXTAREA"],{blankOnNextFocus:function(b){b=$(b);var a=function(){b.value="";b.stopObserving("focus",a)};b.observe("focus",a);return b},defaultOnBlank:function(a,b,c){a=$(a);c=c||Prototype.emptyFunction;a.observe("blur",function(){if(a.value.empty()){a.value=b;c()}});return a},useValueAsCaption:function(b,d,a){d=d||b.value;a=a||{};a=$H(a);var c=a.get("captioningCallback")||Prototype.emptyFunction;var e=a.get("decaptioningCallback")||Prototype.emptyFunction;if(b.value==d){c()}if(!d){throw {name:"InvalidArgumentError",message:"You must provide an initial non-empty value for captioning."}}b=$(b);b.observe("focus",function(){if(b.value==d){b.value="";e()}});b.defaultOnBlank(d,c);return b},observeContents:function(a){a=$(a);contents=a.value;new PeriodicalExecuter(function(b){if(a.value!=contents){a.fire("contents:change");contents=a.value}},0.05);return a}});
