﻿var Boxes = new Array('divARn', 'divAR', 'divMountainBike', 'divMountainBikeSeries', 'divVelo', 'divBikeTouringCompany', 'divLandWaterTour', 'divBikeRentals', 'divRunning', 'divTriathlon', 'divCanoeKayak', 'divCampsClinics', 'divMountainBikeClubs', 'divIMBAEvents', 'divRoadBikeClubs', 'divBikeTouringRides', 'divMultiSportClubs', 'divSkiClubs', 'divCCSnow', 'divTrailLand', 'divDOApp', 'divSupplementalForms', 'diviTravel', 'divSpecialEventApp');

$(document).ready(function() {

    var numBoxes = Boxes.length;
    for (var i = 0; i < numBoxes; i++) {
        var id = Boxes[i].toString().replace('div', 'bbb');

        //NOTE: do not try to do animations because it is too easy for the user to quickly change hover selections and the animations cannot be interrupted. As a result events are skipped and panes remain open that should not be.
        //With more time some logic could be added to somehow dequeue animations in progress. Maybe also when new animation needs to start go through a loop to stop each elements queue and then hide immediately before starting the next.
        $('#' + id).hover(
        function() { //hoverover
            //$(this).append($("<span> ***</span>"));
            var hoverId = $(this).attr('id');
            var boxId = hoverId.toString().replace('bbb', 'div');
            $('#' + boxId).show();

            //If Supplemental Form show its little link popup box
            if (hoverId == "bbbSupplementalForms") {
                $('#' + hoverId + ' div').slideDown("1000");
            }

        },
        function() { //hoverout
            var hoverId = $(this).attr('id');
            var boxId = hoverId.toString().replace('bbb', 'div');
            $('#' + boxId).hide();

            //If Supplemental Form hide its little link popup box
            if (hoverId == "bbbSupplementalForms") {
                $('#' + hoverId + ' div').slideUp("1000");
            }
        }
        );
    }
});



//NOT USED
function IsAnimateInProgress() { 
    var numBoxes = Boxes.length;
    for (var i = 0; i < numBoxes; i++) {
        var id = Boxes[i];
        if ($('#' + id).attr("AnimateInProgress") == "1") {
            return true;
        }
    }
    return false;
}