Filters = {
	location: new LocationFilter(),
	brands: new ComplexListFilter('Бренды', '/filters/brands/', {
		selected: '#selected-brands',
		hidden: 'brand_id'
	}),
	companies: new ComplexListFilter('Компании', '/filters/companies/', {
		selected		: '#selected-companies',
		hidden			: 'company_id'
	}),
	trends: new ComplexListFilter('Тренды', '/filters/trends/', {
		selected: '#selected-trends',
		hidden: 'trend_id',
		width: 800,
		height: 400
	}),
	styles: new ComplexListFilter('Стили', '/filters/styles/', {
		selected: '#selected-styles',
		hidden: 'style_id',
		width: 800,
		height: 200
	}),
	purpose: new ComplexListFilter('Назначение', '/filters/purpose/', {
		selected: '#selected-purposes',
		hidden: 'purpose_id',
		width: 800,
		height: 200
	}),
	color: new ComplexListFilter('Цвет', '/filters/color/', {
		selected: '#selected-colors',
		hidden: 'color_id',
		width: 800,
		height: 400
	}),
	goodsgroups: new ComplexListFilter('Товары', '/filters/goodsgroups/', {
		selected: '#selected-goodsgroups',
		hidden: 'goodsgroup_id'
	}),
	customergroups: new ComplexListFilter('Кому', '/filters/customergroups/', {
		selected: '#selected-customergroups',
		hidden: 'customergroup_id',
		width: 800,
		height: 200
	}),
	price: {
		pane: $('<div/>'),
		selection_pane: null,// панель, в которой показываем, что выбрано в данном фильтре (на странице)
		selected: null,
		setSelected: function(html, price_range) {
			
			Filters.price.selected = price_range;
			
			if (! Filters.price.selection_pane) {
				Filters.price.selection_pane	= $('<div/>');// панель, в которой показываем, что выбрано в данном фильтре
				$('#filters-selection').append(Filters.price.selection_pane);
			}
			
			if (html) {
				Filters.price.selection_pane.html('<b>Цена: </b>' + html + '<input type="hidden" name="price" value="' + price_range + '" />');
				
				var clear_filter_button = $('<button class="filter-clear">&times;</button>');
				clear_filter_button.click(function() {
					Filters.price.selection_pane.empty();
					Filters.price.selection_pane.hide();
					Filters.price.selected = {};
					that.pane.find('input[type="radio"]').each(function(){
						this.checked = false;
					});
				});
				Filters.price.selection_pane.append(clear_filter_button);
				
				Filters.price.selection_pane.show();
			} else {
				Filters.price.selection_pane.html('');
				Filters.price.selection_pane.hide();
			}
			
		},
		show: function() {
			$.blockUI({
				message: Filters.price.pane,
				centerX: true, 
	    		centerY: true,
	    		css: {
	    			width:	'300px',
	    			height:	'250px',
	    			top:	'50%',
	    			left:	'50%',
	    			margin:	'-125px 0 0 -150px',
	    			cursor:	'normal'
	    		}
			});
			Filters.price.pane.text('loading...');
			Filters.price.pane.load('/filters/price/', function() {
				if (Filters.price.selected) {
					var r = Filters.price.pane.find('input[value="' + Filters.price.selected + '"]');
					if (r.length) {
						r.click();
					} else {
						$('#custom-price-range').val(Filters.price.selected);
					}
				}
			});
		},
		close: function() {
			$.unblockUI();
		}
	}
}
