(function( $ ){
 var options;
 var $this;
 var methods = { 
	  
    init : function( opt ) { 
		
			init(opt);		
	},
    hide : function( ) {
		//hide();
	}
 };
	
 
  $.fn.submenu = function(method) {
   		// Method calling logic
		$this = $(this);
		if ( methods[method] ) {
		  return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
		  return methods.init.apply( this, arguments );
		} else {
		  $.error( 'Method ' +  method + ' does not exist on jQuery.submenu' );
		} 
  };
  
  
  function init(opt){
	  options = opt;

		

	  $this.each(function(index, value){
			//if this button has a submenu..
			if($(value).find(".submenu").attr('class') == 'submenu'){
				
				$(value).mouseover(function(){
					var submenu = $(this).find('.submenu');
					submenu.show();	
					var subMenuHeight = submenu.height()-4;
					submenu.css('top', "-"+subMenuHeight+"px");
				});
				$(value).mouseout(function(){
										   
					$(this).find('.submenu').hide();
				});
			}
		
			
			
	  });
	  
	  
		  
  }
  
  
  
})( jQuery );

