$.widget("ui.dropmenu", {
   // default options
   options: {
     option1: "defaultValue",
     hidden: true
   },
   _create: function() {
       var self=this;var o=self.options;var el=self.element;
       self.__config();
       self.__activate();
   },
   __activate: function(){
       var self=this;var o=self.options;var el=self.element;
       el.bind("mouseenter", function(){		   
           self.show($(this), $(this).find("a:eq(0)"));
           return false;
       });
       el.bind("mouseleave", function(){		   
           self.hide($(this), $(this).find("a:eq(0)"));		   
           return false;
       });
   },
   __config:function(){
       var self=this;var o=self.options;var el=self.element;
       el.css({"position":"relative", "z-index":1000});
       el.each(function(i){
           var _zindex=i+700;
           $(this).find("ul").css({
               "position":"absolute",
               "left":"0px",
               "top":$(this).height(),
               "z-index":_zindex
           });
       });
   },   
   show:function(elm, _self){
       var self=this;var o=self.options;var el=self.element;
       if(elm.find("ul").length>0){
           _self.css("color", "#3da0dd");
           elm.css({			   
               "background":"#d0d0d0"
           });
           elm.find("ul").stop(true, true).slideDown(300);

       }
	   
   },
   hide:function(elm, _self){
       var self=this;var o=self.options;var el=self.element;
       if(elm.find("ul").length>0){
           elm.find("ul").slideUp(100, function(){
               _self.css("color", "#fff");
               elm.css({			   
                   "background":"none"
               });
            });

       }
   },
   destroy: function() {
       $.Widget.prototype.destroy.apply(this, arguments); // default destroy
        // now do other stuff particular to this widget
   }
 });

