slidingMenu:

/*================================================= ========
DHTML Sliding Menu - [Menu Scorrevole DHTML]

by William Verdolini - jesi (italy) - 9/2002
mail: w.verdolini@html.it

================================================== =======*/


function Menu(title,URL,back,MyFunctionName) {
this.title = title
this.URL = URL
this.back = back
this.subMenu = []
this.MFN = MyFunctionName || null
}

function Level(stylesArray,hook,parent,container) {
this.container = container || null
this.el = document.createElement("DIV")
this.css = this.el.style
if(stylesArray) this.applyStylesArray(stylesArray)
this.appendToLevel(hook)
this.refMenu = null
this.parent = parent || null
this.el.parent = this
}

function applyStylesArray(stylesArray) {
var stile
var stileValue
for(a in stylesArray) {
stile = stylesArray[a].split("=")
stileValue = stile[1]
if(stile.length > 2)
for(i=2; i<stile.length; i++)
stileValue += "="+stile[i]
this.css[stile[0]] = stileValue
}
}

function appendToLevel(father) {
if(!father) father = document.getElementsByTagName("BODY").item(0)
else if(father.constructor && father.constructor == Level) father = father.el
father.appendChild(this.el)
}


function writeInLevel(text) {
if(this.txt)
this.txt.el.firstChild.nodeValue = text
else {
var tT = parseInt(this.css.height) - parseInt(this.css.fontSize)
if(this.container.ie)
tT =tT-(parseInt(this.css.borderTopWidth)||parseInt(this. css.borderWidth)||0)-(parseInt(this.css.borderBottomWidth)||parseInt(th is.css.borderWidth)||0)

tT = tT/2
if(this.container.ie) tT = Math.ceil(tT)
this.txt = new Level(["position=absolute","left=0px","top="+tT+"px","wid th=100%","lineHeight=100%"],this.el)
this.txt.el.appendChild(document.createTextNode(te xt))
}
}

function setListener(other,RollInStyles,RollOutStyles,click edStyles){
this.el.onclick = function(e) {
if(!this.parent.container.going) {
this.parent.container.going = true
if(this.parent.parent && this.parent.parent.constructor==subLevel) {
subW = parseFloat(this.parent.container.sub.css.top)
this.parent.container.vagiu = false
}
if(clickedStyles) {
this.parent.applyStylesArray(clickedStyles)
if(other) {
other.applyStylesArray(clickedStyles)
other.el.onmouseover = null
other.el.onmouseout = null
}
this.onmouseover = null
this.onmouseout = null
}
this.parent.container.goDownItems(e)
}
}
this.el.onmouseover = function() {
this.parent.applyStylesArray(RollInStyles)
if(other) other.applyStylesArray(RollInStyles)
}
this.el.onmouseout = function() {
this.parent.applyStylesArray(RollOutStyles)
if(other) other.applyStylesArray(RollOutStyles)
}

}

function addBordersNS(){
var tmpBordi = (parseInt(this.css.borderLeftWidth)||parseInt(this .css.borderWidth)||0)+(parseInt(this.css.borderRig htWidth)||parseInt(this.css.borderWidth)||0)
return(tmpBordi)
}

Level.prototype.addBordersNS = addBordersNS
Level.prototype.setListener = setListener
Level.prototype.applyStylesArray = applyStylesArray
Level.prototype.appendToLevel = appendToLevel
Level.prototype.writeInLevel = writeInLevel

function subLevel(stylesArray,hook,widthLevel,container) {
this.fix = new Level(stylesArray,hook,this,container)
this.dyn = new Level(stylesArray,hook,this,container)
this.dyn.css.width = "0px"
if(this.findStyle("borderRightWidth",stylesArray)| |this.findStyle("borderWidth",stylesArray)) {
if(container.ie) this.fix.css.width = (parseInt(this.fix.css.width)-(parseInt(this.findStyle("borderRightWidth",styles Array))||parseInt(this.findStyle("borderWidth",sty lesArray))))+"px"
this.fix.css.borderRightWidth = "0px"
}
var offL = (!container.ie && (this.findStyle("borderLeftWidth",stylesArray)||th is.findStyle("borderWidth",stylesArray))) ? (parseInt(this.findStyle("borderLeftWidth",stylesA rray))||parseInt(this.findStyle("borderWidth",styl esArray))) : 0
this.dyn.css.borderLeftWidth = "0px"
this.dyn.css.left = parseInt(this.fix.css.width)+offL+"px"
this.fix.parent = this
this.dyn.parent = this
this.refMenu = null
this.parent = hook || null
}

subLevel.prototype.findStyle = findStyle

