﻿var currentEvent = null;

function BindInfoEvents() {
    jQuery('table.events tr td a.infoLink').each(function(i) {
        jQuery(this).click(function(e) {
            e.preventDefault();
            currentEvent = jQuery(this).parent().parent().next();
            currentEvent.toggleClass('hide');
            var t = jQuery(currentEvent).find('#types');
            if (t.text() == '') {
                ClubCMS.layouts._shared.UCompetitionService.GetCompetitionTypes(t.attr('roundid'), GetCompetitionTypesSucceeded, onFail);
            }
        });
    });
    jQuery('a.closeSummary').each(function(i) {
        jQuery(this).click(function(e) {
            var row = $(e.target).closest('tr');
            currentEvent = null;
            row.toggleClass('hide');
            e.preventDefault();
        });
    });
}
function GetCompetitionTypesSucceeded(result) {
    jQuery(currentEvent).find('#types').text(result);
}
function onFail(error) {
    jQuery(currentEvent).find('#types').text('Could not get types.');
}
