function getCities() {  
   var url = "/content/data/airportGroupList.xml";
   url = url + "?dummy=" + new Date().getTime();  
   request.open("GET", url, true);
   request.onreadystatechange = getCityList;
   request.send(null);
}

var xmlList;

function loadIt() {
   self.onerror = function() { return true; }
	var bff_form = document.forms["bookNowForm"];
	var fs_form  = document.forms["flightStatusForm"];
   fromList     = bff_form.s0m3valu3;
   toList       = bff_form.out_arr_airport;
   fromIdx      = fromList.selectedIndex;
   toIdx        = toList.selectedIndex; 
}

function getCityList() {
   if (request.readyState == 4) {
      if (request.status == 200) {  
         var xmlList = request.responseXML;
         bff_form = document.forms["bookNowForm"];
	      fs_form = document.forms["flightStatusForm"];           
         buildCities(bff_form.elements["s0m3valu3"],"bff_form"); 
         buildCities(bff_form.elements["out_arr_airport"],"bff_form"); 
         buildCities(fs_form.elements["origin"],"fs_form");
         buildCities(fs_form.elements["destination"],"fs_form");        
         applyDropdownCookies("s0m3valu3");         
         cityFilter();                         
      } else {    
         /* xml request failed...  */               
         PopulateCities(bff_form.elements["s0m3valu3"]);
         PopulateCities(bff_form.elements["out_arr_airport"]);
        	PopulateCities(fs_form.elements["origin"]);
         PopulateCities(fs_form.elements["destination"]);      
      }
   }
}

function buildCities(theObj,whichForm,whichToSelect) {  
   self.onerror = function() { return true; }   
   var xmlList = request.responseXML;
   var itemLst  = xmlList.getElementsByTagName('list_item');
   var valueLst = xmlList.getElementsByTagName('value');
   var textLst  = xmlList.getElementsByTagName('text');
   var newelement = 1;
   if (typeof(whichToSelect) == 'undefined') var whichToSelect = "";
   for (i = 0; i < itemLst.length; i++) {    
      cityText  = textLst[i].firstChild.nodeValue;      
      cityValue = valueLst[i].firstChild.nodeValue;
      cityAttr  = textLst[i].getAttribute('class');       
      if ((cityAttr == null) && (whichForm == 'fs_form')) {  
         var option = new Option (cityText, cityValue); 
         theObj.options[newelement] = option;  newelement++;       
      }          
      if (whichForm == 'bff_form') {     
         if (cityAttr == 'indent') {         
            cityText = (String.fromCharCode(160, 160, 160, 160, 160) + cityText);
         }         
         var option = new Option (cityText, cityValue);        
         if (cityAttr == 'cityarea') {     
            option.setAttribute('class', cityAttr);                   
         } 
         theObj.options[newelement] = option;  newelement++;        
      }         	
   }    
}      
