var SlideMenu = {
	create: function (elementID, menuButton, direction, openSpeed) {
				var newmenu = Object();
				newmenu.props = 0;
				newmenu.mode = 'vertical';
				if (typeof(direction) != "undefined" && direction != null) newmenu.mode = direction;
				
				//rtraction
				if (typeof(openSpeed) != "undefined" && direction != null)
					menuSpeed = openSpeed;
				else
					menuSpeed = 500;
				
				//Move the menu off the screen, show the menu, create the Menu, collapse the menu, replace the menu.
				newmenu.menu = $(elementID);
				newmenu.menu.slider = newmenu;
				
				//01.15.2009 rtraction - issues with mouseout on Mac FF browser
				//newmenu.menu.addEvent('mouseover', function(){this.slider.prop();});
				//newmenu.menu.addEvent('mouseout', function(){this.slider.unprop();});
				newmenu.menu.addEvent('mouseenter', function(){this.slider.prop();});
				newmenu.menu.addEvent('mouseleave', function(){this.slider.unprop();});
				
				
				if (menuButton)
				{
					$(menuButton).slider = newmenu;
					//01.15.2009 rtraction - issues with mouseout on Mac FF browser
					//$(menuButton).addEvent('mouseover', function(){this.slider.show();});
					//$(menuButton).addEvent('mouseout', function(){this.slider.unprop();});
					$(menuButton).addEvent('mouseenter', function(){this.slider.show();});
					$(menuButton).addEvent('mouseleave', function(){this.slider.unprop();});
				}
				newmenu.menu.style.visibility = "hidden";
				newmenu.menu.style.display = "block";
				newmenu.menu.style.left = (newmenu.menu.offsetLeft - 1000) + "px";
				
				newmenu.menu.style.visibility = "visible";
				
				//rtraction - added menuSpeed in place of '500'
				newmenu.slider = new Fx.Slide(elementID, {duration: menuSpeed, mode: newmenu.mode}).hide();
				newmenu.menu.style.left = (newmenu.menu.offsetLeft + 1000) + "px";
 
				newmenu.instanceID = elementID;	
				SlideMenu.instances[newmenu.instanceID] = newmenu;
 
				newmenu.show = function(force) {
					
					if (force) this.props = 0;
					if (this.props == 0)
					{
						this.slider.stop();
						this.slider.slideIn();
						this.prop();
					}
				}
 
				newmenu.hide = function() {
					
					if (this.props == 0)
					{
						this.slider.stop();
						this.slider.slideOut();
					}
				}
 
				newmenu.prop = function() {
					this.props++;
				}
 
				newmenu.hideTimer = null;
				newmenu.unprop = function() {

					if (this.props <= 0){
						this.props = 0;
					}
					else{
						//01.15.2009 rtraction - issues with mouseout on Mac FF browser
						// setting the props to equal 1 seems to work
						this.props = 1;
						this.props--;
					}
					clearTimeout(this.hideTimer);
					
					if(window.ie){
						var hideSpeed = 800;
					} else {
						var hideSpeed = 200;
					}
					
					
					this.hideTimer = setTimeout("SlideMenu.instances['"+this.instanceID+"'].hide();", hideSpeed);
				}
				
				return newmenu;
			},
 
 
	instances: new Array(),	//Public static member containing references to all isntances of SlideMenu objects.
 
	//show will show a menu if it is not already shown, and prop it open.
	show:	function (id, force) {
				if (typeof(SlideMenu.instances[id]) == "object")
					SlideMenu.instances[id].show(force || false);
			},
	//unprop takes the prop off and attempts to hide the menu in 200ms.
	unprop:	function (id) {
				if (typeof(SlideMenu.instances[id]) == "object")
					SlideMenu.instances[id].unprop();
			},
	//prop adds another prop to the menu so that it won't hide until it is unpropped.
	prop:	function (id) {
				if (typeof(SlideMenu.instances[id]) == "object")
					SlideMenu.instances[id].prop();
			}
};