// initialise plugins
$(document).ready(function() {
	$('ul.sf-menu').superfish({
	animation:   {opacity:'show',height:'show'}, 
	dropShadows: false
	});
	

	$('#cat-menus .head').toggle(
		function() { 		
			$(this).children('span').text('-').parent().next().slideDown('slow');
		},
		function() { 
			$(this).children('span').text('+').parent().next().slideUp('slow');
		}).children('span').text('+').parent().next().hide();	
		
		
	$('.refinements-list').hide();
		
		


	$('a.filter-distance').toggle(
		function() { 			
			pos_filter = $(this).position();			
		//	alert(pos_filter.top);			
			$(this).next('div').addClass('filterblock').css('left',pos_filter.left + 'px').show();
		},
		function() { 
			$(this).next('div').hide();
			relis = $(this).attr("rel");
			// alert(relis);
			if (relis == 'radio_distance') { 
				$('span.filter-distance').text( $("input[name=refinementsradius]:checked").val());
			}
			else {
				$('span.filter-sort').text( $("input[name=refinementsort]:checked").val());
			}
			
		});


	$('a.close-list').click(function() { 
		
		$(this).parent().remove('filterblock').toggle();
		
			relis = $(this).attr("rel");
			// alert(relis);
			if (relis == 'radio_distance') { 
				$('span.filter-distance').text( $("input[name=refinementsradius]:checked").val());
			}
			else {
				$('span.filter-sort').text( $("input[name=refinementsort]:checked").val());
			}
		
		
		// $('span.filter-distance').text( $("input[name=refinementsradius]:checked").val());

	});
	
		
});



