﻿(function ($){
$(document).ready(function() {
    $(this).initializeToggables();
    $(this).fixLastBottomBorder();
});

$.fn.initializeToggables = function(){
    // toggle function
    $("body, form").addClass("js");
    $("html").removeAttr("class");

    $(".hiddenOnLoad").hide();
    $(".toggleNext").click(function() {
        $(this).toggleClass("expanded");

        if ($(this).next().is(':visible')) {
            $(this).next().slideUp('slow');
        }
        else {
            $(this).next().slideDown('slow');

            $totalHeight = 0;
            $(this).next().children('ul').children("li:not('.odd')").each(function() {
                $totalHeight += $(this).height();
            });

            if ($.browser.msie) {
                if ($.browser.version == 7.0) {
                    $totalHeight += 10;
                }
            }
            $(this).next().children('ul').height($totalHeight);
        }

        return false;
    });
};

$.fn.fixLastBottomBorder = function() {
    $(".contactCategoryContainer:last").css("border-bottom", "none");
};
})(jQuery);
