/* //:::::::::::   SLIDEMENU UTILITY   :::::::::::\\

                  by Micah Goulart



	This script can be used as long as this

	disclaimer is left untouched.

	For bug reports or custom scripts, email me at:

	micahgoulart@mailbr.com.br

	

	IMPORTANT!!

		This script requires the dynObj.js source file.

		Download it at members.xoom.com/micahgoulart/dynObj.js



   //:::::::::::   copyright 1999   :::::::::::\\	*/





function slideMenu()

{	var arg = arguments



	this.menu = new menu(arg[0], arg[1], arg[2], arg[3])

	this.menu.ID = "slideMenu" + (slideMenu.count++)

	this.menu.visibility = "hidden"

	this.style = this.menu.style



	this.speed = 5

	this.animate = false



	this.trackEvent = false

	this.offsetX = 10

	this.offsetY = 10



	this.opened = false	



	this.build = slideMenuBuild

	this.activate = slideMenuActivate



	this.open = slideMenuOpen

	this.close = slideMenuClose

	this.toggle = slideMenuToggle	}



slideMenu.count = 0

timer = false

xInc = 0

yInc = 20

	

function slideMenuBuild()

{	this.menu.build()

	this.div = this.menu.div	}



function slideMenuActivate()

{	this.menu.activate()

	this.menu.obj.clipInit()

	this.menu.obj.clipTo(0,this.menu.w,0,0)

	this.menu.obj.show()	}



function slideMenuOpen()

{	var height = this.menu.h+this.menu.style.borderWidth*2-this.menu.style.itemSpacing

	timer = setInterval(this.menu.obj.ref+".clipBy(0,xInc,yInc,0);if("+this.menu.obj.ref+

	".clipValues('b')>="+height+"){"+this.menu.obj.ref+

	".clipTo(0,"+this.menu.w+","+height+",0);clearInterval(timer);timer=false}",this.speed)

	this.opened = true

	this.menu.obj.css.zIndex = menu.count++	}



function slideMenuClose()

{	timer = setInterval(this.menu.obj.ref+".clipBy(0,-xInc,-yInc,0);if("+

	this.menu.obj.ref+".clipValues('b') <= 0){clearInterval(timer);timer=false}", this.speed)

	this.opened = false;		}

	

function slideMenuToggle(e)

{	if (timer) return

	xInc = 0

	yInc = 20

	if (this.animate)

	{	if (this.menu.w < this.menu.h) xInc = parseInt(this.menu.w/this.menu.h * 20)

		else

		{	xInc = 20

			yInc = parseInt(this.menu.h/this.menu.w * 20)	}

				}



	if (this.opened) this.close()

	else

	{	if (this.animate) this.menu.obj.clipTo(0,0,0,0)

		if (this.trackEvent)

		{	x = (NS) ? e.pageX : event.x

			y = (NS) ? e.pageY : (event.clientY + document.body.scrollTop);

			this.menu.obj.moveTo(x + this.offsetX, y + this.offsetY)	}

		this.open()	}

			}

