﻿

(function($) {

    $.fn.menuAnim = function(options) {

        // default configuration properties
        var defaults = {
            speed: 400
        };

        var options = $.extend(defaults, options);

        return this.each(function() {
            obj = $(this);
            obj.children("li").each(function() {

                $(this).bind("mouseover", function() {
                    $("div:first",  this).addClass("active");
                    $allItems = $(this).parents("ul").children("li");
                    for (var pos = 0; pos < $allItems.length; pos++) {
                        if ($($allItems[pos]).attr("id") != $(this).attr("id"))
                            $("div:first", $($allItems[pos])).animate({ height: "27px" },
                            { queue: false, duration: options.speed })
                    }
                    $("div:first", this).animate({ height: "80px" }, { queue: false, duration: options.speed })
                    
                }).bind("mouseout", function() {
                    $("div:first",  this).removeClass("active");
                    $allItems = $(this).parents("ul").children("li");
                    for (var pos = 0; pos < $allItems.length; pos++) {
                        $("div:first",  $($allItems[pos])).animate({ height: "27px" },
                        { queue: false, duration: options.speed })
                    }
                });
            });

        });
    };
})(jQuery);

