function RuleExceptions(){
this.addRuleException=addRuleExceptionRuleExceptions;
this.hasRuleExceptions=hasRuleExceptionsRuleExceptions;
this.getRuleException=getRuleExceptionPorID;
this.size=sizeRuleExceptions;
this.errorMap=new HashMap();
}
function addRuleExceptionRuleExceptions(_1,_2){
var _3=this.errorMap.get(_1);
if(_3!=null){
_3.push(_2);
}else{
_3=new Array();
_3.push(_2);
this.errorMap.put(_1,_3);
}
}
function hasRuleExceptionsRuleExceptions(){
return this.errorMap.values.length>0;
}
function getRuleExceptionPorID(_4){
var _5=this.errorMap.get(_4);
return _5;
}
function sizeRuleExceptions(){
return this.errorMap.values.length;
}
function RuleException(_6){
this.key=_6;
this.params=new Array();
this.getMensajeError=getMensajeErrorRuleException;
var i=1;
while(arguments[i]!=null){
this.params.push(arguments[i++]);
}
}
function getMensajeErrorRuleException(){
var _8=getFormErrorMsg(this.key).errorMsgFormat;
for(var i=0;i<this.params.length;i++){
_8=_8.replace("{"+i+"}",this.params[i]);
}
return _8;
}
function AvatarFormValidator(_a){
this.formName=_a;
this.res=new RuleExceptions();
this.cantidadMaxEnterosBD=20;
this.cantidadMaxDecimalesBD=10;
this.flagSignoBD=false;
this.validate=validateAvatarFormValidator;
this.addValidacionTxtObligatorio=addValidacionTxtObligatorioAvatarFormValidator;
this.addValidacionTxtAlfanumerico=addValidacionTxtAlfanumericoAvatarFormValidator;
this.addValidacionTxtCaracteresValidos=addValidacionTxtCaracteresValidosAvatarFormValidator;
this.addValidacionTxtNumeroReal=addValidacionTxtNumeroRealAvatarFormValidator;
this.addValidacionTxtNumeroEntero=addValidacionTxtNumeroEnteroAvatarFormValidator;
this.addValidacionTxtNumeroMayorIgualCero=addValidacionTxtNumeroMayorIgualCeroAvatarFormValidator;
this.addValidacionTxtNumeroEnteroMayorCero=addValidacionTxtNumeroEnteroMayorCeroAvatarFormValidator;
this.addValidacionTxtEmail=addValidacionTxtEmailAvatarFormValidator;
}
function validateAvatarFormValidator(){
return this.res;
}
function addValidacionTxtObligatorioAvatarFormValidator(_b,_c,_d){
var _e=getFormElement(this.formName,_b,_d);
var _f=formarIdLabelError(_b);
if(_e==null||_e.value==null){
this.res.addRuleException(_f,new RuleException("global.000",_c));
return;
}
var _10=_e.value.trim();
if(esCadenaVacia(_10)){
this.res.addRuleException(_f,new RuleException("global.001",_c));
return;
}
}
function addValidacionTxtAlfanumericoAvatarFormValidator(_11,_12,_13,_14){
var _15=getFormElement(this.formName,_11,_14);
var _16=formarIdLabelError(_11);
if(_15==null||_15.value==null){
this.res.addRuleException(_16,new RuleException("global.000",_12));
return;
}
var _17=_15.value.trim();
if(esCadenaVacia(_17)){
if(_13){
this.res.addRuleException(_16,new RuleException("global.001",_12));
}
return;
}
if(!esCadenaAlfanumerica(_17)){
this.res.addRuleException(_16,new RuleException("global.006",_12));
}
}
function addValidacionTxtCaracteresValidosAvatarFormValidator(_18,_19,_1a,_1b){
var _1c=getFormElement(this.formName,_18,_1b);
var _1d=formarIdLabelError(_18);
if(_1c==null||_1c.value==null){
this.res.addRuleException(_1d,new RuleException("global.000",_19));
return;
}
var _1e=_1c.value.trim();
if(esCadenaVacia(_1e)){
if(_1a){
this.res.addRuleException(_1d,new RuleException("global.001",_19));
}
return;
}
if(tieneCaracterNoValido(_1e)){
this.res.addRuleException(_1d,new RuleException("global.007",_19));
}
}
function addValidacionTxtNumeroRealAvatarFormValidator(_1f,_20,_21,_22){
var _23=getFormElement(this.formName,_1f,_22);
var _24=formarIdLabelError(_1f);
if(_23==null||_23.value==null){
this.res.addRuleException(_24,new RuleException("global.000",_20));
return;
}
var _25=_23.value.trim();
if(esCadenaVacia(_25)){
if(_21){
this.res.addRuleException(_24,new RuleException("global.001",_20));
}
return;
}
if(!esNumeroReal(_25)){
this.res.addRuleException(_24,new RuleException("global.008",_20));
return;
}
if(!esNumeroRealBD(_25,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_24,new RuleException("global.020",_20));
return;
}
}
function addValidacionTxtNumeroEnteroAvatarFormValidator(_26,_27,_28,_29){
var _2a=getFormElement(this.formName,_26,_29);
var _2b=formarIdLabelError(_26);
if(_2a==null||_2a.value==null){
this.res.addRuleException(_2b,new RuleException("global.000",_27));
return;
}
var _2c=_2a.value.trim();
if(esCadenaVacia(_2c)){
if(_28){
this.res.addRuleException(_2b,new RuleException("global.001",_27));
}
return;
}
if(!esNumeroEntero(_2c)){
this.res.addRuleException(_2b,new RuleException("global.009",_27));
return;
}
if(!esNumeroRealBD(_2c,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_2b,new RuleException("global.020",_27));
return;
}
}
function addValidacionTxtNumeroMayorIgualCeroAvatarFormValidator(_2d,_2e,_2f,_30){
var _31=getFormElement(this.formName,_2d,_30);
var _32=formarIdLabelError(_2d);
if(_31==null||_31.value==null){
this.res.addRuleException(_32,new RuleException("global.000",_2e));
return;
}
var _33=_31.value.trim();
if(esCadenaVacia(_33)){
if(_2f){
this.res.addRuleException(_32,new RuleException("global.001",_2e));
}
return;
}
if(!esNumeroReal(_33)){
this.res.addRuleException(_32,new RuleException("global.008",_2e));
return;
}
if(!esNumeroRealBD(_33,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_32,new RuleException("global.020",_2e));
return;
}
var num=parseFloat(_33);
if(num<0){
this.res.addRuleException(_32,new RuleException("global.019",_2e));
return;
}
}
function addValidacionTxtNumeroEnteroMayorCeroAvatarFormValidator(_35,_36,_37,_38){
var _39=getFormElement(this.formName,_35,_38);
var _3a=formarIdLabelError(_35);
if(_39==null||_39.value==null){
this.res.addRuleException(_3a,new RuleException("global.000",_36));
return;
}
var _3b=_39.value.trim();
if(esCadenaVacia(_3b)){
if(_37){
this.res.addRuleException(_3a,new RuleException("global.001",_36));
}
return;
}
if(!esNumeroEntero(_3b)){
this.res.addRuleException(_3a,new RuleException("global.009",_36));
return;
}
if(!esNumeroRealBD(_3b,this.cantidadMaxEnterosBD,this.cantidadMaxDecimalesBD,this.flagSignoBD)){
this.res.addRuleException(_3a,new RuleException("global.020",_36));
return;
}
var num=parseFloat(_3b);
if(num<=0){
this.res.addRuleException(_3a,new RuleException("global.023",_36));
return;
}
}
function addValidacionTxtEmailAvatarFormValidator(_3d,_3e,_3f,_40){
var _41=getFormElement(this.formName,_3d,_40);
var _42=formarIdLabelError(_3d);
if(_41==null||_41.value==null){
this.res.addRuleException(_42,new RuleException("global.000",_3e));
return;
}
var _43=_41.value.trim();
if(esCadenaVacia(_43)){
if(_3f){
this.res.addRuleException(_42,new RuleException("global.001",_3e));
}
return;
}
if(!esEmail(_43)){
this.res.addRuleException(_42,new RuleException("global.010",_3e));
}
}
function formarIdLabelError(_44){
var _45=_44.substring(0,1).upper;
var _46=_44.substring(1);
var _47="lblError"+_44;
return _47;
}

