// Global scripts (all pages)


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

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

	});
	
	$('#revolve').cycle( {
		timeout: 5000,
		pause: 1
	});
	
	$('.calc-popup').bind('click', function() {
		window.open($(this).attr('href'),'box_calc','width=644,height=345,scrollbars=no');		
		return false;
	});

});