// (c) AVILIX TI, SL
// Autor: Fernando Cabrerizo
// Version: 2.0
// Dependencias: avxFormularios.css
// Dependencias: ../avxUtils/byId.js
function AvxForm(b){if(!document.avxFormObjects){document.avxFormObjects=new Array()}this.x=document.avxFormObjects.length;document.avxFormObjects[this.x]=this;this.i=b;this.cs=new Array();this.aC=function(c){this.cs[this.cs.length]=c};this.fs=new Array();this.aF=function(f){this.fs[this.fs.length]=f};this.s=function(){var a=true;for(i=0;i<this.cs.length;i++){var c=this.cs[i];var v=byId(c.i).value;if((c.r)&&(v=="")){alert("El campo '"+c.n+"' es obligatorio.");byId(c.i).focus();a=false;break}}if(a){for(i=0;i<this.fs.length;i++){var f=this.fs[i];if(!f.t()){a=false;break}}}if(a){byId(this.i).submit()}};this.e=function(){byId(this.i+"_close").style.display="none";byId(this.i+"_open").style.display="block";byId(this.i+"_save").style.display="block";for(i=0;i<this.cs.length;i++){var c=this.cs[i];if(!c.rO){byId(c.i).className='formDatoEditar';byId(c.i).readOnly=false}}};this.r=function(){byId(this.i+"_open").style.display="none";byId(this.i+"_save").style.display="none";byId(this.i+"_close").style.display="block";byId(this.i).reset();for(i=0;i<this.cs.length;i++){var c=this.cs[i];if(!c.rO){byId(c.i).className='formDato';byId(c.i).readOnly=true}}}}function AvxFormCampo(i,n,a,r){this.i=i;this.n=n;this.rO=a;this.r=r}function AvxFormFilter_equal(c,d,e,f){this.i1=c;this.n1=d;this.i2=e;this.n2=f;this.t=function(){var a=byId(this.i1).value;var b=byId(this.i2).value;if(a!=b){alert("Los valores de '"+this.n1+"' y '"+this.n2+"' no son identicos.");byId(this.i1).focus();return false}else{return true}}}function AvxFormFilter_minLength(i,n,a){this.i=i;this.n=n;this.mL=a;this.t=function(){var v=byId(this.i).value;if(v.length<this.mL){alert("El campo '"+this.n+"' requiere al menos "+this.mL+" caracteres.");byId(this.i).focus();return false}else{return true}}}