// JavaScript Document
function camposIguales(elem1,elem2, helperMsg){
	if(elem1.value!=elem2.value){
		elem1.focus(); // set the focus to this input
		elem1.style.backgroundColor='#FFB9B9';
		elem2.style.backgroundColor='#FFB9B9';
		exito=0
		aviso=aviso+'\n'+helperMsg

	}
}


function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		elem.focus(); // set the focus to this input
		elem.style.backgroundColor='#FFB9B9';
		exito=0
		aviso=aviso+'\n'+helperMsg
	}
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
	}else{
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		exito=0
		aviso=aviso+'\n'+helperMsg
	}
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){

}else{
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		exito=0
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){

	}else{
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		exito=0
	}
}


function lengthRestriction(elem, min, max, helperMsg){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
	}else{
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		exito=0
		aviso=aviso+'\n'+helperMsg +min+ " y " +max+ " caracteres."
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "elija"){
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		exito=0
		aviso=aviso+'\n'+helperMsg
	}else{
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
	}else{
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		
		exito=0
		aviso=aviso+'\n'+helperMsg
	}
}

function chequeado(elem, helperMsg){
  if (elem.checked == 1){
  }else{
		elem.focus();
		elem.style.backgroundColor='#FFB9B9';
		exito=0
		aviso=aviso+'\n'+helperMsg
	}
}
