// jQuery is running in noConflict mode, so we have to re-assign $ before we can use it.
jQuery(function($){
	// Read the values from the hidden fields and set things correctly.
	$('#sortBy').val($('#sb').val());
	$('a[rel="' + $('#dc').val() + '"]').addClass('selected');
	
	// Category click handler
	$('.displayCategory').click(function(event){
		location.hash = '';
		location.search = '?dc=' + $(this).attr('rel') + '&sb=' + $('#sortBy').val();
	});
	
	// Sort by dropdown change handler
	$('#sortBy').change(function(){
		location.hash = '';
		location.search = '?dc=' + $('#dc').val() + '&sb=' + $(this).val();
	});
	
	if (!$('#details #futureEvents').length) {
		$('#feature').css({ border: 'none', marginBottom: 0 });
	}
});
