$(document).ready(function(){
	$('.lnk-delete').click(function(){
		window.location = $(this).attr('href');
		return false;
	});	
	
	//Переключение кнопок купить/снять
	$("#buy-type").click(function(){
		
		$(this).attr('class', 'btn-buy-cottage');				
		$("#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-cottage');
		$("#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_mkad_from']").val('');
		$("input[name='buy_mkad_to']").val('');
		
		$("input[name='rent_mkad_from']").val('');
		$("input[name='rent_mkad_to']").val('');
		
		$("input[name='room']").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('');
		
		$("select[name='buy_road'], select[name='buy_place'], select[name='rent_road'], select[name='rent_place']").attr('selectedIndex', 0);
		$("select[name='buy_price_unit'], select[name='rent_price_unit']").attr('selectedIndex', 0);
		
		return false;
	});
	
	
	$('#sbtype1_1, #sbtype1_2, #sbtype1_3').click(function(){
		if ($(this).attr('id') == 'sbtype1_3')
		{
			$('.search_price_caption').html('Стоимость за сотку:');
		}
		else
		{
			$('.search_price_caption').html('Стоимость за домовладение:');
		}
	});
				
});
