  var meses = new Array();
  meses[1] = 'Janeiro';
  meses[2] = 'Fevereiro';
  meses[3] = 'Março';
  meses[4] = 'Abril';
  meses[5] = 'Maio';
  meses[6] = 'Junho';
  meses[7] = 'Julho';
  meses[8] = 'Agosto';
  meses[9] = 'Setembro';
  meses[10] = 'Outubro';
  meses[11] = 'Novembro';
  meses[12] = 'Dezembro';
 
  var prox = undefined;
  var ant = undefined;
  var prox_c = undefined;
  var ant_c = undefined;
 
  function setLinks(mes, completa) {
    mes = parseInt(mes);
    if(completa == undefined) {
      prox = mes + 1 > 12 ? 1 : mes + 1;
      ant = mes - 1 < 1 ? 12 : mes - 1;
    }
    else {
      prox_c = mes + 1 > 12 ? 1 : mes + 1;
      ant_c = mes - 1 < 1 ? 12 : mes - 1;
    }
  }
 
  function trocarMes(mes) {
    if (window.servidor != undefined) {
      $('#agenda_completa').attr('href', servidor + 'agenda/' + mes);
    }
    setLinks(mes);
    mostraCal(mes);
  }

  function trocarMesCompleta(mes) {
    setLinks(mes, true);
    if($('#agenda-completa').length) {
      $.ajax({
        type: "GET",
        url: rel + "agenda/detalhes/"+mes,
        beforeSend: function() {
          $('#agenda-completa').hide();
          $('#loading_agenda').show();
        },
        complete: function(data) {
          $("#mes-atual-c").html(meses[parseInt(mes)] + ' ' + new Date().getFullYear());
          $('#loading_agenda').hide();
          $("#agenda-completa").html(data.responseText).fadeIn('fast');
        }
      });
    }
  }
 
  function mostraCal(mes) {
    $('#box-dia').fadeOut(function() {
      $.ajax({
        type: "GET",
        url: rel + "agenda/box/"+mes,
        complete: function(data) {
          $("#mes-atual").html('<strong>'+meses[parseInt(mes)]+'</strong>');
          $("#box-dia").html(data.responseText).fadeIn('fast');
        }
      });
    });
  }

