﻿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() == '') {
                PageMethods.GetCompetitionTypes(t.attr('roundid'), GetCompetitionTypesSucceeded);
            }
            //            var row = jQuery(this).parent().parent().next().children('div:first');
            //            if (row.hasClass('hide'))
            //                row.slideDown(500, function() {
            //                    jQuery(this).removeClass('hide');
            //                    jQuery(this).css('display', '');
            //                });
            //            else
            //                row.slideUp(500, function() {
            //                    jQuery(this).addClass('hide');
            //                });
        });
    });
    jQuery('a.closeSummary').each(function(i) {
        jQuery(this).click(function(e) {
            var row = $(e.target).closest('tr');
            currentEvent = null;
            row.toggleClass('hide');
            //            if (row.hasClass('hide'))
            //                row.slideDown(500, function() {
            //                    jQuery(this).removeClass('hide');
            //                    jQuery(this).css('display', '');
            //                });
            //            else
            //                row.slideUp(500, function() {
            //                    jQuery(this).addClass('hide');
            //                });
            e.preventDefault();
        });
    });
}
function GetCompetitionTypesSucceeded(result, userContext, methodName) {
    jQuery(currentEvent).find('#types').text(result);
}
