function getMonth(url) {
$('#ajax-content').append('<div class="wait"></div>');
$('#ajax-content').load(
 url + ' #veranstaltungen',
 function(response, status, xhr) {
 if (status == 'success') {
$('#ajax-content .wait').remove();
initAjaxForCalendar();
 }
 });
}
function initAjaxForCalendar() {
$('.monthPicker a').click(function() {
 getMonth($(this).attr('href'));
 return false;
});
$('.dayRow a').cluetip({
  local: true,
  attribute: 'rel',
  closePosition: 'bottom',
  closeText: '',
  /*delayedClose: 15000,*/
  sticky: true,
  mouseOutClose: true,
  arrows: true,
  width: '280',
  positionBy: 'auto',
//  onActivate: function(e) {return console.log(e);},
  onShow: function(ct, c){ 
      var arrowPos = (ct.height() / 2) - (ct.find('div#cluetip-arrows.cluetip-arrows').height() / 2) + 7.5;      
      var ctOffset = ct.offset();
      var ctPos = ctOffset.top - (arrowPos + 2);

      ct.find('div#cluetip-arrows.cluetip-arrows').css('top', arrowPos);
      ct.css('top', ctPos + 'px');
  },
  topOffset: function() {  return; },
  leftOffset: 15,
  showTitle: false,
  cluetipClass: 'custom',
  arrows: true,
  dropShadow: false,
  waitImage: true
});

}

$(document).ready(function() {
initAjaxForCalendar();

$("#veranstaltungen .calendar span.termin").hover(
 function() {
 $(this).addClass('eventVisible');
 },
 function() {
 $(this).removeClass('eventVisible');
 }
);
});
