DROPMENU = {
	options: {},
	itemList: [],
	
	init: function(custOptions)
	{
		var me = this,
			options = {
				container:	'#main_table',
				menuClass:	'tab',
				butClass:	'button',
				subClass:	'sub_panel'
			}
		;
		jQuery.extend( options, custOptions );
		
		$(options.container).find('.'+options.menuClass).each(function(){
			me.itemList.push(this);
			$(this).bind('mouseenter', function(){
				me.tabOver(this);
			}).bind('mouseleave', function(){
				me.tabOut(this);
			});
		});
		
		me.options = options;
	},
	
	tabOver: function(elem)
	{
		var me = this;
		
		if (elem.removeTimeout) clearTimeout(elem.removeTimeout);
		
		// check for other visible tabs
		$(me.itemList).each(function(){
			if (this !== elem && this.isShown) {
				this.forceClose = true;
				me.tabOut(this, 1);
			}
		})
		
		elem.isShown = true;
		$(elem).find('.'+me.options.butClass).addClass('active');
		$(elem).find('.'+me.options.subClass).show();
	},
	
	tabOut: function(elem, force)
	{
		var me = this;
		
		elem.removeTimeout = setTimeout(function(){
			$(elem).find('.'+me.options.subClass).hide();
			$(elem).find('.'+me.options.butClass).removeClass('active');
			elem.isShown = false;
			elem.forceClose = false;
		}, (elem.forceClose ? 1 : 300));
	}
};


