﻿//script to collapse LI Lists

      $(document).ready(function() {

        // Expand Panel
        $("#open").click(function(){
            $("div#panel-int").slideDown("slow");

        });	

        // Collapse Panel
        $("#close").click(function(){
            $("div#panel-int").slideUp("slow");	
        });		

        // Switch buttons from "Log In | Register" to "Close Panel" on click
        $("#toggle-int div").click(function () {
            $("#toggle-int div").toggle();
        });		

      });

    jQuery(function($) {

    var
    ul = $('.filter'),
    lis = ul.find('li'),
    anchor = ul.find('.showall'),
    liMinHeight = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
    liMaxHeight = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];

    ul.each(function (x) {
                
    $(this).find('li').each(function(i) {
    var height = $(this).outerHeight();

    if (i < 4)
    {
        liMinHeight[x] += height;
    }
    
    liMaxHeight[x] += height;
    
    });
    
    $(this).height(liMinHeight[x]);
    
    var togglebutton = $(this).parent().find('.showall');
    
    if (liMinHeight[x] == liMaxHeight[x])
    {
        togglebutton.hide();
        togglebutton.height(0);
    }
    
    togglebutton.toggle(
    function() 
    {
        togglebutton.parent().find('.filter').animate({height : liMaxHeight[x]}, 400);
        togglebutton.html("(-) Show Less");

    }, 
    
    function() 
    {
        togglebutton.parent().find('.filter').animate({height : liMinHeight[x]}, 400);
        togglebutton.html("(+) Show More");
    });
    
    });

    });



