/*
	Copyright (c) 2004-2008, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
*/


window[(typeof (djConfig)!="undefined"&&djConfig.scopeMap&&djConfig.scopeMap[0][1])||"dojo"]._xdResourceLoaded({depends:[["provide","dijit.form.Form"],["require","dijit._Widget"],["require","dijit._Templated"]],defineResource:function(_1,_2,_3){if(!_1._hasResource["dijit.form.Form"]){_1._hasResource["dijit.form.Form"]=true;_1.provide("dijit.form.Form");_1.require("dijit._Widget");_1.require("dijit._Templated");_1.declare("dijit.form._FormMixin",null,{reset:function(){_1.forEach(this.getDescendants(),function(_4){if(_4.reset){_4.reset();}});},validate:function(){var _5=false;return _1.every(_1.map(this.getDescendants(),function(_6){_6._hasBeenBlurred=true;var _7=!_6.validate||_6.validate();if(!_7&&!_5){_2.scrollIntoView(_6.containerNode||_6.domNode);_6.focus();_5=true;}return _7;}),"return item;");},setValues:function(_8){var _9={};_1.forEach(this.getDescendants(),function(_a){if(!_a.name){return;}var _b=_9[_a.name]||(_9[_a.name]=[]);_b.push(_a);});for(var _c in _9){var _d=_9[_c],_e=_1.getObject(_c,false,_8);if(!_1.isArray(_e)){_e=[_e];}if(typeof _d[0].checked=="boolean"){_1.forEach(_d,function(w,i){w.setValue(_1.indexOf(_e,w.value)!=-1);});}else{if(_d[0]._multiValue){_d[0].setValue(_e);}else{_1.forEach(_d,function(w,i){w.setValue(_e[i]);});}}}},getValues:function(){var obj={};_1.forEach(this.getDescendants(),function(_14){var _15=_14.name;if(!_15){return;}var _16=(_14.getValue&&!_14._getValueDeprecated)?_14.getValue():_14.value;if(typeof _14.checked=="boolean"){if(/Radio/.test(_14.declaredClass)){if(_16!==false){_1.setObject(_15,_16,obj);}}else{var ary=_1.getObject(_15,false,obj);if(!ary){ary=[];_1.setObject(_15,ary,obj);}if(_16!==false){ary.push(_16);}}}else{_1.setObject(_15,_16,obj);}});return obj;},isValid:function(){return _1.every(this.getDescendants(),function(_18){return !_18.isValid||_18.isValid();});}});_1.declare("dijit.form.Form",[_2._Widget,_2._Templated,_2.form._FormMixin],{name:"",action:"",method:"",encType:"","accept-charset":"",accept:"",target:"",templateString:"<form dojoAttachPoint='containerNode' dojoAttachEvent='onreset:_onReset,onsubmit:_onSubmit' name='${name}'></form>",attributeMap:_1.mixin(_1.clone(_2._Widget.prototype.attributeMap),{action:"",method:"",encType:"","accept-charset":"",accept:"",target:""}),execute:function(_19){},onExecute:function(){},setAttribute:function(_1a,_1b){this.inherited(arguments);switch(_1a){case "encType":if(_1.isIE){this.domNode.encoding=_1b;}}},postCreate:function(){if(_1.isIE&&this.srcNodeRef&&this.srcNodeRef.attributes){var _1c=this.srcNodeRef.attributes.getNamedItem("encType");if(_1c&&!_1c.specified&&(typeof _1c.value=="string")){this.setAttribute("encType",_1c.value);}}this.inherited(arguments);},onReset:function(e){return true;},_onReset:function(e){var _1f={returnValue:true,preventDefault:function(){this.returnValue=false;},stopPropagation:function(){},currentTarget:e.currentTarget,target:e.target};if(!(this.onReset(_1f)===false)&&_1f.returnValue){this.reset();}_1.stopEvent(e);return false;},_onSubmit:function(e){var fp=_2.form.Form.prototype;if(this.execute!=fp.execute||this.onExecute!=fp.onExecute){_1.deprecated("dijit.form.Form:execute()/onExecute() are deprecated. Use onSubmit() instead.","","2.0");this.onExecute();this.execute(this.getValues());}if(this.onSubmit(e)===false){_1.stopEvent(e);}},onSubmit:function(e){return this.isValid();},submit:function(){if(!(this.onSubmit()===false)){this.containerNode.submit();}}});}}});
