// JavaScript Document

function loadCountry(country) {
	if (country.value !== 'na') {
		document.location = 'index.aspx?Country=' + encodeURIComponent(country.value);
	}
}

function gotoApart(country, city) {
	if (country.value !== 'na') {
		if (city.value !== 'na') {
			document.location = '/Apartments/results.aspx?Country=' + encodeURIComponent(country.value) + '&city=' + encodeURIComponent(city.value) + '&Area=*&Bedrooms=All';
		}
	}
}

function resultsGoToApart(country, city, bedrooms) {
	//alert(country.value + city.value + bedrooms.value)
	if (country.value !== 'na') {
		if (city.value !== 'na') {
			//alert('/Apartments/results.aspx?Country=' + encodeURIComponent(country.value) + '&city=' + encodeURIComponent(city.value) + '&Area=*&Bedrooms=' + bedrooms.value);
			//country.value.replace(/ /i, "_");
			
			document.location = '/Apartments/results.aspx?Country=' + encodeURIComponent(country.value) + '&city=' + encodeURIComponent(city.value) + '&Area=*&Bedrooms=' + bedrooms.value;
		}
	}
}

function ApartLoadDropDowns(country) {

	var globalSelect = document.getElementById('apart-drop');

	for(var i = 0; i < globalSelect.options.length; i++) {

		if(globalSelect.options[i].value == country) {
			globalSelect.options[i].selected = true;
		}
	}

	LoadFeed('/includes/apart-city-drop.aspx?Country=' + document.getElementById('apart-drop').value, 'apart-city', '&lt;p&gt;Loading Cities...&lt;/p&gt;', '');
}