
function validarEmail(valor) {
	  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
	    return (true)
	  } else {
	    alert("La dirección de Email es incorrecta.");
	    return (false);
	  }
	}

	function ComprobarFormAlta(form){
		if(document.getElementById('Nombre').value==''){
			alert('El campo Nombre es obligatorio.');
			return false;
		}
		if(document.getElementById('EmailA').value==''){
			alert('El campo Email es obligatorio.');
			return false;
		}
		if(!validarEmail(document.getElementById('EmailA').value)){
			return false;
		}
		if(document.getElementById('PasswordA').value==''){
			alert('El campo Clave es obligatorio.');
			return false;
		}
		if(document.getElementById('Sector_ID').value==''){
			alert('El campo Sector es obligatorio.');
			return false;
		}
		return true;
	}

	function validarEmailModificar(valor) {
	  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
	    return (true)
	  } else {
	    alert("La dirección de Email es incorrecta.");
	    return (false);
	  }
	}

	function ComprobarFormModificar(form){
		if(document.getElementById('EmailM').value==''){
			alert('El campo Email es obligatorio .');
			return false;
		}
		if(!validarEmailModificar(document.getElementById('EmailM').value)){
			return false;
		}
		if(document.getElementById('PasswordM').value==''){
			alert('El campo Clave es obligatorio.');
			return false;
		}
		return true;
	}


	function validarEmailModificar(valor) {
	  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
	    return (true)
	  } else {
	    alert("La dirección de Email es incorrecta.");
	    return (false);
	  }
	}


	function ComprobarFormBaja(form){
		if(document.getElementById('EmailB').value==''){
			alert('El campo Email es obligatorio .');
			return false;
		}
		if(!validarEmailModificar(document.getElementById('EmailB').value)){
			return false;
		}
		if(document.getElementById('PasswordB').value==''){
			alert('El campo Clave es obligatorio.');
			return false;
		}
		return true;
	}

	function ConfirmarSalir(Ruta) {
		if (confirm("¿Está seguro de que desea salir?")){
			window.location = Ruta + "salir.php";
		}
	}

	function ConfirmarBaja(Ruta) {
		if (confirm("¿Está seguro de que desea darse de baja?")){
			window.location = Ruta + "baja.php";
		}
	}
