/*
 * Ext JS Library 1.1.1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */

Ext.form.Form=function(A){Ext.form.Form.superclass.constructor.call(this,null,A);this.url=this.url||this.action;if(!this.root){this.root=new Ext.form.Layout(Ext.applyIf({id:Ext.id()},A))}this.active=this.root;this.buttons=[];this.addEvents({clientvalidation:true})};Ext.extend(Ext.form.Form,Ext.form.BasicForm,{buttonAlign:"center",minButtonWidth:75,labelAlign:"left",monitorValid:false,monitorPoll:200,column:function(B){var A=new Ext.form.Column(B);this.start(A);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end()}return A},fieldset:function(B){var A=new Ext.form.FieldSet(B);this.start(A);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end()}return A},container:function(B){var A=new Ext.form.Layout(B);this.start(A);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end()}return A},start:function(A){Ext.applyIf(A,{"labelAlign":this.active.labelAlign,"labelWidth":this.active.labelWidth,"itemCls":this.active.itemCls});this.active.stack.push(A);A.ownerCt=this.active;this.active=A;return this},end:function(){if(this.active==this.root){return this}this.active=this.active.ownerCt;return this},add:function(){this.active.stack.push.apply(this.active.stack,arguments);var D=[];for(var C=0,B=arguments,A=B.length;C<A;C++){if(B[C].isFormField){D.push(B[C])}}if(D.length>0){Ext.form.Form.superclass.add.apply(this,D)}return this},render:function(E){E=Ext.get(E);var G=this.autoCreate||{tag:"form",method:this.method||"POST",id:this.id||Ext.id()};this.initEl(E.createChild(G));this.root.render(this.el);this.items.each(function(I){I.render("x-form-el-"+I.id)});if(this.buttons.length>0){var C=this.el.createChild({cls:"x-form-btns-ct",cn:{cls:"x-form-btns x-form-btns-"+this.buttonAlign,html:"<table cellspacing=\"0\"><tbody><tr></tr></tbody></table><div class=\"x-clear\"></div>"}},null,true);var F=C.getElementsByTagName("tr")[0];for(var D=0,B=this.buttons.length;D<B;D++){var A=this.buttons[D];var H=document.createElement("td");H.className="x-form-btn-td";A.render(F.appendChild(H))}}if(this.monitorValid){this.startMonitoring()}return this},addButton:function(A,D,C){var E={handler:D,scope:C,minWidth:this.minButtonWidth,hideParent:true};if(typeof A=="string"){E.text=A}else{Ext.apply(E,A)}var B=new Ext.Button(null,E);this.buttons.push(B);return B},startMonitoring:function(){if(!this.bound){this.bound=true;Ext.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this})}},stopMonitoring:function(){this.bound=false},bindHandler:function(){if(!this.bound){return false}var D=true;this.items.each(function(E){if(!E.isValid(true)){D=false;return false}});for(var C=0,A=this.buttons.length;C<A;C++){var B=this.buttons[C];if(B.formBind===true&&B.disabled===D){B.setDisabled(!D)}}this.fireEvent("clientvalidation",this,D)}});Ext.Form=Ext.form.Form;