﻿(function ($) {
    $.fn.newx_head = function (settings) {
        settings = jQuery.extend({
            menuid: 0,
            classname: "edohead_menu"
        }, settings);

        var newxsele = $("." + settings.classname).selector;

        function NewX_headinit() {
            $(newxsele + " li").mouseover(function () {
                var curLiIndex = $(newxsele + " li").index($(this));
                NewX_mouseact(curLiIndex);
            });
            $(newxsele + " li").mouseout(function () {
                NewX_mouseact(settings.menuid);
            });
            NewX_mouseact(settings.menuid);
        };

        function NewX_mouseact(curLiIndex) {
            $(newxsele + " li").each(function (i) {
                if (i == curLiIndex) {
                    $(this).css({
                        backgroundColor: "#ffffff",
                        color: "#000000"
                    });

                } else {
                    $(this).css({
                        backgroundColor: "#000000",
                        cursor: "pointer",
                        color: "#e7c69b"
                    });
                };
            });

        }

        return NewX_headinit();

    };

})(jQuery);
