
	function Vacio(str)
{
	while (str.substring(0, 1) == " "
			|| str.substring(0, 1) == "\n"
			|| str.substring(0, 1) == "\r")
	{
		str = str.substring(1, str.length);
	}
	while (str.substring(str.length - 1, str.length) == " "
			|| str.substring(str.length - 1, str.length) == "\n"
			|| str.substring(str.length - 1, str.length) == "\r")
	{
		str = str.substring(0, str.length - 1);
	}
	return str;
}
function Validar()
	{ 
	if (Vacio(document.registro.nombre.value)=="")
		{
		window.alert("Introduzca su nombre");
		document.registro.nombre.focus();
		return false;
		}
	if (Vacio(document.registro.apellido1.value)=="")
		{
		window.alert("Introduzca su apellido");
		document.registro.apellido1.focus();
		return false;
		}
	if (Vacio(document.registro.apellido2.value)=="")
		{
		window.alert("Introduzca su apellido");
		document.registro.apellido2.focus();
		return false;
		}
	if (Vacio(document.registro.fecha.value)=="")
		{
		window.alert("Introduzca su fecha de nacimiento");
		document.registro.fecha.focus();
		return false;
		}
	if (Vacio(document.registro.dni.value)=="")
		{
		window.alert("Introduzca su DNI");
		document.registro.dni.focus();
		return false;
		}
	if (Vacio(document.registro.centro.value)=="")
		{
		window.alert("Introduzca el nombre del centro");
		document.registro.centro.focus();
		return false;
		}
	if (Vacio(document.registro.direccion.value)=="")
		{
		window.alert("Introduzca la dirección");
		document.registro.direccion.focus();
		return false;
		}
	if (Vacio(document.registro.cp.value)=="")
		{
		window.alert("Introduzca Código postal");
		document.registro.cp.focus();
		return false;
		}
	if (Vacio(document.registro.poblacion.value)=="")
		{
		window.alert("Introduzca la población");
		document.registro.poblacion.focus();
		return false;
		}
	if (Vacio(document.registro.telefono.value)=="")
		{
		window.alert("Introduzca su teléfono");
		document.registro.telefono.focus();
		return false;
		}
	if (Vacio(document.registro.email.value)=="")
		{
		window.alert("Introduzca el nombre de su dirección de E-mail");
		document.registro.email.focus();
		return false;
		}
		return true;
	}