function ContainerMenu(startingMenu,Hstep,Vstep,delay,launc hingFunctionName,
boxStylesArray,supStylesArray,cenStylesArray,subSt ylesArray,
inSupStylesArray,outSupStylesArray,inSubStylesArra y,outSubStylesArray,
clickedSupStylesArray,clickedSubStylesArray) {
this.ie = (navigator.appName.indexOf("Microsoft")>-1) ? 1 : 0

this.sM = startingMenu
this.nM = startingMenu
this.Hstep = Hstep || 10
this.Vstep = Vstep || 1
this.delay = (delay!=null)? delay : 500
this.LFN = launchingFunctionName || "no"
this.boxS = boxStylesArray
this.supS = supStylesArray
this.cenS = cenStylesArray
this.subS = subStylesArray
this.inSup = inSupStylesArray
this.outSup = outSupStylesArray
this.inSub = inSubStylesArray || this.inSup
this.outSub = outSubStylesArray || this.outSup
this.ckSup = clickedSupStylesArray || null
this.ckSub = clickedSubStylesArray || null

this.w = parseInt(this.findStyle("width",this.supS)) || 100
this.h = parseInt(this.findStyle("height",this.subS)) || 15
this.prg = this.h
if(!this.ie) {
this.wsupReal = this.NSBoxMeasures("width",this.supS)
this.wcenReal = this.NSBoxMeasures("width",this.cenS)
this.wsubReal = this.NSBoxMeasures("width",this.subS)
this.supS[this.supS.length] = "width="+this.wsupReal+"px"
this.cenS[this.cenS.length] = "width="+this.wcenReal+"px"
this.subS[this.subS.length] = "width="+this.wsubReal+"px"
this.hsupReal = this.NSBoxMeasures("height",this.supS)
this.hcenReal = this.NSBoxMeasures("height",this.cenS)
this.hsubReal = this.NSBoxMeasures("height",this.subS)
this.supS[this.supS.length] = "height="+this.hsupReal+"px"
this.cenS[this.cenS.length] = "height="+this.hcenReal+"px"
this.subS[this.subS.length] = "height="+this.hsubReal+"px"
}

this.box = new Level(this.boxS,null,this,this)
this.sup = new Level(null,this.box,this.box,this)
this.supItems = []
this.central = new Level(this.cenS,this.box,this.box,this)

var tmpArray = ["position=absolute","width="+(!this.ie?this.wcenRe al:this.w)+"px","height="+(!this.ie?this.hcenReal: this.h)+"px","top=0px","left=0px","fontSize="+(par seInt(this.findStyle("fontSize",this.cenS)))+"px", "borderTopWidth="+(parseInt(this.findStyle("border TopWidth",this.cenS))||parseInt(this.findStyle("bo rderWidth",this.cenS))||0)+"px","borderBottomWidth ="+(parseInt(this.findStyle("borderBottomWidth",th is.cenS))||parseInt(this.findStyle("borderWidth",t his.cenS))||0)+"px"]
this.central_sup = new Level(tmpArray,this.central,this.central,this)
this.central_cen = new Level(tmpArray,this.central,this.central,this)
this.central_cen.writeInLevel(this.sM.title)
this.central_sub = new Level(tmpArray,this.central,this.central,this)
this.sub = new Level(["position=absolute","top="+(this.h)+"px","left=0px "],this.box,this,this)
this.sub.clipTop = -this.h
this.subItems = []
this.sub.refMenu = this.sM

this.central.css.clip = "rect(0px 1000px "+this.h+"px 0px)"
this.central.css.top = this.h+"px"
this.central.css.zIndex="2"
this.central_sup.css.top = "-"+this.h+"px"
this.central_cen.css.top = "0px"
this.central_sub.css.top = this.h+"px"
this.vagiu = false
this.toOpen = true
}

function findStyle(styleType,stylesArray) {
var stile,rt
for(a in stylesArray) {
stile = stylesArray[a].split("=")
if(stile[0].toLowerCase() == styleType.toLowerCase())
rt = stile[1]
}
return rt||null
}


function HSliding(closed) {
var tmpWidth
var FinWidth
ref = this
cl = closed || null

tmpWidth = parseInt(this.central.css.width)+(!this.ie?this.ce ntral.addBordersNS():0)
FinWidth = this.toOpen ? (this.fixedWidth) ? this.fixedWidth : ((this.nM.subMenu.length || 1)*this.w) : this.w
var prgStep = this.toOpen ? this.Hstep : -this.Hstep
if(this.toOpen && tmpWidth < FinWidth || !this.toOpen && tmpWidth > FinWidth) {
if(!this.toOpen && this.sup.el.firstChild && (parseInt(this.sup.el.firstChild.style.left)+this. w) >= tmpWidth)
this.sup.el.firstChild.style.left = (tmpWidth-this.w+prgStep)+"px"
this.central.css.width = (parseInt(this.central.css.width)+prgStep)+"px"
if(this.subSliding) {
for(i=0; i<this.subItems.length; i++){
var bW = this.subItems[i].dyn.css.borderRightWidth ?
(!this.ie) ? 0 : parseInt(this.subItems[i].dyn.css.borderRightWidth) : 0;
this.subItems[i].dyn.css.width = Math.abs((tmpWidth-this.w+bW+prgStep))+"px"
}
}
setTimeout("ref.HSliding(cl)",this.minCPUres)
}
else {
this.central.css.width = FinWidth-(!this.ie?this.central.addBordersNS():0)+"px"
if(this.subSliding) {
for(i=0; i<this.subItems.length; i++) {
var bW = this.subItems[i].dyn.css.borderRightWidth ?
(!this.ie) ? 0 : parseInt(this.subItems[i].dyn.css.borderRightWidth) : 0
this.subItems[i].dyn.css.width = FinWidth-this.w+bW+"px"
}
}
if(this.sup.el.firstChild) this.sup.el.firstChild.style.left = "0px"
if(this.toOpen)
this.openSubMenu(this.supS)
else {
if(this.sup.el.firstChild) {
this.setSlidingLevel(false)
setTimeout("ref.upDown()",this.delay)
}
else {
if(!cl)
setTimeout("ref.goUpsubItems()",this.delay)
}
}
this.toOpen = this.toOpen ? false : true
}
}


