
function showHideEvents(g) {
	//	Based on set checkboxes, show and hide events
	var g = $(".event_filter").find(":checked");
	if (g.length>0) {
		$("#primary .event").hide();
		g.each(function() {
			gt = $(this).val();
			$("#primary ." + gt ).show();
		});
	} else {
		$("#primary .event").show();
	}
}

$(document).ready(function() {
	
	$(".event_filter .checkbox").change(showHideEvents);
	
	// manage in-bound hash links to events page...
	eurl = document.location.toString();
	if (eurl.indexOf("events.html")!=-1){
		var ehash = document.location.hash;
		// trim "#"
		if(ehash.length>0) ehash = ehash.substring(1,ehash.length);
		// if the hash value matches the value of a checkbox, set it true...
		$(".event_filter .checkbox").each(function() {
			if ($(this).val()==ehash) $(this).attr("checked",true);
		});
		showHideEvents();
	}
	
});
