
//Used to Output the hotel menu listed on the left, bottom-corner of KOR sites
function print(val){
	
	// VARIABLE "val" IS USED TO MATCH THE ID OF THE HOTEL PAGE THAT SHOULD DEFAULT IN THE POP-DOWN MENU
	// hotels ARRAY - 0 VALUE = "SHOW ALL HOTELS"
	// FOR EACH NEW HOTEL ADDED, YOU MUST ADD THE HOTEL NAME FOLLOWED BY "|" FOLLOWED BY THE HOTEL'S ID
	// THE LIST WILL BE SORTED AUTOMATICALLY

	var hotels = new Array();
	hotels[1] = "Avalon Beverly Hills|1919";
	hotels[3] = "Chamberlain West Hollywood|2317";
	hotels[4] = "Tides Riviera Maya|2827";
    hotels[5] = "Tides Zihuatanejo|2805";
	hotels[6] = "Maison 140 Beverly Hills|1920";
	hotels[7] = "Tides South Beach|2319";
	hotels[8] = "Viceroy Palm Springs|1921";
	hotels[9] = "Viceroy Santa Monica|1922";
    hotels[11] = "Viceroy Miami|23399";
    hotels[12] = "Viceroy Anguilla|19595";
    hotels[13] = "Viceroy Snowmass|24803";

	// create a copy of the array
	var hotelsCopy = hotels.slice();
	
	// sort array
	hotels.sort();

	var delimiter = "_JOIN_";

	// add the "Show all Hotels" option after the array was sorted to the beginning of the string version of the array
	var hotelString = "Show all Hotels|0" + delimiter + hotels.join(delimiter);

	// conver the string back to an array, with the "Select all Hotels" at the first position
	hotels = hotelString.split(delimiter);

	// get selected hotel id before sorting array
	//var selectedHotelID = hotels[val].substring(0, hotels[val].indexOf("|"));
	var selectedHotelID = hotelsCopy[val].substring(hotelsCopy[val].indexOf("|") + 1, hotelsCopy[val].length);

	var str = '<td colspan="3"><select name="hotelId" class="hotelselect">';

	for (i=0; i<hotels.length; i++)
	{
		var hotelName = hotels[i].substring(0, hotels[i].indexOf("|"));
		var hotelID = hotels[i].substring(hotels[i].indexOf("|")+1, hotels[i].length);
		
		// since the array definition starts with 1, there's a record with an empty value
		// so now, we skip the empty array record
		if (!hotelID) {
			continue;
		}

		str = str + '<option ';

		if(hotelID == selectedHotelID){
			str = str + 'selected ';
		}

		str = str + 'value='+ hotelID + '>' + hotelName + '</option>';
		
	}
	str = str + '</select></span></td>';

	/*// IE DETECTION BECAUSE OF ODD SPACING, WE USE AN EXTRA <BR /> FOR THIS BROWSER		
	if(navigator.appName.indexOf('Microsoft') != -1){	
		document.write("<br />");		
	}*/
	
	//OUTPUT THE OPTION LIST
	document.write(str);

}

function resDetails( ){
	
	
	document.write('<td>');
	document.write('<select name="nights" value="" onChange="setDates(false);" class="resefields">');
	document.write('<option value="1">1</option>');
	document.write('<option value="2">2</option>');
	document.write('<option value="3">3</option>');
	document.write('<option value="4">4</option>');
	document.write('<option value="5">5</option>');
	document.write('<option value="6">6</option>');
	document.write('<option value="7">7</option>');
	document.write('<option value="8">8</option>');
	document.write('<option value="9">9</option>');
	document.write('<option value="10">10</option>');
	document.write('<option value="11">11</option>');
	document.write('<option value="12">12</option>');
	document.write('<option value="13">13</option>');
	document.write('<option value="14">14</option>');
	document.write('</select>');
	document.write('</td>');
	document.write('<td><select name="adult" class="resefields">');
	document.write('<option value="1">1</option>');
	document.write('<option value="2">2</option>');
	document.write('<option value="3">3</option>');
	document.write('<option value="4">4</option>');
	document.write('</select></td>');
	document.write('<td><select name="child" class="resefields">');
	document.write('<option value="0">0</option>');
	document.write('<option value="1">1</option>');
	document.write('<option value="2">2</option>');
	document.write('<option value="3">3</option>');
	document.write('<option value="4">4</option>');
	document.write('</select></td>');

}

function RemoveChar(str)
{
	var str2 ='';
	for(i=0; i<str.length; i++){
		str2 = str.replace(/"/, "");
		str = str2;
	}
	document.write(str2);

}