<!--  Begin

function EscribeAniosCorrectosNN4() {
// if (document.all) {
       var Fecha=new Date()
       var Anio=Fecha.getFullYear()
       var Anio2=Fecha.getFullYear() +1

       document.forms[0].elements[15].length = 2;
       document.forms[0].elements[15].options[0].value = Anio;
       document.forms[0].elements[15].options[0].text = Anio;

       document.forms[0].elements[15].options[1].value = Anio2;
       document.forms[0].elements[15].options[1].text = Anio2;

       document.forms[0].elements[18].length = 2;
       document.forms[0].elements[18].options[0].value = Anio;
       document.forms[0].elements[18].options[0].text = Anio;

       document.forms[0].elements[18].options[1].value = Anio2;
       document.forms[0].elements[18].options[1].text = Anio2;
 // }
}

//Escribe el aņo actual y el que sigue en la forma, depende de la fecha de la maquina
function EscribeAniosCorrectosIE4() {
  var Fecha=new Date()
  var Anio=Fecha.getFullYear()

  var oOption = document.createElement("OPTION");
  oOption.text=Anio;
  oOption.value=Anio;
  document.forms[0].elements[15].add(oOption);

  var oOption2 = document.createElement("OPTION");

  oOption2.text=Anio+1;
  oOption2.value=Anio+1;
  document.forms[0].elements[15].add(oOption2);

  var oOption3 = document.createElement("OPTION");
  oOption3.text=Anio;
  oOption3.value=Anio;
  document.forms[0].elements[18].add(oOption3);

  var oOption4 = document.createElement("OPTION");
  oOption4.text=Anio+1;
  oOption4.value=Anio+1;
  document.forms[0].elements[18].add(oOption4);
 
}


//Checa que los datos esten correctamente escritos en la forma
function ChecaRequeridos() {
    if (isEmail() && isFname() && FechaCorrecta() && nPersonasCorrectas()){
        return true;
    }else {
        return false;
    }
}

function isEmail() {

   if (document.forms[0].elements[11].value == "") {
		alert ("\n The E-Mail field is blank. \n\n Please enter your E-Mail address.")
		document.forms[0].elements[11].focus();
		return false;
	}
	if (document.forms[0].elements[11].value.indexOf ('@',0) == -1 ||
		document.forms[0].elements[11].value.indexOf ('.',0) == -1) {
		alert ("\n The E-Mail field requires a \"@\" and a \".\"be used. \n\nPlease re-enter your E-Mail address.")
		document.forms[0].elements[11].select();
		document.forms[0].elements[11].focus();
		return false;
	}
	return true;
}

function isFname() {
	if (document.forms[0].elements[0].value == "")	{
		alert ("\n The Name field is blank. \n\n Please enter your name.")
		document.forms[0].elements[0].focus();
		return false;
	}
	return true;
}

function FechaCorrecta() {
  var Fecha=new Date()

  var Dia=Fecha.getDate()
  var Mes=Fecha.getMonth()
  var Anio=Fecha.getFullYear()

	if (document.forms[0].elements[13].selectedIndex == 0)	{
		alert ("\n It has not selected a day of arrival.")
		document.forms[0].elements[13].focus();
		return false;
	}

	if (document.forms[0].elements[14].selectedIndex == 0)	{
		alert ("\n It has not selected a month of arrival.")
		document.forms[0].elements[14].focus();
		return false;
	}

   var DiaSel = document.forms[0].elements[13].selectedIndex;
   var MesSel = document.forms[0].elements[14].selectedIndex-1;
   var AnioSel = document.forms[0].elements[15].value;

   var FechaSeleccionada= new Date(AnioSel, MesSel, DiaSel);
   var FechaActual= new Date(Anio,Mes,Dia);
  
   if (FechaSeleccionada < FechaActual) {
   		alert("The date of arrival is smaller to the present one, writes a correct date or reviews date of his PC")
		return false;
   }
   return true;

}

function nPersonasCorrectas() {
	if (document.forms[0].elements[19].value == "")	{
        alert ("Specify the no. of adult people");
		document.forms[0].elements[19].focus();
		return false;
	}
	if (document.forms[0].elements[20].value == "")	{
        alert ("Specify the no. of children");
		document.forms[0].elements[20].focus();
		return false;
	}
    return true;
}

// End

//-->
