var errores = '';

function validaVacio(campo,min,nombre) {
	var texto =  nombre + ' empty';
	
	var reportar = 1;
	if(arguments[3]){
		reportar = 0;
	}
	
	if(campo.value.length < min){
		if(reportar == 1){
			errores = errores + texto + '\n';
		}
		return false;

	}
	return true;
}


function validaNumero(campo,nombre){
	var texto =  nombre + ' no is a number';
	
	var reportar = 1;
	if(arguments[2]){
		reportar = 0;
	}
	var numRegex = /(^[0-9\.]+)$/;
	if(!numRegex.test(campo.value)) {
		if(reportar == 1){
			errores = errores + texto + '\n';
		}
        return false
    }
    return true;
	
}



function validaCorreo(campo,nombre){
	var texto =  nombre + ' empty';
	
	var reportar = 1;
	if(arguments[2]){
		reportar = 0;
	}
	var corRegex = /(^[\w\.\-]+@[\w\.\-]+\.\w{2,3})$/;
	if(!corRegex.test(campo.value)) {
		if(reportar == 1){
			errores = errores + texto + '\n';
		}
        return false
    }
    return true;
	
}





function retornaErrores(){
	return errores;
}

function borraErrores(){
	errores = '';
	return 1;
	
}

function insertarError(texto){
	errores = errores + texto + '\n';
	
}

function aleatorio(inferior,superior){
	numPosibilidades = superior - inferior
	aleat = Math.random() * numPosibilidades
	aleat = Math.round(aleat)
	return parseInt(inferior) + aleat
}