function openSubMenu(supStylesArray) {
this.going = true
this.addItems(supStylesArray)
this.slideItems(true)
}

function addItems(stylesArray) {
this.supItems.length = this.nM.subMenu.length
for(i=0; i<this.nM.subMenu.length; i++) {
this.supItems[i] = new Level(this.supS,this.sup,this.sup,this)
this.supItems[i].writeInLevel(this.nM.subMenu[i].title)
this.supItems[i].refMenu = this.nM.subMenu[i]
this.supItems[i].css.left = (i*this.w)+"px"
this.supItems[i].setListener(null,this.inSup,this.outSup,this.ckSu p)
}
}



function goUpsubItems(){
ref = this
if(subW >= this.subItems[this.sub.subIndex].subTop+this.h) {
if((subW-this.Vstep) <= this.subItems[this.subItems.length-1].subTop) {
this.sub.el.removeChild(this.subItems[this.subItems.length-1].fix.el)
this.sub.el.removeChild(this.subItems[this.subItems.length-1].dyn.el)
this.subItems.length--
}
subW -= this.Vstep
this.sub.css.top = subW+"px"
setTimeout("ref.goUpsubItems()",this.minCPUres)
}
else {
this.sub.css.top = (this.subItems[this.sub.subIndex].subTop+this.h)+"px"
this.setSlidingLevel(true)
ref.upDown()
}
}



function goDownItems(e){
if(!e) e = window.event
source = e.srcElement ? e.srcElement : e.target
while(source.tagName != "DIV" || source.firstChild && source.firstChild.nodeType==3)
source = source.parentNode
for(i=0, j=0; i<this.supItems.length; i++,j++) {
if(this.supItems[i] == source.parent) j--
else this.supItems[j] = this.supItems[i]
}
this.supItems.length = j
for(i=0; i<this.subItems.length; i++) {
if(this.subItems[i] == source.parent.parent) {
this.sub.subIndex = i;
}
}
this.prg = 0
this.slideItems(false)
}

function slideItems(up,closed){
ref = this
rec = up
cl = closed || null
this.prg += (up)? -this.Vstep : this.Vstep
if(rec && this.prg>=0 || !rec && this.prg<=this.h) {
for(j=0; j<this.supItems.length; j++)
this.supItems[j].css.top = this.prg+"px"
setTimeout("ref.slideItems(rec,cl)",this.minCPUres )
}
else {
if(!up){
for(j=0; j<this.supItems.length; j++)
this.sup.el.removeChild(this.supItems[j].el)
setTimeout("ref.HSliding("+(cl?'true':'')+")",this .delay)
}
else
this.going = false
}
}


function setSlidingLevel(goUp){
var subIndex = this.subItems.length
if(!goUp && this.nM.back)
this.setSubItemsLevel(subIndex,this.nM)
slidingLevels = []
vl = []
var actInd
var downingLevel = (this.sup.el.firstChild && this.sup.el.firstChild.parent.txt) ? this.sup.el.firstChild.parent.txt : null
slidingLevels.length = 0
actInd = slidingLevels.length
slidingLevels[slidingLevels.length] = this.central_sup
if(!goUp) slidingLevels[actInd].writeInLevel(downingLevel.el.firstChild.nodeValue )
slidingLevels[slidingLevels.length] = this.central_cen
actInd = slidingLevels.length
slidingLevels[slidingLevels.length] = this.central_sub
if(goUp) slidingLevels[actInd].writeInLevel(this.subItems[this.sub.subIndex].fix.refMenu.title)
if (!goUp) slidingLevels[slidingLevels.length] = this.sup.el.firstChild.parent
if (!goUp && this.nM.back || goUp) slidingLevels[slidingLevels.length] = this.sub
for(j=0; j<slidingLevels.length; j++)
vl[j] = parseInt(slidingLevels[j].css.top)

this.vagiu = (!goUp) ? true : false
this.prg = 0
}
continua.. :P