
// JavaScript Document


function validarregistro123() {
	alert("Validamos");
	var x;
	var cad = new Array("Nombre", "Email","Nombre", "Contrasena", "ContrasenaRep");
	var fin=0;

	for (x =0; x<5; x++)
	{
		campo = document.getElementById(cad[x]);
		if(campo.value == "") {
			alert("Debes insertar el siguiente campo .");
			campo.focus();
			fin=1;
			x=4;
		}
		else {
			alert(cad[x]);
		}
	}
	if (fin==0) {
		document.getElementById("insertarregistro").submit();
	}
}

function oculta(campo){
	campo = document.getElementById(campo);
	if(campo.style.display == "none")
		campo.style.display = "block";
	else
		campo.style.display = "none";
}	

function activa(campo)
{
	combo = document.getElementById(campo);
	miest = document.getElementById('div_estudio');
	
	
	if(combo.selectedIndex == 5)
	{
		miest.style.display = "block";
	}
	else
	{
		miest.style.display = "none";
	}
}

function valora(id)
{
	cad = id.split("_");
	lim = parseInt(cad[1]);
	

	for(i = 1; i <= lim; i++)
	{
		document.getElementById("estrella_"+i).src="img/estrella_on.gif";
	}
	
	for(i = lim+1 ; i <= 5 ; i++)
	{
		document.getElementById("estrella_"+i).src="img/estrella_off.gif";
	}
	
	document.getElementById("valoracion").value = lim;
}

function validaEvento(form)
{
	retorno = true;
	campo = "";
	tengo = 0;
	for(i = 0 ; i < form.length && retorno ; i++)
		if(form.elements[i].value == "")
		{			
			if(form.elements[i].name == "IdEDMAficion" && tengo == 0)
			{
				retorno = false;
				campo = form.elements[i].title + " "+form.elements[i].name ;
			}
			else
			{
				if(form.elements[i].name == "IdEDMAficion" && tengo == 1)
				{
					//retorno = true;
				}
				else
				{
					if(form.elements[i].name != "IdEDMActividad")
					{
						retorno = false;
						campo = form.elements[i].title + " "+form.elements[i].name ;
					}
				}
			}
		}
		else
		{
			 if(form.elements[i].name == "IdEDMActividad")
			 {
				tengo = 1;
			 }
		}
		
	if(!retorno)
	{
		alert(campo + " es obligatorio.");
	}
	return retorno;
}

			
