function validar(formulario) {

valor = document.getElementById("Name").value;
valor2 = document.getElementById("Surnames").value;
valor3 = document.getElementById("Email").value;
valor4 = document.getElementById("Email2").value;
valor5 = document.getElementById("Telephone").value;
valor7 = document.getElementById("Ships").value;

valor6 = document.getElementById("DateService").value;

valor9 = document.getElementById("Place").value;

valor15 = document.getElementById("wheelchair");




// Name-----------------------------------------
if( valor == null || valor.length == 0 || /^\s+$/.test(valor) || !/^[A-Za-z\ñ\Ñ\á\é\í\ó\ú\Á\É\Í\Ó\Ú\ä\ë\ï\ö\ü\Ä\Ë\Ï\Ö\Ü\ç\Ç\_\-\.\s\xF1\xD1]+$/.test(valor)) {
	alert("Insertar nombre v\u00e1lido.");
    reserva.Name.focus();
  return false;
}
// Surname-----------------------------------------
if( valor2 == null || valor2.length == 0 || /^\s+$/.test(valor2) || !/^[A-Za-z\ñ\Ñ\á\é\í\ó\ú\Á\É\Í\Ó\Ú\ä\ë\ï\ö\ü\Ä\Ë\Ï\Ö\Ü\ç\Ç\_\-\.\s\xF1\xD1]+$/.test(valor2) ) {
	alert("Insertar apellido v\u00e1lido.");
    reserva.Surnames.focus();
  return false;
}
// Email-----------------------------------------
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(valor3) == false) {
	alert("Insertar E-mail v\u00e1lido.");
   reserva.Email.focus();
  return false;
}
   
if (valor4 != valor3){
	alert("El E-mail y E-mail de confirmaci\u00F3n deben ser los mismos");
    reserva.Email2.focus();
  return false;
}
// Phone-----------------------------------------
if(isNaN(valor5) || valor5 == null || valor5.length == 0 || /^\s+$/.test(valor5)) {
	alert("Insertar tel\u00e9fono (SIN ESPACIOS)");
    reserva.Telephone.focus();
  return false;
}

// CRUISE Ships--------------------------------------

if( valor7 == null || valor7.length == 0 || /^\s+$/.test(valor7)) {
	alert("Insertar nombre del crucero.");
    reserva.Ships.focus();
  return false;
}

// Arriving--------------------------------------
 
var fecha_actual = new Date()  
var dia = fecha_actual.getDate()  
var mes = fecha_actual.getMonth() + 1  
var anio = fecha_actual.getFullYear()
 if (mes < 10)  
        mes = '0' + mes  
  
    if (dia < 10)  
        dia = '0' + dia 

var actualDate = dia + "/" + mes + "/" + anio;

 if (valor6 < actualDate || valor6.length !=10) {
	alert("Insertar fecha de recogida v\u00e1lida.");
    reserva.DateService.focus();
return false;
}

d1=valor6.charAt(0) // d
d2=valor6.charAt(1) // d
s1=valor6.charAt(2) // /
m1=valor6.charAt(3) // m
m2=valor6.charAt(4) // m
s2=valor6.charAt(5) // /
y1=valor6.charAt(6) // y
y2=valor6.charAt(7) // y
y3=valor6.charAt(8) // y
y4=valor6.charAt(9) // y


d1ac=actualDate.charAt(0) // d
d2ac=actualDate.charAt(1) // d
s1ac=actualDate.charAt(2) // /
m1ac=actualDate.charAt(3) // m
m2ac=actualDate.charAt(4) // m
s2ac=actualDate.charAt(5) // /
y1ac=actualDate.charAt(6) // y
y2ac=actualDate.charAt(7) // y
y3ac=actualDate.charAt(8) // y
y4ac=actualDate.charAt(9) // y


// ---------------------comparar

var fechaActualFormat = y1ac+y2ac+y3ac+y4ac+m1ac+m2ac+d1ac+d2ac
var fechaValor6Format = y1+y2+y3+y4+m1+m2+d1+d2

 if (fechaValor6Format < fechaActualFormat) {
	alert("Insertar fecha de recogida v\u00e1lida.");
    reserva.DateService.focus();
return false;
}
// --------------------


if (isNaN(d1) || isNaN(d2) || isNaN(m1) || isNaN(m2) || isNaN(y1) || isNaN(y2) || isNaN(y3) || isNaN(y4) ){
	alert("Insertar fecha de recogida v\u00e1lida (dd/mm/yyyy).");
    reserva.DateService.focus();
return false;
}

if ((d1==0 && d2==0) || (m1==0 && m2==0) || (y1==0 && y2==0) && (y3==0 && y4==0)){
	alert("Insertar fecha de recogida v\u00e1lida.");
    reserva.DateService.focus();
return false;
}

if ((d1+d2 > 31) ||( m1+m2>12)){
	alert("Insertar fecha de recogida v\u00e1lida.");
	reserva.DateService.focus();
return false;
}

// Time -------------------------------------------
valor20 = document.getElementById("hrA").selectedIndex;
if( valor20 == null || valor20 == 0 ) {
	alert("seleccione Hora de recogida (Hora). ");
	reserva.hrA.focus();
  return false;
}

valor21 = document.getElementById("minA").selectedIndex;
if( valor21 == null || valor21 == 0 ) {
	alert("seleccione Hora de recogida (Minutos). ");
	reserva.minA.focus();
  return false;
}

// PICK UP PLACE--------------------------------------

if( valor9 == null || valor9.length == 0 || /^\s+$/.test(valor9)) {
	alert("Seleccione Lugar de recogida. ");
    reserva.Place.focus();
  return false;
}

// Passenger--------------------------------------

valor11 = document.getElementById("Passenger").selectedIndex;
if( valor11 == null || valor11 == 0 ) {
	alert("Seleccione N\u00B0 de ocupantes.");
	reserva.Passenger.focus();
  return false;
}

// TOUR--------------------------------------

valor13 = document.getElementById("Tour").selectedIndex;
if( valor13 == null || valor13 == 0 ) {
	alert("Seleccione Excursi\u00F3n. ");
	reserva.Tour.focus();
  return false;
}


// Eurotaxi--------------------------------------

if (valor11 >= 5 && valor15.checked){
	alert("Eurotaxi solo disponible hasta 4 pasajeros");
  return false;
}

}
