// JavaScript Document
	function esFecha(dia, mes, ano){
		var expresion = /[^0-9]/;
		if ((dia < 1)|| (dia > 31) || (mes < 1) || (mes > 12) || (ano < 1900) || (ano > 2100)) // fecha ficticia
			return false;
	   else if((ano%4 != 0) && (mes == 2) && (dia > 28))	// Año no visiesto, es febrero y el dia es mayor a 28
			return false;	   
	   else if ((((mes == 4) || (mes == 6) || (mes == 9) || (mes==11)) && (dia>30)) || ((mes==2) && (dia>29)))
			return false;     		 	   
		else	    
			return true;
	}
	function enviar2()
	{
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,3}$/;
		var msg;
		
		msg="";
		
		if(document.formu.txtEmail.value=="")
		{
			msg=msg+"Debes rellenar el E-mail.\n";
		}//fin if
		else
		{
			if(((document.formu.txtEmail.value.search(exclude) != -1)||(document.formu.txtEmail.value.search(check)) == -1)||(document.formu.txtEmail.value.search(checkend) == -1))
			{
				msg=msg+"Debe introducir un email correcto\n";
			}//fin if
		}//fin else
		if(document.formu.txtNombre.value=="")
		{
			msg=msg+"Debes rellenar el nombre de la mascota.\n";
		}//fin if		
		if(document.formu.raza.selectedIndex == 0){
			msg=msg+"Debes seleccionar la raza de la mascota.\n";
		}					
		if(document.formu.txtSintomas.value=="")
		{
			msg=msg+"Debes rellenar los síntomas.\n";
		}//fin if	
		if(!(document.formu.ckAlimentoH.checked) && 
			!(document.formu.ckAlimentoS.checked) &&
			!(document.formu.ckAlimentoC.checked))
		{
			msg=msg+"Especifica al menos un tipo de alimento.\n";
		}
		if(getRadioButtonSelectedValue(document.formu.rdUtilizaRC)=="no" && 
			document.formu.txtCome.value==""){
			msg=msg+"Por favor, indica el nombre comercial del alimento. \n";
		}	
		var dia, mes, anyo;
		dia = document.formu.diaUV.options[document.formu.diaUV.selectedIndex].value;
		mes = document.formu.mesUV.options[document.formu.mesUV.selectedIndex].value;
		anyo = document.formu.anyoUV.options[document.formu.anyoUV.selectedIndex].value;
		if(!(esFecha(parseInt(dia,10),parseInt(mes,10),parseInt(anyo,10)))){
			msg=msg+"La fecha de la última visita al veterinario debe ser una fecha válida";
		}
		if(msg)
		{
			alert(msg);
		}//fin if
		else
		{
			document.formu.hdnSexo.value=getRadioButtonSelectedValue(document.formu.rdSexo);
			document.formu.hdnEsterilizado.value = getRadioButtonSelectedValue(document.formu.rdEsterilizado);
			document.formu.hdnLongitudPelo.value = getRadioButtonSelectedValue(document.formu.rdLongitudPelo);			
			document.formu.hdnExterior.value=getRadioButtonSelectedValue(document.formu.rdExterior);
			document.formu.hdnPeso.value=getRadioButtonSelectedValue(document.formu.rdPeso);
			document.formu.hdnConvive.value=getRadioButtonSelectedValue(document.formu.rdConvive);			
			if(getRadioButtonSelectedValue(document.formu.rdCambio)){
				document.formu.hdnCambio.value=getRadioButtonSelectedValue(document.formu.rdCambio);
			}
			else{
				document.formu.hdnCambio.value = "0";
			};
			document.formu.hdnDesdeCuando.value=getRadioButtonSelectedValue(document.formu.rdDesdeCuando);
			document.formu.hdnVacunado.value=getRadioButtonSelectedValue(document.formu.rdVacunado);
			document.formu.hdnUtilizaRC.value=getRadioButtonSelectedValue(document.formu.rdUtilizaRC);
			document.formu.submit();
		}//fin else		
	}//fin funcion

	function getRadioButtonSelectedValue(ctrl)
	{
		for(i=0; i<ctrl.length; i++)
		{
			if(ctrl[i].checked) 
			{
				return ctrl[i].value;
			}//fin if
		}//fin for
	}//fin funcion
	
	function pasarPagina(p)
	{
		document.formu2.hdnPagina.value=p;
		document.formu2.hdnVerFotos.value=1;
		document.formu2.submit();
	}
	
	function retrocederPagina(p)
	{
		document.formu3.hdnPagina.value=p;
		document.formu3.hdnVerFotos.value=1;
		document.formu3.submit();
	}
