<!--
function Valida(Form){

/*
	if(Form.Origen.value == ""){
		alert('Debe indicar el lugar de origen ...');
		Form.Origen.focus();
		return false;
	}
	if(Form.Destino.value == ""){
		alert('Debe indicar el lugar de destino ...');
		Form.Destino.focus();
		return false;
	}
	if(Form.NumPas.value == ""){
		alert('Debe indicar el numero de pasajeros ...');
		Form.NumPas.focus();
		return false;
		
	}
*/
	if(!isValidDate(Form.FechaInicio.value)){
			Form.FechaInicio.value = '';
			Form.FechaInicio.focus();
			return false;
		}
	if(!isValidDate(Form.FechaFin.value)){
			Form.FechaFin.value = '';
			Form.FechaFin.focus();
			return false;
		}
   if(!campararFechas(Form.FechaInicio.value,Form.FechaFin.value))
   {
      Form.FechaFin.value = '';
	  Form.FechaFin.focus();
	  return false;
   }   
}

function campararFechas(FechaInicial,FechaFin){

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
var matchArrayF = FechaFin.match(datePat);
var matchArrayI = FechaInicial.match(datePat);

monthI = matchArrayI[3]; // parse date into variables
dayI = matchArrayI[1];
yearI = matchArrayI[4];

monthF = matchArrayF[3]; // parse date into variables
dayF = matchArrayF[1];
yearF = matchArrayF[4];

primeraFecha = new Date(yearI,monthI,dayI);
segundaFecha = new Date(yearF,monthF,dayF);

diasdif = Math.ceil((segundaFecha - primeraFecha)/86400000);

if(diasdif < 0){
	alert("La fecha de inicio debe ser posterior a la fecha de partida...");
}
else
{
return true;
}
//return true;
}

function makeRedirect(Form)
{

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
var matchArrayF = Form.FechaFin.value.match(datePat);
var matchArrayI = Form.FechaInicio.value.match(datePat);

monthI = matchArrayI[3]; // parse date into variables
dayI = matchArrayI[1];
yearI = matchArrayI[4];

monthF = matchArrayF[3]; // parse date into variables
dayF = matchArrayF[1];
yearF = matchArrayF[4];

ArrayMes = Array();
ArrayMes['01'] = "JAN";
ArrayMes['02'] = "FEB";
ArrayMes['03'] = "MAR";
ArrayMes['04'] = "APR";
ArrayMes['05'] = "MAY";
ArrayMes['06'] = "JUN";
ArrayMes['07'] = "JUL";
ArrayMes['08'] = "AUG";
ArrayMes['09'] = "SEP";
ArrayMes['10'] = "OCT";
ArrayMes['11'] = "NOV";
ArrayMes['12'] = "DEC";


	var strVar = "https://www.dotres.com/meridia?";

	strVar += "posid=5LQA&";
	strVar += "page=requestAirMessage_air&";
	strVar += "action=airRequest&";
	strVar += "currency=COP&";
	strVar += "departCity=" + escape(Form.Origen.value) + "&";

	strVar += "depMonth=" + ArrayMes[monthI] + "&"; // MES partida
	strVar += "depDay=" + dayI  + "&"; // DIA partida

	strVar += "depTime=0600&";
	strVar += "returnCity=" + escape(Form.Destino.value) + "&";

	strVar += "retMonth=" + ArrayMes[monthF] + "&"; // MES regreso
	strVar += "retDay="+ dayF + "&"; // DIA regreso
	
	strVar += "retTime=0600&";
	strVar += "direction=returntravel&";
	strVar += "ADT="+ Form.NumPas.value + "&";
	strVar += "classService=CoachClass&";
	strVar += "flightType=0&";
	strVar += "actionType=flex&";
	strVar += "language=es&";
	strVar += "ccCode=XX&";
	strVar += "dcCode=XX&";
	strVar += "profilepassthrough=yes&";

	strVar += "guest=" + 'http%3A%2F%2Fwww%2Eexpresoviajes%2Ecom';

	window.location.href = strVar;

return false;
}


function CampoFecha(Campo){

	if(Campo.value.length == 2 || Campo.value.length == 5)
		Campo.value = Campo.value + '/';
	
	if(window.event.keyCode == 47)
		event.returnValue = false;
	
	if(Campo.value.length >= 10 || (event.keyCode < 48) || (event.keyCode > 57))
		event.returnValue = false;

	if(Campo.value.length == 10)
		if(!isValidDate(Campo.value)){
			Campo.value = '';
			Campo.focus();
		}
	
}


function isValidDate(dateStr) {
// Checks for the following valid date formats:
// MM/DD/YY MM/DD/YYYY MM-DD-YY MM-DD-YYYY
// Also separates date into month, day, and year variables

// To require a 4 digit year entry, use this line instead:
var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (dateStr==""){
return true
}
if (matchArray == null) {
alert("El formato de la Fecha debe ser dd/mm/aaaa")
return false;
}
month = matchArray[3]; // parse date into variables
day = matchArray[1];
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("El mes debe estar entre 1 y 12.");
return false;
}
if (day < 1 || day > 31) {
alert("DÕa debe estar entre 1 y 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Este mes no tiene 31 dÕas!")
return false
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("Febrero " + year + " no tiene " + day + " dias!");
return false;
}
}
if (year < 2004) {
alert("El aÐo debe ser mayor o igual a 2004")
return false
}

var daynew = new Date();

if (year < daynew.getYear()) {
alert("La fecha debe ser superior a la actual")
return false
}

if (month < (daynew.getMonth()+1) && year == daynew.getYear()) {
alert("La fecha debe ser superior a la actual")
return false
}

if (day < (daynew.getDate()) && month == (daynew.getMonth()+1) && year == daynew.getYear()) { 
alert("La fecha debe ser superior a la actual")
return false
}

return true; // date is valid
}
-->