$(document).ready(function(){
	var tooltip_ids = [];
	$('a.tooltip').each(function(i){
		var rel = $.trim($(this).attr('rel'));
		tooltip_ids[tooltip_ids.length] = 'ids[]='+rel;
	});
	
	$.ajax({
		async: false
		,type: "GET"
		,url: "/ajax/qry_Tooltips.php"
		,data: tooltip_ids.join('&')
		,dataType: "script"
	});

	if(typeof tooltips == "object")
	{
		for (var id in tooltips)
			$('a[rel="'+id+'"]').append('<div class="tooltip" style="display: none;">'+tooltips[id]+'</div>');
	}

	$("div.tooltip").hide();
	var tooltips_visible = false;
	
	$("a.tooltip").hover( function(event) {
		if (!tooltips_visible) {
			$(this).children("div.tooltip").fadeIn();
			tooltips_visible = true;
		}
	},
	function (event) {
		if (tooltips_visible) {
			$(this).children("div.tooltip").fadeOut("fast", function() { tooltips_visible = false; });
		}
	});
/*	
	$('#calendar-nav a').click(function(){
		$.ajax({
			async: false
			,type: "POST"
			,dataType: "script"
			,url: config_dir+'ajax/qry_EventsCalendar.js.php'
			,data: 'date='+$(this).attr('href')
			,error: function(XMLHttpRequest, textStatus, errorThrown){
				alert("Unable to request events calendar. Please try again later.");
			}
			//,success: function(msg){
			//	alert(msg);
			//}
		});
		if(table_contents)
		{
			$('#calendar').fadeOut('fast'
									, function(){
										$(this).html(table_contents).fadeIn('fast', function(){
											$("div.tooltip").hide();
											var tooltips_visible = false;
											$("a.tooltip").hover( function(event) {
												if (!tooltips_visible) {
													$(this).children("div.tooltip").fadeIn();
													tooltips_visible = true;
												}
											},
											function (event) {
												if (tooltips_visible) {
													$(this).children("div.tooltip").fadeOut("fast", function() { tooltips_visible = false; });
												}
											});
										})
									});
			$('#prev-month a').attr('href', prev_date);
			$('#next-month a').attr('href', next_date);
		}
		return false;
	});
*/
});