function toggleTagged(obj, tag) {
	$('#cluetip-close').click(); //trigger the cluetip close since things will shift
	if ($(obj).attr('rel')!='show') {
		$(obj).attr('rel','show').removeClass('off');
		$('.'+tag).fadeIn('normal');
	} else {
		$(obj).attr('rel','hide').addClass('off');
		$('.'+tag).fadeOut('normal');
	}
	return false;
} //toggleTagged()
$(document).ready(function(){
	$('.caltable:first').before('<ul id="tag_toggles"><li><strong>Toggle events:</strong></li><li><a href="javascript:return false;" id="show_vulcans" rel="show" title="Toggle Vulcans events">Vulcans</a></li><li><a href="javascript:return false;" id="show_theater" rel="show" title="Toggle Theater events">Theater</a></li><li><a href="javascript:return false;" id="show_general" rel="show" title="Toggle all other events">General</a></li></ul>');
	$('#show_vulcans').bind('click',function(){toggleTagged($(this), 'vul_tag');return false;});
	$('#show_theater').bind('click',function(){toggleTagged($(this), 'the_tag');return false;});
	$('#show_general').bind('click',function(){toggleTagged($(this), 'gen_tag');return false;});
	$('a.cluetip').cluetip({attribute: 'href', closePosition: 'title', arrows: true, dropShadowSteps: 3, sticky: true});
});
