jQ(document).ready(function() {
	/*
	jQ("#obsah :not(.kalendar .dny .akce)").bind('mouseover', function() {
		jQ(".dayActions").hide();
	});
	jQ("#obsah :not(.kalendar .dny .akce)").css('backgroundColor', 'red');
	*/
	jQ("#obsah .kalendar .dny DIV:not(.akce)").bind('mouseover', function() {
		jQ(".dayActions").hide();
	});
	jQ("#obsah .kalendar .dny .akce").unbind('mouseover').bind('mouseover', function(e) {
		jQ(".dayActions").hide();
		var idParts = jQ("A", this).attr('id').split('-');
		var dayId = idParts[1];
		if (dayId) {
			showCalendarActions(e, dayId, calDays[dayId]);
		}
	});
});

function showCalendarActions(e, id, actions) {
	if (!e) e = window.event;
	if (jQ.isArray(actions)) {
		var calendarContainer = jQ("#den-"+id).parent().parent().parent();
		var actionsContainer = jQ(".dayActions", calendarContainer);
		actionsContainer.empty();
		jQ.each(actions, function(key,action) {
			if (typeof action == 'object') {
				actionsContainer.append('<a href="detail-zavodu.php?id='+action.id+'" title="'+action.name+'">'+action.name+'</a>');
			}
		});
		actionsContainer.css('top', (e.clientY + 5 + jQ(window).scrollTop())+'px');
		actionsContainer.css('left', (e.clientX - 5)+'px');
		actionsContainer.show();
	}
}
 
