<!--
/* <![CDATA[ */

function SetPriceType(theForm,val)
{
	//window.alert(theForm + ", " + val);
	theForm.PriceType.value=val;
}

function TravelPackagesValidation(theForm)
{
  if (theForm.PriceType.value=="")
  {
    alert("You must first select a Package before you can add it to your Itinerary.");
    if(theForm.TravelPackagesID.length > 1)
    	theForm.TravelPackagesID[0].focus();
    else
    	theForm.TravelPackagesID.focus();
    return (false);
  }
  
  // DepartureDate
  if (theForm.DepartureDate.value.length < 1)
  {
    alert("Please enter a Departure Date for your listing.");
    theForm.DepartureDate.focus();
    return (false);
  }

  if (theForm.DepartureDate.value.length != 10)
  {
    alert("Please enter a valid Departure Date using the format yyyy-mm-dd.");
    theForm.DepartureDate.focus();
    return (false);
  }

  var checkOK1 = "0123456789";
  var checkOK2 = "-";
  var checkStr = theForm.DepartureDate.value;
  var checkStr1 = checkStr.substring(0,4);
  var checkStr2 = checkStr.substring(5,7);
  var checkStr3 = checkStr.substring(8,10);
  var finalStr1 = checkStr1 + checkStr2 + checkStr3;
  var checkStr4 = checkStr.substring(4,5);
  var checkStr5 = checkStr.substring(7,8);
  var finalStr2 = checkStr4 + checkStr5;
  
  var allValid = true;
  for (i = 0;  i < finalStr1.length;  i++)
  {
    ch = finalStr1.charAt(i);
    for (j = 0;  j < checkOK1.length;  j++)
      if (ch == checkOK1.charAt(j))
        break;
    if (j == checkOK1.length)
    {
      allValid = false;
      break;
    }
  }
  
  if(allValid==true)
  {
	  for (i = 0;  i < finalStr2.length;  i++)
	  {
	    ch = finalStr2.charAt(i);
	    for (j = 0;  j < checkOK2.length;  j++)
	      if (ch == checkOK2.charAt(j))
	        break;
	    if (j == checkOK2.length)
	    {
	      allValid = false;
	      break;
	    }
	  }
  }
  
  if (!allValid)
  {
    alert("You have not entered a correctly formated Departure Date. Please use the format, yyyy-mm-dd.");
    theForm.DepartureDate.focus();
    return (false);
  }
  
// ReturnDate
  if (theForm.ReturnDate.value.length < 1)
  {
    alert("Please enter a Return Date for your listing.");
    theForm.ReturnDate.focus();
    return (false);
  }

  if (theForm.ReturnDate.value.length != 10)
  {
    alert("Please enter a valid Return Date using the format yyyy-mm-dd.");
    theForm.ReturnDate.focus();
    return (false);
  }

  var checkOK1 = "0123456789";
  var checkOK2 = "-";
  var checkStr = theForm.ReturnDate.value;
  var checkStr1 = checkStr.substring(0,4);
  var checkStr2 = checkStr.substring(5,7);
  var checkStr3 = checkStr.substring(8,10);
  var finalStr1 = checkStr1 + checkStr2 + checkStr3;
  var checkStr4 = checkStr.substring(4,5);
  var checkStr5 = checkStr.substring(7,8);
  var finalStr2 = checkStr4 + checkStr5;
  
  var allValid = true;
  for (i = 0;  i < finalStr1.length;  i++)
  {
    ch = finalStr1.charAt(i);
    for (j = 0;  j < checkOK1.length;  j++)
      if (ch == checkOK1.charAt(j))
        break;
    if (j == checkOK1.length)
    {
      allValid = false;
      break;
    }
  }
  
  if(allValid==true)
  {
	  for (i = 0;  i < finalStr2.length;  i++)
	  {
	    ch = finalStr2.charAt(i);
	    for (j = 0;  j < checkOK2.length;  j++)
	      if (ch == checkOK2.charAt(j))
	        break;
	    if (j == checkOK2.length)
	    {
	      allValid = false;
	      break;
	    }
	  }
  }
  
  if (!allValid)
  {
    alert("You have not entered a correctly formated Return Date. Please use the format, yyyy-mm-dd.");
    theForm.ReturnDate.focus();
    return (false);
  }

  return (true);
}


/* ]]> */
//-->
