function pop(url, width, height) {
  var options = "width=" + width + ",height=" + height + ",";
  options    += "resizable=no,scrollbars=yes,status=no,";
  options    += "menubar=no,toolbar=no,location=no,directories=no";
  var newWin  = window.open(url, 'newWin', options);
  newWin.focus();
}

function ap_open(parent_id, id) {
  $('#ap_' + parent_id + ' ul').hide();
  $('#ap_' + id).show();
}

function ap_show(id) {
  $('#calendarcontent').load('calendar_content.php', {id: id});
}

function cal_go(y, m) {
  $('#ajaxcalendar').load('calendar.php', {year: y, month: m});
}

$(document).ready(function() {
  
  $('#ajax-loading').ajaxStart(function() {
    $('#ajax-content').hide();
    $(this).show();
  });

  $('#ajax-loading').ajaxSuccess(function(e, r, s) {
    $(this).hide();
    $('#ajax-content').show('slow');
  });

  $('#ajaxcalendar').ajaxStart(function() {
    $('#ajaxcalendar').animate({opacity: 0.5, duration: "slow"});
  });

  $('#ajaxcalendar').ajaxSuccess(function(e, r, s) {
    $('#ajaxcalendar').animate({opacity: 1, duration: "slow"});
  });
});