var hoy = new Date();
var dia = hoy.getDate();
var mes = hoy.getMonth()+1;


$(function () {
    $('.changeHomeCalendar').live('click', function () {
        $('.event-info-container').hide();
        var urlCalendar = $(this).attr('urlCalendar');
        var urlEventInfo = $(this).attr('urlEventInfo');

        $('#divContainerCalendarHome').load(urlCalendar, function () {
        });

        $('#event-info').load(urlEventInfo, function () {
            initInfoConcertAgenda();
        });
    });

    $('.hasEvents').live('click', function () {
        $('.event-info-container').each(function () { $(this).hide(); });
        $('#event-info-' + $(this).attr('daynum') + "-" + $(this).attr('monthnum')).show();
    });

    initInfoConcertAgenda();
});


function initInfoConcertAgenda() {
    $('.event-info-container').each(function (index, item) {
        var idia = parseInt($(this).attr('dia'));
        var imes = parseInt($(this).attr('mes'));
        if (((imes < mes) || (imes > mes)) && (index == 0)) {
            $(this).show();
            return false;
        }
        else {
            if (idia >= dia) {
                $(this).show();
                return false;
            }
        }
    })
}
