function show_cities_div() {
	var myDiv = document.getElementById('cities_div');
	myDiv.style.display = 'block';
}
$('#c_div').click(function(event){
     event.stopPropagation();
 });
$('html').click(function(e) {
	if ($(e.target).is('#cities_div')) return;
	if ($('#cities_div').is(":visible")) {
		$('#cities_div').hide();
	}
});
function show_cities(country_id, lang) {
	if (!lang) lang = 'ru';
	if (!country_id) return;
	$("#country_select").disabled = true;
	$("#prev_btn").disabled = true;
	$("#next_btn").disabled = true;
			$.ajax( {
			url : "/ajax/get_cities.php?country=" + country_id + "&lang=" + lang,
			type: "get",
			dataType : 'text',
			success : function(data) {
				$("#city_select").empty();

				if (data != "") {
					lang == 'ru' ? $("#city_select").append( $('<option value="0">[ Выберите город ]</option>') ) : $("#city_select").append( $('<option value="0">[ Select city]</option>') )
					//$("#city_select").options[0].style.color = "#888888";

					var new_cities = data.split("\n")
					for (var i = 0; i < new_cities.length; i++) {
						if (new_cities[i] != "") {
							var o = new_cities[i].split(":")
							$("#city_select").append( $('<option value="'+o[0]+'">'+o[1]+'</option>') )
						}
					}
					//$("#cities").show();
					slideDiv('cities',1);
				} else {
					lang == 'ru' ? $("#city_select").append( $('<option value="0">[ Выберите город ]</option>') ) : $("#city_select").append( $('<option value="0">[ Select city]</option>') )
					//$("#cities").hide();
					slideDiv('cities',0);
				}
				$("#country_select").disabled = false
				$("#prev_btn").disabled = false;
				$("#next_btn").disabled = false;
			},
			error : function() {
				alert('Ошибка загрузки данных.')
			}
		});
		
}
	$(document).ready(function(){
	$('#price').trackbar({
		onMove : function() {
			setVal(this.leftValue, this.rightValue);
		},
		dual : true, 
		leftLimit : 100,
		leftValue : 100,
		rightLimit : 1000,
		rightValue : 1000,
		width : 150,
		
	});
	function setVal(l, r) {
		document.getElementById("minPrice").value = l;
		document.getElementById("maxPrice").value = r;
	}
	});

function applyFilter() {
	


}




