﻿$(document).ready(function() {

    // Row striping - Removed by Chris, now done server side so that it works without Javascript!!
   // $('#packagesTable .row:even').addClass('dark');
   //$('#packagesTable .row:odd').addClass('light');
    $('#packagesTable .row').css({ display: 'none' });
    $('#packagesTable .text').css({ display: 'none' });

    // Add pointer to heading
    $('#packagesTable .heading.hasText, #packagesTable .groupHeading,').css({ cursor: 'pointer' });

    // Toggle slide text and change arrow/color (group)
    $('#packagesTable .groupHeading').toggle(
        function() {
            $(this).parent('.group').find('.row').slideDown(500, function() {
                $(this).parent('.group').find('.row').css({ display: 'inline-block' });
            });
            $(this).addClass('selected')
        },
        function() {
            $(this).parent('.group').find('.row').slideUp(500);
            $(this).removeClass('selected')
        }
    );

    // Toggle slide text and change arrow/color (sub-section)
    $('#packagesTable .heading.hasText').toggle(
        function() {
            $(this).parent('.cell').find('.text').css({ width: '250px' }); // resize text contanier to 'get height' to avoid jumping
            $(this).parent('.cell').find('.text').slideDown(500);
            $(this).addClass('selected')
        },
        function() {
            $(this).parent('.cell').find('.text').slideUp(500);
            $(this).removeClass('selected')
        }
    );

    // Group divider
    $('#packagesTable .group:not(.mainFeatures)').prepend('<img class="divider" src="/i/packagesGroupDivider.gif" alt="divider" />');

    // Main Features starts open (send click)
    $('#packagesTable .mainFeatures .groupHeading').click();

});   