function setcal() {
	$('.evt').each(function() {
		$(this).data('e',$(this).attr('title'));
		$(this).removeAttr('title');
	});
	$('.evt').click(function(event) {
		event.preventDefault();
		$('.selected').removeClass('selected');
		$(this).parent().addClass('selected');
		$('#calEvents').html($(this).data('e'));
		$('.pop').click( function(e) {
			var t=$(this).attr('title');
			tb_show(t, $(this).attr('href')+'?disp=1&KeepThis=true&TB_iframe=true&height=400&width=500');
			e.preventDefault();
		}); 
	});	
	$('#cal_month a').click(function(event) {
		var d=$(this).attr('href');
		if (d.substr(0,1)=='?') {
			d=d.substr(1);
			event.preventDefault();
			$.ajax({
				type: "GET",
				url: "sCal.php",
				data: d,
				success: function(c) {
					$('#smallcal').html(c);
					setcal();
				}
			});
		}
	});
}
$(document).ready(function() {
	setcal();
});
