// By WA - htt://www.whereabouts.it
// Version 1.1, 20 May 2011
//

jQuery.fn.menuWA = function (options) {

    var settings = jQuery.extend({
        mouseHoverHideSecondary: 'false' // option set from page -  hide secondary menu when mouse out from secondary menu
    }, options);

    var target = $(this); //recupera 'li[id^="men"]' - per target vedi uc menu.ascx <li id="men..."> su menuLevel1

    target.each(function () {

        var indexEl = this.id;
        var menuDiv = '#' + indexEl + ' > div';

        $(this).mouseover(function () {

            //$(menuDiv).fadeIn("slow");
            $(menuDiv).show();

            target.each(function () {
                var menuDiv = '#' + this.id + ' > div';
                if (this.id != indexEl) {
                    $(menuDiv).hide();
                }
            });

        });

        // option set from page -  hide secondary menu when mouse out from secondary menu
        if (settings.mouseHoverHideSecondary=='true') {
            $(menuDiv).mouseout(function () {
                $(menuDiv).hide();
            });
            $(menuDiv).mouseover(function () {
                $(menuDiv).show();
            });
        }


    });

    $("td:gt(4)")
};


//    <script type="text/javascript">
//        $(document).ready(function () {


//            $('li[id^="men"]').each(function () {

//                var indexEl = this.id;
//                var menuDiv = '#' + indexEl + ' > div';

//                $(this).mouseover(function () {

//                    //$(menuDiv).fadeIn("slow");
//                    $(menuDiv).show();

//                    $('li[id^="men"]').each(function () {
//                        var menuDiv = '#' + this.id + ' > div';
//                        if (this.id != indexEl) {
//                            $(menuDiv).hide();
//                        }
//                    });

//                });

//                $(menuDiv).mouseout(function () {
//                    //$(menuDiv).hide();
//                });
//                $(menuDiv).mouseover(function () {
//                    //$(menuDiv).show();
//                });


//            });

//            $("td:gt(4)")
//        });

//    </script>
