var errores = '';

function validaVacio(campo,min,nombre) {
	var texto = 'El campo ' + nombre + ' esta vacio';
	
	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 = 'El campo ' + nombre + ' no es un numero';
	
	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 = 'El campo ' + nombre + ' no es valido';
	
	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';
	
}
