function calendar_switch(year, activity) {
	
	//reseting the list and revealing all the location tables
	$('.region_table').show();
	
	//hiding and revealing departures based on which radio button is clicked
 	switch ( activity ) {
        case "all" :
            $(".departure-" + year + "-bike").show();
            $(".departure-" + year + "-hike").show();
            $(".departure-" + year + "-multi").show();
            $(".departure-" + year + "-insider").show();
            break;
        case "bike" :
            $(".departure-" + year + "-bike").show();
            $(".departure-" + year + "-hike").hide();
            $(".departure-" + year + "-multi").hide();
            $(".departure-" + year + "-insider").hide();
            break;
        case "hike" :
            $(".departure-" + year + "-bike").hide();
            $(".departure-" + year + "-hike").show();
            $(".departure-" + year + "-multi").hide();
            $(".departure-" + year + "-insider").hide();
            break;
        case "multi" :
            $(".departure-" + year + "-bike").hide();
            $(".departure-" + year + "-hike").hide();
            $(".departure-" + year + "-multi").show();
            $(".departure-" + year + "-insider").hide();
            break;
        case "insider" :
            $(".departure-" + year + "-bike").hide();
            $(".departure-" + year + "-hike").hide();
            $(".departure-" + year + "-multi").hide();
            $(".departure-" + year + "-insider").show();
            break;
        case "family" :
            $(".departure-" + year + "-family").show();
            $(".departure-" + year + "-classic").hide();
            break;
        case "classic" :
            $(".departure-" + year + "-family").hide();
            $(".departure-" + year + "-classic").show();
            break;
    };
 		
 		//hiding all tables that have all of their contents hidden
		$('.region_table:not(:has(.departures:visible))').hide(); 
		
		//removing all of the odd classes off all the rows
    	$('table tbody tr').removeClass('odd');
    	
    	//re-assigning the odd classes based on the visibility of the row
    	$('.region_table').each(function(){
    		$('tr.departures:visible:odd', this).addClass('odd');
    	});	
};

function activity_switch(region, activity) {
	
	//reseting the list and revealing all the location divs
	$('.location').show();
 
 	//hiding and revealing trip type trip divs based on which radio button is clicked
    switch ( activity ) {
        case "all" :
            $(".trip").show();
            break;
        default :
        	$(".trip").hide();
            $(".trip-" + region + "-" + activity).show();
            break;    
	};   
	 
    //hiding all divs that have all of their contents hidden
    $('.location:not(:has(.trip:visible))').hide(); 
        
    //removing all of the first classes off all the divs
    $('.trip, .location').removeClass('first'); 
	
	// looking for the first visible trip div in each location div
	$('.location').each(function(){ 
      $('div.trip:visible:first', this).addClass('first'); 
    });  
	
	// looking for the first visible location div in each region div
	$('.region').each(function(){ 
      $('div.location:visible:first', this).addClass('first'); 
    });
 };

