<!--
	/*****************************************************
	 * SlideOutMenu
	 * 7/27/2005
	 * 
	 * a nice little script to create exclusive, slide-out
	 * menus for ns4, ns6, mozilla, opera, ie4, ie5 on 
	 * mac and win32. Based on the ypSlideOutMenu by
	 * Aaron "youngpup" (aaron@youngpup.net).
	 *
	 * modified to compensate for safari DHTML layering
	 * bug in SlideOutMenu.hide and SlideOutMenu.endSlide 
	 *****************************************************/
	
	SlideOutMenu.Registry = [];
	SlideOutMenu.aniLen = 650;
	SlideOutMenu.hideDelay = 325;
	SlideOutMenu.minCPUResolution = 10;
	
	// constructor
	function SlideOutMenu(id, dir, left, top, width, height) {
		this.ie  = (document.all) ? 1 : 0;
		this.ns4 = (document.layers) ? 1 : 0;
		this.dom = (document.getElementById) ? 1 : 0;
	
		if (this.ie || this.ns4 || this.dom) {
			this.id			 = id;
			this.dir		 = dir;
			this.orientation = dir == "left" || dir == "right" ? "h" : "v";
			this.dirType	 = dir == "right" || dir == "down" ? "-" : "+";
			this.dim		 = (this.orientation == "h") ? width : height;
			this.hideTimer	 = false;
			this.aniTimer	 = false;
			this.open		 = false;
			this.over		 = false;
			this.startTime	 = 0;
	
			// global reference to this object
			this.gRef = "SlideOutMenu_"+id;
			eval(this.gRef+"=this");
	
			// add this menu object to an internal list of all menus
			SlideOutMenu.Registry[id] = this;
	
			// add this menu object to an internal list of all menus
			SlideOutMenu.Registry[id] = this
			this.load(left, top, width, height)
		}
	}
	
	SlideOutMenu.prototype.load = function(left, top, width, height) {
		var d = document;
		var obj1 = this.getObj(this.id+"Container");
		var obj2 = this.getObj(this.id+"Content");
		var temp;
	
		if (!obj1 || !obj2) {
			window.setTimeout(this.gRef + ".load()", 100);
		} else {
			this.container	= obj1
			this.menu		= obj2
			this.style		= this.ns4 ? this.menu : this.menu.style
			this.homePos	= eval("0" + this.dirType + this.dim)
			this.outPos		= 0
			this.accelConst	= (this.outPos - this.homePos) / SlideOutMenu.aniLen / SlideOutMenu.aniLen 
	
			// container styles
			this.container.style.visibility	= "hidden";
			this.container.style.left 		= left+"px";
			this.container.style.top 		= top+"px";
			this.container.style.overflow 	= "hidden";
			this.container.style.position 	= "absolute";
			this.container.style.width 		= width+"px";
			this.container.style.height 	= height+"px";
			this.container.style.clip 		= "rect(0 "+width+" "+height+" 0)";
			
			// menu (a.k.a.: id+"Content") styles
			this.menu.style.position 		= "absolute";
			this.menu.style.width 			= width+"px";
			this.menu.style.height 			= height+"px";
			this.menu.style.clip 			= "rect(0 "+width+" "+height+" 0)";
	
			// set event handlers.
			if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
	
			//set initial state
			this.endSlide()
		}
	};
		
	SlideOutMenu.prototype.getObj = function(ObjID) {
		return (this.dom) ? document.getElementById(ObjID) : (this.ie) ? document.all[ObjID] : document.layers[ObjID];
	};
		
	SlideOutMenu.showMenu = function(id) {
		var reg = SlideOutMenu.Registry;
		var obj = SlideOutMenu.Registry[id];
		
		if (obj.container) {
			obj.over = true;

			// if this menu is scheduled to close, cancel it.
			if (obj.hideTimer) reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer);
	
			// if this menu is closed, open it.
			if (!obj.open && !obj.aniTimer) reg[id].startSlide(true);
		}
	};
	
	SlideOutMenu.hideMenu = function(id) {
		// schedules the menu to close after <hideDelay> ms, which
		// gives the user time to cancel the action if they accidentally moused out
		var obj = SlideOutMenu.Registry[id];
		if (obj.container) {
			if (obj.hideTimer) window.clearTimeout(obj.hideTimer);
			obj.hideTimer = window.setTimeout("SlideOutMenu.hide('" + id + "')", SlideOutMenu.hideDelay);
		}
	};
	
	SlideOutMenu.hide = function(id) {
		var obj = SlideOutMenu.Registry[id];
		obj.over = false;
		
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer);
		
		// flag that this scheduled event has occured.
		obj.hideTimer = 0;
		
		// if this menu is open, close it.
		if (obj.open && !obj.aniTimer) {
			obj.startSlide(false);
			
			// custom aspect of the slide out menu, specifically to compensate for a Safari bug that
			// prevents the DHTML menu to display above the flash object.
			if (navigator.userAgent.indexOf("Safari") != -1 && getMovie("portfolio").maskMoveTo) {
				// remove mask cut-out from flash content
				getMovie("portfolio").maskMoveTo(0);
			}
		}
	};
	
	SlideOutMenu.prototype.startSlide = function(open) {
		this[open ? "onactivate" : "ondeactivate"]();
		this.open = open;
		if (open) this.setVisibility(true);
		this.startTime = (new Date()).getTime();
		this.aniTimer = window.setInterval(this.gRef + ".slide()", SlideOutMenu.minCPUResolution);
	};
	
	SlideOutMenu.prototype.slide = function() {
		var elapsed = (new Date()).getTime() - this.startTime;
		if (elapsed > SlideOutMenu.aniLen) this.endSlide();
		else {
			var d = Math.round(Math.pow(SlideOutMenu.aniLen-elapsed, 2) * this.accelConst);
			if (this.open && this.dirType == "-")		d = -d;
			else if (this.open && this.dirType == "+")	d = -d;
			else if (!this.open && this.dirType == "-")	d = -this.dim + d;
			else										d = this.dim + d;
	
			this.moveTo(d);
		}
	};
	
	SlideOutMenu.prototype.endSlide = function() {
		this.aniTimer = window.clearTimeout(this.aniTimer);
		this.moveTo(this.open ? this.outPos : this.homePos);
		if (!this.open) this.setVisibility(false);
		if ((this.open && !this.over) || (!this.open && this.over)) this.startSlide(this.over);
		
		// custom aspect of the slide out menu, specifically to compensate for a Safari bug that
		// prevents the DHTML menu to display above the flash object.
		if (navigator.userAgent.indexOf("Safari") != -1 && getMovie("portfolio").maskMoveTo && this.open) {
			// mask flash content to allow menu to show through
			getMovie("portfolio").maskMoveTo(maskHeight);
		}
	};
	
	SlideOutMenu.prototype.setVisibility = function(bShow) { 
		var s = this.ns4 ? this.container : this.container.style;
		s.visibility = bShow ? "visible" : "hidden";
	};
	
	SlideOutMenu.prototype.moveTo = function(p) {
		this.style[this.orientation == "h" ? "left" : "top"] = (this.ns4) ? p : (p) + "px";
	};
	
	SlideOutMenu.prototype.getPos = function(c) {
		return parseInt(this.style[c]);
	};
	
	SlideOutMenu.reposition = function(id, left, top) {
		var menuContainer = SlideOutMenu.Registry[id].getObj(id+"Container");
		menuContainer.style.left = left+"px";
		menuContainer.style.top = top+"px";
		SlideOutMenu.Registry[id].endSlide();
	};
	
	// events
	SlideOutMenu.prototype.onactivate	= function() { };
	SlideOutMenu.prototype.ondeactivate	= function() { };
//-->

