$(document).ready(function(){
	$('.lnk-delete').click(function(){
		window.location = $(this).attr('href');
		return false;
	});	
	
	//Переключение кнопок купить/снять
	$("#buy-type").click(function(){
		
		$(this).attr('class', 'btn-buy-office');				
		$("#rent-type").attr('class', 'btn-rent');
		
		$("#hdntype").val('buy');
		
		$("#table_rent_search").hide();
		$("#table_buy_search").show();
	});
	$("#rent-type").click(function(){
		
		$(this).attr('class', 'btn-rent-office');
		$("#buy-type").attr('class', 'btn-buy');
		$("#hdntype").val('rent');
		
		$("#table_buy_search").hide();
		$("#table_rent_search").show();
	});	
	
	/*-------- Очистить блок для поиска */
	$('#clear-search-block').click(function(e){
		
		
		$("input[name='buy_square_from']").val('');
		$("input[name='buy_square_to']").val('');
		
		$("input[name='rent_square_from']").val('');
		$("input[name='rent_square_to']").val('');
		
		$("input[name='buy_price_from']").val('');
		$("input[name='buy_price_to']").val('');
		
		$("input[name='rent_price_from']").val('');
		$("input[name='rent_price_to']").val('');
		
		$("input[name='buy_lot']").val('');
		$("input[name='rent_lot']").val('');
		
		$("input[name='buy_class[]'], input[name='rent_class[]']").attr('checked', '');
		$("select[name='buy_price_unit'], select[name='rent_price_unit']").attr('selectedIndex', 0);
		
		return false;
	});
	
	
	$('#a_show_metro_map').click(function(){
		$('#metro_canvas').slideToggle();
		if ($('#a_show_metro_map span').html() == 'показать схему метрополитена')
			$('#a_show_metro_map span').html('скрыть схему метрополитена');
		else
			$('#a_show_metro_map span').html('показать схему метрополитена');
			
		return false;
	});
				
});	
