// JavaScript Document
<!--
function addDays(myDate,days) {
    return new Date(myDate.getTime() + days*24*60*60*1000);
}
varDate = addDays(new Date(),5);

function checkAirportCode(){
//set cookies

setCookie('Adt', document.QueryForm.ADT[document.QueryForm.ADT.selectedIndex].value, varDate)
setCookie('Chd', document.QueryForm.CHD[document.QueryForm.CHD.selectedIndex].value, varDate)
setCookie('Inf', document.QueryForm.Infants[document.QueryForm.Infants.selectedIndex].value, varDate)

setCookie('From', document.QueryForm.DepAptCode.value, varDate)
setCookie('Destination', document.QueryForm.menuArrAptCode.value, varDate)
setCookie('DestinationDisplay', document.QueryForm.txtArrAptCode.value, varDate)
setCookie('DestinationHidden', document.QueryForm.ArrAptCode.value, varDate)

setCookie('DepDay', document.QueryForm.DepDay.value, varDate)
setCookie('DepMonYr', document.QueryForm.DepMonthYear.value, varDate)

setCookie('RetDay', document.QueryForm.RetDay.value, varDate)
setCookie('RetMonYr', document.QueryForm.RetMonthYear.value, varDate)

	if (document.QueryForm.ArrAptCode.value != 'U/L') {
		if (!CheckDate()) {
			return false;
		}
	} else {
		alert('Please choose a destination before proceeding');
		return false;
	}
	if ((document.QueryForm.DepMonthYear[document.QueryForm.DepMonthYear.selectedIndex].value + document.QueryForm.DepDay[document.QueryForm.DepDay.selectedIndex].value) > (document.QueryForm.RetMonthYear[document.QueryForm.RetMonthYear.selectedIndex].value + document.QueryForm.RetDay[document.QueryForm.RetDay.selectedIndex].value)) {
		alert('Return date is before departure date.\nPlease correct and try again.')
		return false;
	}
	return true;
}

function changeDest(strDest,strCode) {
	document.QueryForm.txtArrAptCode.value=(document.QueryForm.menuArrAptCode[document.QueryForm.menuArrAptCode.selectedIndex].text + ' (' + document.QueryForm.menuArrAptCode[document.QueryForm.menuArrAptCode.selectedIndex].value + ')').toUpperCase();
	document.QueryForm.ArrAptCode.value=(document.QueryForm.menuArrAptCode[document.QueryForm.menuArrAptCode.selectedIndex].value).toUpperCase();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function SubmitEmailForm(){

	if (isEmailAddr(document.SubEmail.email.value)){
	window.open('about:blank','ThankYou','width=250,height=200,menubar=no,scrollbars=no');
	document.SubEmail.submit();
	}
	else
	{alert('Your email address seems to be invalid')}
}
function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function FormValidator(theForm)
{

  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"email\" field.");
    theForm.email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.email.value))
  {
    alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    theForm.email.focus();
    return (false);
  }
   
  if (theForm.email.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"email\" field.");
    theForm.email.focus();
    return (false);
  }
  return (true);
}
//-->
