<!--
	function SplitDuration()
	{
		var strVal, arDuration;

		strVal = document.frmTripSearch.TourDuration.value;

		if (strVal.indexOf('-') > -1)
		{
			arDuration = strVal.split('-');
			document.frmTripSearch.DurationDaysMin.value = arDuration[0];
			document.frmTripSearch.DurationDaysMax.value = arDuration[1];
		}
		else if (strVal.length == 1)
		{
			document.frmTripSearch.DurationDaysMin.value = 0;
			document.frmTripSearch.DurationDaysMax.value = 0;
		}
		else
		{
			document.frmTripSearch.DurationDaysMin.value = 13;
			document.frmTripSearch.DurationDaysMax.value = 999;
		}

		//alert(document.frmTripSearch.DurationDaysMin.value + ',' + document.frmTripSearch.DurationDaysMax.value);
	}


	function SubmitSearch()
	{
		document.frmTripSearch.action.value='search';
		document.frmTripSearch.submit();
	}

	function OrderResults(orderFld)
	{
		var direction;

		if ((document.frmResults.Direction.value == '') || (document.frmResults.Direction.value == 'desc'))
		{
			direction = 'asc';

		}
		else
		{
			direction = 'desc';
		}


		document.frmResults.Order.value = orderFld;
		document.frmResults.Direction.value = direction;
		document.frmResults.submit();

		//document.location = document.location + '&amp;Order=' + orderFld + '&amp;Direction=' + direction;
	}


	function SubmitDropdown()
	{
		document.frmTripSearch.action.value='';
		document.frmTripSearch.submit();
	}
	
/*
	function changeCity(objRegion, objOption)
	{
		//alert(intSelectedIndex);
		//alert(objOption.text);
		var intSelRegionID = objRegion.options[objRegion.selectedIndex].value;
		var intSelCityRegionID = objOption.label;
		//alert(objOption.label);
		//alert(objRegion.options[objRegion.selectedIndex].value);
		if (intSelRegionID != intSelCityRegionID && intSelCityRegionID != '')
		{
			//alert('change');
			for (i=0; i<objRegion.options.length; i++)
			{
				//alert();
				if (objRegion.options[i].value == intSelCityRegionID)
				{
					objRegion.options[i].selected = true;
				}
			}
		}
	}
*/

/********************************************************
 *  Mod P2_CR_663 by Paul Heasley on 24.01.2007
 *  
 *  These functions create a dynamic trip finder 
 *  using AJAX technologies for Sahara and Connections.     
 ********************************************************/

	
	var aryRegions = new Array();
	
	function updateCities(objRegion, objCity) {
		if (objRegion.selectedIndex == 0) {
			var strDefaultCity = objCity.options[0].text;
			objCity.options.length = 0;
			objCity.options[objCity.options.length] = new Option(strDefaultCity, '');
		} else {
			for(var i = 0; i < aryRegions.length; i++) {
				if(aryRegions[i].RegionID == objRegion[objRegion.selectedIndex].value) {
				  var strDefaultCity = objCity.options[0].text;
					objCity.options.length = 0;
					objCity.options[objCity.options.length] = new Option(strDefaultCity, '');
					for(var j = 0; j < aryRegions[i].CityArray.length; j++) {
						objCity.options[objCity.options.length] = new Option(aryRegions[i].CityArray[j].Name, aryRegions[i].CityArray[j].CityID);
					}
				}
			}
		}
	}
	
	function Region(intRegionID, strRegionName) {
		this.RegionID = intRegionID;
		this.Name = strRegionName;
		this.CityArray = new Array();
		this.AddCity = AddCity;
		
		function AddCity(intCityID, strCityName) {
  		var objTmpCity = new City(intCityID, strCityName);
  		this.CityArray[this.CityArray.length] = objTmpCity;
  		
      function City(intCityID, strCityName) {
    		this.CityID = intCityID;
    		this.Name = strCityName;
    	}	
  	}
	}

  function loadXMLDoc(url, processor) {
    if (window.XMLHttpRequest) {
      req = new XMLHttpRequest();
      req.onreadystatechange = processor;
      req.open("GET", url, true);
      req.send(null);
    } else if (window.ActiveXObject) {
      isIE = true;
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) {
        req.onreadystatechange = processor;
        req.open("GET", url, true);
        req.send();
      }
    }
  }
   
  function processRegions() {
    var objRegionSelect = document.frmTripSearch.DestinationRegion_ID
    // only if req shows "loaded"
    if (req.readyState == 4) {
      // only if "OK"
      if (req.status == 200) {
        var objRegion;
        var xmlDoc = req.responseXML;
        var destRegion = xmlDoc.getElementsByTagName("DestinationRegion");
        var destCity = xmlDoc.getElementsByTagName("DestinationCity");
        var strDefaultRegion = objRegionSelect.options[0].text;
        objRegionSelect.options.length = 0;
        objRegionSelect.options[objRegionSelect.options.length] = new Option(strDefaultRegion, '');
        for (var i = 0; i < destRegion.length; i++) {
          objRegion = new Region(childValue(destRegion[i], "DestinationRegion_Document_ID"), childValue(destRegion[i], "Title"));
          for (var j = 0; j < destCity.length; j++) {
            if (childValue(destRegion[i], "DestinationRegion_Document_ID") == childValue(destCity[j], "DestinationRegion_Document_ID")) {
              objRegion.AddCity(childValue(destCity[j], "DestinationCity_Document_ID"), childValue(destCity[j], "Title"));
            }
          }
          aryRegions[aryRegions.length] = objRegion;
          objRegionSelect.options[objRegionSelect.options.length] = new Option(childValue(destRegion[i], "Title"), childValue(destRegion[i], "DestinationRegion_Document_ID"));
        }
      } else {
        objRegionSelect.options[objRegionSelect.options.length] = new Option('Trip Finder Unavailable', '');
      }
    }
  }
  
  function childValue(nodParent, strChildName) {
    return nodParent.getElementsByTagName(strChildName)[0].firstChild.nodeValue
  }
  
  function doTripFinderSearch()
  {
	if (document.frmTripSearch.keyword.value == "")
	{
		//Tour Search
		document.frmTripSearch.Document_ID.value='15302';
		
	} else {
		//Keyword Search
		document.frmTripSearch.Document_ID.value='15589';

	}
	document.frmTripSearch.submit();
  }
  
//-->
