var MAG = Object.extend({}, MAG || {});
MAG.Bulgaria = {
	init: function(options)
	{
		this.options = {};
		Object.extend(this.options, options || {});

		if($('choose_city')) $('choose_city').observe('change', this.onChangeCity.bind(this));
		if($('choose_quarter')) $('choose_quarter').observe('change', this.onChangeQuarter.bind(this));
	},

	onChangeCity: function(e)
	{
		var city = Event.element(e);

		if (city.value == 0) {
			value = '';
		} else {
			value = '?city=' + city.value;
		}
		window.location = this.options.url + value;
	},

	onChangeQuarter: function(e)
	{
		var quarter = Event.element(e);

		if (quarter.value == 0) {
			city = $('choose_city');
			if (city.value != 0) {
				value = '?city=' + city.value;
			} else {
				value = '';
			}
		} else {
			value = '?quarter=' + quarter.value;
		}
		window.location = this.options.url + value;
	}
};
