
(function($) {
	$.widget("ui.dropdown", {
		box: null,
		positioned: false,
		options: {},

		_init: function() {
			this.box = this.element.children(".ddl-more-actions-box");
			this.initEvents();
		},

		initEvents: function() {
			var self = this;
			$('.ddl-more-actions-box').bind('mouseout', function(e) { self.startHide(); });
			$('.ddl-more-actions-box').bind('mouseover', function(e) { self.stopHide(); });
			//$('.ddl-more-actions-box a').bind('mouseover', function (e){self.stopHide();});
		},

		showMenu: function() {
			if (!this.positioned) this.setPosition();
			this.box.show();
		},

		hideMenu: function() {
			this.box.hide();
		},

		showHideMenu: function() {
			this.box.css("display") == "none" ? this.showMenu() : this.hideMenu();
		},

		startHide: function() {
			this.stopHide();
			this.timer = setTimeout("$J('#" + this.element[0].id + "').dropdown('hideMenu')", 200);
		},

		stopHide: function() {
			if (this.timer != null) clearTimeout(this.timer);
		},

		setPosition: function() {
			if ($.browser.msie) {
				this.box.css("left", "0");
				this.box.css("top", "25px");
			} else {
				this.box.css("left", "0");
				this.box.css("top", "16px");
			}
			this.positioned = true;
		}
	})

})(jQuery);

