﻿$(document).ready(function () {

    $('.expandable')
        .hover(function () {
            $(this).css('cursor', 'pointer');
        })
        .click(function () {
            $(this).toggleClass("expandable");
            $(this).toggleClass("collapsible");
            $(this).next().toggle('medium', function () {
                $(this).removeClass('collapsed');
                if ($.cookie(this.id) == 'collapsed') {
                    $.cookie(this.id, 'expanded', { path: '/' });
                } else {
                    $.cookie(this.id, 'collapsed', { path: '/' });
                }
            });
            return false;
        })
        .next().each(function () {
            if ($.cookie(this.id) == 'expanded') {
                $(this).addClass('expanded');
            } else {
                $(this).hide();
                $.cookie(this.id, 'collapsed', { path: '/' });
            }
        });
});

