$(document).ready(function() {
	//$('#search_filter .subcity').hide();
    $('#search_filter #CityParentId').change(function(e) {
		if($(this).val().indexOf('http://') != -1){
			window.open($(this).val());
			e.preventDefault();
		} else {
		val = $(this).val();
        $.getJSON('/cities/listCities/'+ val, {}, function(j) {
			if(val != ''){
				window.location.replace('/cities/view/' + val);
			}
        });
		}
    })
   // $('#search_filter #CityParentId').change();
	
	
	$('#CityId').change(function(){
		window.location.replace('/cities/view/' + $(this).val());
	});
	
	
	$('#citySearch').click(function(e){
		val = $('#search_filter #CityParentId').val();
		if(val != ''){
					window.location.replace('/cities/view/' + val);
		}
		e.preventDefault();
	});
	
	$('#PropertiesId').change(function(){
		window.location.replace($(this).val());
	});
	
	
});


