$().ready(function() {
	
	/*$("#city-from").parent("p").addClass("off");
	$("#city-from").attr("disabled", "disabled");
	$("#city-to").parent("p").addClass("off");
	$("#city-to").attr("disabled", "disabled");*/
	
	$("#country-from").autocomplete('/quote/api/get_countries', {
		minChars: 0,
		max: 100,
		autoFill: true,
		mustMatch: false,
		matchContains: false,
		scrollHeight: 220,
		width: 170
	});
	
	/*$('#country-from').result(function(event, data, formatted) {
		$("#city-from").parent(".off").removeClass("off");
		$("#city-from").removeAttr("disabled").focus();
	});*/
	
	$("#city-from").autocomplete('/quote/api/get_cities', {
		minChars: 0,
		max: 100,
		autoFill: true,
		mustMatch: false,
		matchContains: false,
		scrollHeight: 220,
		width: 170,
		extraParams: {
			country: function() { return $("#country-from").val(); }
		}

	});
	
	$("#country-to").autocomplete('/quote/api/get_countries', {
		minChars: 0,
		max: 100,
		autoFill: true,
		mustMatch: false,
		matchContains: false,
		scrollHeight: 220,
		width: 170
	});
	
	$('#country-to').result(function(event, data, formatted) {
		$("#city-to").parent(".off").removeClass("off");
		$("#city-to").removeAttr("disabled").focus();
	});
	
	$("#city-to").autocomplete('/quote/api/get_cities', {
		minChars: 0,
		max: 100,
		autoFill: true,
		mustMatch: false,
		matchContains: false,
		scrollHeight: 220,
		width: 170,
		extraParams: {
			country: function() { return $("#country-to").val(); }
		}

	});
	
	//$('.explain').tooltip({showURL: false});
	

});