// ********** RESORT FUNCTION ***************************

 //<![CDATA[ 
 // array of Resorts in the same order as they appear in the Resort selection list 
var resortLists = new Array(4) 
resortLists["All Destinations"] = ["Select a Resort", "Cancun Palace", "Beach Palace", "Sun Palace" , "Moon Palace (Cancun)", "Aventura Spa Palace", "Xpu-Ha Palace", "Playacar Palace", "Cozumel Palace" , "Vallarta Palace" , "Isla Mujeres Palace" , "Moon Palace (Punta Cana)"]; 
resortLists["Cancun, Mexico"] = ["Cancun Palace", "Beach Palace", "Sun Palace" , "Moon Palace Golf & Spa Resort"]; 
resortLists["Riviera Maya, Mexico"] = ["Aventura Spa Palace", "Xpu-Ha Palace", "Playacar Palace"]; 
resortLists["Cozumel, Mexico"] = ["Cozumel Palace"]; 
resortLists["Riviera Nayarit, Mexico"]= ["Vallarta Palace"];
resortLists["Isla Mujeres, Mexico"]= ["Isla Mujeres Palace"];
resortLists["Punta Cana, Dominican Republic"]= ["Moon Palace Casino, Golf & Spa"];  
 /* ResortChange() is called from the onchange event of a select element. 
 * param selectObj - the select object which fired the on change event. 
 */ 
 function resortChange(selectObj) { 
 // get the index of the selected option 
 var idx = selectObj.selectedIndex; 
 // get the value of the selected option 
 var which = selectObj.options[idx].value; 
 // use the selected option value to retrieve the list of items from the resortLists array 
 cList = resortLists[which]; 
 // get the resort select element via its known id 
 var cSelect = document.getElementById("resort"); 
 // remove the current options from the resort select 
 var len=cSelect.options.length; 
 while (cSelect.options.length > 0) { 
 cSelect.remove(0); 
 } 
 var newOption; 
 // create new options 
 for (var i=0; i<cList.length; i++) { 
 newOption = document.createElement("option"); 
 newOption.value = cList[i];  // assumes option string and value are the same 
 newOption.text=cList[i]; 
 // add the new option 
 try { 
 cSelect.add(newOption);  // this will fail in DOM browsers but is needed for IE 
 } 
 catch (e) { 
 cSelect.appendChild(newOption); 
 } 
 } 
 } 
//]]>
