﻿/**********************************************
Smart Filter Functionality
***********************************************/
$(document).ready(function() {

    $(".SmartFilterGroupTitle").find("IMG.TextArrow,DIV").each(function() {
        $(this).click(function() {
            if ($(this).parent().next().css("display") == 'none') {
                $(this).parent().addClass("Selected");
                $(this).parent().find("IMG").each(function() {
                    $(this).attr("src", $(this).attr("src").replace("_closed", "_opened"));
                });

                if ($(this).parent().next().find("TD").length < 7) {
                    $(this).parent().next().find(".SmartFilterItemBoxScroll").removeClass("SmartFilterItemBoxScroll").addClass("SmartFilterItemBox");
                    $(this).parent().next().find(".SmartFilterSubSearchWrapper").hide();
                }
                $(this).parent().next().slideDown("slow");
                return false;
            } else {

                $(this).parent().find("IMG").each(function() {
                    $(this).attr("src", $(this).attr("src").replace("_opened", "_closed"));
                });

                $(this).parent().removeClass("Selected");
                $(this).parent().next().slideUp("slow");
                return false;
            }
            return false;
        });
    });
});

