(function(a){
    a.fn.webwidget_menu=function(p){
        var p=p||{};

        var f=p&&p.menu_text_size?p.menu_text_size:"12";
        var g=p&&p.menu_text_color?p.menu_text_color:"blue";
        var h=p&&p.menu_border_size?p.menu_border_size:"1";
        var i=p&&p.menu_background_color?p.menu_background_color:"#FFF";
        var j=p&&p.menu_border_color?p.menu_border_color:"blue";
        var k=p&&p.menu_border_style?p.menu_border_style:"solid";
        var l=p&&p.menu_padding_left?p.menu_padding_left:"12";
        var n=p&&p.menu_padding_right?p.menu_padding_right:"12";
        var o=p&&p.menu_padding_top?p.menu_padding_top:"12";
        var q=p&&p.menu_padding_bottom?p.menu_padding_bottom:"12";
        var r=p&&p.menu_margin_left?p.menu_margin_left:"12";
        var s=p&&p.menu_margin_right?p.menu_margin_right:"12";
        var t=p&&p.menu_margin_top?p.menu_margin_top:"12";
        var u=p&&p.menu_margin_bottom?p.menu_margin_bottom:"12";
        var v=p&&p.menu_background_hover_color?p.menu_background_hover_color:"red";
        var m=p&&p.directory?p.directory:"images";
        var w=a(this);
        f += 'px';
        h += 'px';
        l += 'px';
        n += 'px';
        o += 'px';
        q += 'px';
        r += 'px';
        s += 'px';
        t += 'px';
        u += 'px';
        if(w.children("ul").length==0||w.find("li").length==0){
            dom.append("Require menu content");
            return null
            }
            s_m_b(w.children("ul").children("li"),w.find("li"),h,k,j);
        s_m_p(w.children("ul").children("li"),l,n,o,q);
        s_m_m(w.children("ul").children("li"),r,s,t,u);
        s_m_t_c(w.find("a"),g);
        s_m_t_s(w.find("a"),f);
        s_m_bg_c(w.find("li"),i);
        s_u_t(w.children("ul").children("li"));
        w.find("li:has(ul)").addClass("webwidget_menu_down_drop");
        w.find("li:has(ul)").css("background-image","url("+m+"/down_drop_icon.gif)");
        s_sub_l(w.find("ul").children("li").children("ul").children("li").children("ul"),h);
        w.find("li").hover(function(){
            $(this).css("background-color",v);
            $(this).children("ul").show()
            },function(){
            $(this).css("background-color",i);
            $(this).children("ul").hide()
            });
        function s_m_t_c(a,b){
            a.css("color",b)
            }
            function s_m_t_s(a,b){
            a.css("font-size",b);
            
            }
            function s_m_b(a,b,c,d,e){
            style="border:"+c+" "+d+" "+e+";";
            a.attr("style",style);
            b.children("ul").attr("style",style)
            }
            function s_m_m(a,b,c,d,e){
            a.css("margin-left",b);
            a.css("margin-right",c);
            a.css("margin-top",d);
            a.css("margin-bottom",e);
            }
            function s_m_p(a,b,c,d,e){
            a.css("padding-left",b);
            a.css("padding-right",c);
            a.css("padding-top",d);
            a.css("padding-bottom",e);
            }
            function s_m_bg_c(a,b){
            a.css("background-color",b);
            a.children("ul").css("background-color",b)
            }
            function s_u_t(a){
            l_t_b_s=a.outerHeight(true)-a.css("border-top-width").replace("px","")*2+"px";
            a.children("ul").css("top",l_t_b_s);
            a.children("ul").css("left","-"+a.css("border-top-width"));
            li_hieght = w.children("ul").children("li").outerHeight(true);
            //li_width = w.children("ul").children("li").outerWidth(true);
            a.children("ul").find("a").css("line-height",li_hieght+"px");
            //a.children("ul").find("li").width(li_width);
            }
            function s_sub_l(a,b){
            boder_width=b.replace("px","");
            a.css("left",a.parent("li").parent("ul").outerWidth(true)-boder_width*2);
            a.css("top","-"+b)
            }
        }
})(jQuery);
