var sublocation_id = new Array();
var sublocation_name = new Array();





























































sublocation_id[1] = new Array();
sublocation_name[1] = new Array();
	sublocation_id[1][0] = 18;
	sublocation_name[1][0] = "Central London";
	sublocation_id[1][1] = 1;
	sublocation_name[1][1] = "\u00a0\u00a0\u00a0Bayswater & Paddington";
	sublocation_id[1][2] = 2;
	sublocation_name[1][2] = "\u00a0\u00a0\u00a0Kensington & Earls Court";
	sublocation_id[1][3] = 6;
	sublocation_name[1][3] = "\u00a0\u00a0\u00a0Knightsbridge & Chelsea";
	sublocation_id[1][4] = 4;
	sublocation_name[1][4] = "\u00a0\u00a0\u00a0Victoria & Westminster";
	sublocation_id[1][5] = 3;
	sublocation_name[1][5] = "\u00a0\u00a0\u00a0West End & Oxford Street";
	sublocation_id[1][6] = 19;
	sublocation_name[1][6] = "The City & Docklands";
	sublocation_id[1][7] = 7;
	sublocation_name[1][7] = "\u00a0\u00a0\u00a0Canary Wharf & Docklands";
	sublocation_id[1][8] = 5;
	sublocation_name[1][8] = "\u00a0\u00a0\u00a0City & Tower Bridge";
	sublocation_id[1][9] = 23;
	sublocation_name[1][9] = "North London";
	sublocation_id[1][10] = 24;
	sublocation_name[1][10] = "\u00a0\u00a0\u00a0Kings Cross";
	sublocation_id[1][11] = 25;
	sublocation_name[1][11] = "\u00a0\u00a0\u00a0Regents Park & Maida Vale";
	sublocation_id[1][12] = 26;
	sublocation_name[1][12] = "Greater London";
	sublocation_id[1][13] = 22;
	sublocation_name[1][13] = "\u00a0\u00a0\u00a0Battersea";
	sublocation_id[1][14] = 27;
	sublocation_name[1][14] = "\u00a0\u00a0\u00a0Hampton & Kingston Upon Thames";
	sublocation_id[1][15] = 12;
	sublocation_name[1][15] = "\u00a0\u00a0\u00a0Heathrow";
	sublocation_id[1][16] = 17;
	sublocation_name[1][16] = "\u00a0\u00a0\u00a0Richmond & Twickenham";
	sublocation_id[1][17] = 21;
	sublocation_name[1][17] = "\u00a0\u00a0\u00a0Staines";















sublocation_id[16] = new Array();
sublocation_name[16] = new Array();
	sublocation_id[16][0] = 15;
	sublocation_name[16][0] = "Gosforth";
	sublocation_id[16][1] = 13;
	sublocation_name[16][1] = "Newcastle/Gateshead";
	sublocation_id[16][2] = 16;
	sublocation_name[16][2] = "Tynemouth";



































function showSublocations(city_id) {
	// remove the sub-location section if it exists
	if (document.getElementById("sub-dt"))
		document.getElementById("sub-dt").parentNode.removeChild(document.getElementById("sub-dt"));
	if (document.getElementById("sub-dd"))
		document.getElementById("sub-dd").parentNode.removeChild(document.getElementById("sub-dd"));
	// check if the city has sublocations
	if (sublocation_id[city_id]) {		
		// generate the dt
		var dt = createElem("dt","id:sub-dt");
		var label = createElem("label","for:sublocation");
		var label_text = document.createTextNode("Sublocation");
		label.appendChild(label_text);
		dt.appendChild(label);		
		// generate the dd
		var dd = createElem("dd","id:sub-dd");
		var select = createElem("select","name:sublocation|id:sublocation|tabindex:2");
		var blank_option = createElem("option","value:");
		var blank_option_text = document.createTextNode("All Sub-locations");
		blank_option.appendChild(blank_option_text);
		select.appendChild(blank_option)
		//loop through each sublocation
    	for (var i=0;i<sublocation_id[city_id].length;i++) {
            if ((undefined !== window.current_sub) && (current_sub == sublocation_id[city_id][i])) {
                var option = createElem("option","value:"+sublocation_id[city_id][i]+"|selected:selected");
            }
            else {
                var option = createElem("option","value:"+sublocation_id[city_id][i]);
            }
			var option_text = document.createTextNode(sublocation_name[city_id][i]);
			option.appendChild(option_text);
			select.appendChild(option);
		}
		dd.appendChild(select);		
		// add it to the page
		document.getElementById("dl").insertBefore(dt,document.getElementById("nights-dt"));
		document.getElementById("dl").insertBefore(dd,document.getElementById("nights-dt"));		
	}
}

function createElem(elem,atts) {
	var element = document.createElement(elem);
	if (atts) {
		var attributes = atts.split("|");
		for (var i=0;i<attributes.length;i++) {
			var att = attributes[i].split(":")[0];
			var val = attributes[i].split(":")[1];
			element.setAttribute(att,val);
		}
	}
	return element;
}

function initSublocations() {
	var city_id = document.getElementById("city").value;
	showSublocations(city_id);
    current_city = city_id;
}
addLoadEvent(initSublocations);
		