function controlaentradas()
{
dialleg=document.ventas2.diallegada.options[document.ventas2.diallegada.selectedIndex].value;
meslleg=document.ventas2.mesllegada.options[document.ventas2.mesllegada.selectedIndex].value;

mesposible=document.ventas2.mesposible.value;
diaposible=document.ventas2.diaposible.value;

//se controla que la fecha seleccionada no sea menor a la fecha posible

if (parseInt(meslleg)<parseInt(mesposible))
{
	alert("Solo se pueden reservar entradas a partir de 2 días de la fecha actual");
	return false;
}




if (parseInt(meslleg)==parseInt(mesposible))
{


	if (parseInt(dialleg) < parseInt(diaposible))
	{
		alert("Solo se pueden reservar entradas a partir de 2 días de la fecha actual");
		return false;
	}

}

if (dialleg.length==1)
{
dialleg='0' + dialleg
}

if (meslleg.length==1)
{
meslleg='0'+meslleg
}

fechafinal=dialleg + '/' + meslleg + '/' + '2003'

error=compruebafechaespanol(fechafinal)
if (error!=0)
{
	alert("La fecha seleccionada no es una fecha válida");
	return false;
}





return true;
}

function controlaedades()
{
	numentradas=document.ventas.numentradas.value;
	for (i=1;i<=numentradas;i++)
	{
	nombre="document.ventas.edad" + i +".options[document.ventas.edad"+i+".selectedIndex].value"
	edad=eval(nombre)
	if (edad=='')
	{
		alert("Introduce todas las edades");
		return false;
	}

	}
	return true;
}
