function Menu() { this.numid = Menu.count; this.name = "Menu"+(Menu.count++)
this.aktiv = -1
this.valid = false
this.cellan = false
this.width = 0
this.x = 0
this.y = 0
if(arguments.length==1) { this.width = arguments[0]
this.parent = null
this.menuparent = -1
this.menunum = 0
this.vis = true
this.windowWidth = 0
} else if(arguments.length==3) { this.parent = arguments[0]
this.menuparent = arguments[1]
this.width = arguments[2]
this.menunum = 0
this.vis = false
eval('this.parent.lista'+this.menuparent+'[0]=this')
}
this.addTableElement = menuAddTableElement
this.addImageElement = menuAddImageElement
this.createImage = menuCreateImages
this.output = menuCreateOutput
this.createCssOutput = menuCreateCssOutput
this.setDimension = menuSetDimension
this.mouseTableOn = menuMouseTableOn
this.mouseTableOff = menuMouseTableOff
this.activateMenuPoint = menuActivateMenuPoint
this.visibilityControl = menuVisibilityControl
this.mouseCellClick = menuMouseCellClick
this.activeOff = menuActiveOff
this.menuOff = menuMenuOff
this.mouseCellOff = menuMouseCellOff
this.mouseCellOn = menuMouseCellOn
this.menuVisOff = menuMenuVisOff
this.refreshCoordinates = menuRefreshCoordinates
this.validate = menuValidate
this.reki = menuReki
}
function menuAddTableElement(url,table) { eval('this.lista' + (this.menunum++) + '= new Array(null,1,0,url,table)')
}
function menuAddImageElement(url,kepki,kepbe,table) { eval('this.lista' + (this.menunum++) + '= new Array(null,2,0,url,kepki,kepbe,table)')
}
function menuCreateImages() { var kepforrasbe
var kepforraski
var i
for(i=0;i<this.menunum;i++) { if (eval('this.lista' + i + '[1] == 2')) { eval('kepforrasbe = this.lista' + i + '[5]')
eval('kepforraski = this.lista' + i + '[4]')
eval(this.name+'lista'+i+'On = new Image()')
eval(this.name+'lista'+i+'On.src = "'+kepforrasbe+'"')
eval(this.name+'lista'+i+'Off = new Image()')
eval(this.name+'lista'+i+'Off.src = "'+kepforraski+'"')
}
eval('if (this.lista'+i+'[0] != null) {this.lista'+i+'[0].createImage()}')
}
}
function menuCreateOutput() { var cellclass
var celllink
var celltype
var kepforraski
document.write('<div id="'+this.name+'">\n')
document.write('<table onmouseover="'+this.name+'.mouseTableOn(-1)" onmouseout="'+this.name+'.mouseTableOff()"cellpadding="0" cellspacing="0" class="menubar" width='+this.width+'>')
var i
for(i=0;i<this.menunum;i++) { document.write('<tr>\n')
eval('celllink = this.lista'+i+'[3]')
if (celllink == 'javascript:void(0)') {cellclass = 'class="linklessOver"'} else {cellclass = 'class="linkfulOver"'}
document.write('<td '+cellclass+' id="'+this.name+'-'+i+'" onMouseOver="'+this.name+'.mouseCellOn('+i+'); return true;" onMouseOut="'+this.name+'.mouseCellOff('+i+'); return true;" onClick="'+this.name+'.mouseCellClick('+i+'); return true;">\n')
eval('celltype = this.lista'+i+'[1]')
if (celltype == 1) { eval('document.write(this.lista'+i+'[4])')
} else { eval('document.write(this.lista'+i+'[6])')
document.write('<tr><td>\n')
eval('kepforraski = this.lista'+i+'[4]')
document.write('<img src="'+kepforraski+'" border=0 vspace=0 hspace=0 name="'+this.name+'lista'+i+'">')
document.write('</td></tr></table>\n')
}
document.write('</td>\n')
document.write('</tr>\n')
}
document.write('</table>')
document.write('</div>')
var k
for(k=0;k<this.menunum;k++) { if (eval('this.lista' + k + '[1] != 2')) { this.activateMenuPoint(k,false)
}
}
var j
for(j=0;j<this.menunum;j++) { eval('if (this.lista'+j+'[0] != null) {this.lista'+j+'[0].output()}')
}
}
function menuCreateCssOutput() { var szam
if (this.parent == null) { document.write('<style type="text/css">\n')
document.write('.linklessOver {cursor : default;}\n')
document.write('.linkfulOver {cursor : pointer; cursor : hand;}\n')
document.write('.mouseOut {cursor : auto;}\n')
} else { szam = this.numid+10
document.write('#'+this.name+' {\nz-index : '+szam+';\nposition : absolute;\ntop : 1px;\nleft : 1px;\nvisibility : hidden;\n}\n')
}
var i
for(i=0;i<this.menunum;i++) { eval('if (this.lista'+i+'[0] != null) {this.lista'+i+'[0].createCssOutput()}')
}
if (this.parent == null) { document.write('</style>')
}
}
function menuSetDimension() { var cellaid
var cell
var h
for(h=0;h<this.menunum;h++) { cellaid = this.name+'-'+h
if (document.getElementById) { cell = document.getElementById(cellaid);} else if (document.all) { cell = document.all[cellaid];}
if (cell) { if (h == 0) { this.width = cell.offsetWidth
eval('this.lista0[2] = 0')
if (this.menunum > 1) { eval('this.lista1[2] = '+cell.offsetHeight)
}
} else { if (this.menunum > h+1) { eval('this.lista'+(h+1)+'[2] = this.lista'+h+'[2] + '+cell.offsetHeight)
}
}
}
}
}
function menuMouseTableOn(menup) { if (!this.valid) return
if (this.cellan) return
this.vis = true
this.aktiv = 1
this.vis = true
if (menup != -1) { this.activateMenuPoint(menup,true)
} else { var k
for(k=0;k<this.menunum;k++) { if (k != menup) { this.activateMenuPoint(k,false)
if (eval('this.lista' + k + '[0] != null') && eval('this.lista'+ k + '[0].vis == true')) { eval('this.lista' + k + '[0].vis = false')
eval('this.lista' + k + '[0].visibilityControl()')
}
}
}
if (this.parent == null) { this.refreshCoordinates()
}
}
this.visibilityControl()
if (this.parent != null) { this.parent.mouseTableOn(this.menuparent);}
}
function menuActivateMenuPoint(menup,abool) { if (eval('this.lista' + menup + '[1] == 2')) { var kep = this.name+'lista'+menup
if (abool == true) { if (document.images) { if (document.images[kep].src != eval(kep+"On.src")) { document.images[kep].src=eval(kep+"On.src")
}
}
} else { if (document.images) { if (document.images[kep].src != eval(kep+"Off.src")) { document.images[kep].src=eval(kep+"Off.src")
}
}
}
} else { var cellaid
var cell
cellaid = this.name+'-'+menup
if (document.getElementById) { cell = document.getElementById(cellaid);} else if (document.all) { cell = document.all[cellaid];}
if (cell) { if (abool == false) { cell.style.background = Menu.offmouse
} else { cell.style.background = Menu.onmouse
}
}
}
}
function menuVisibilityControl() { var table
if (document.getElementById) { table = document.getElementById(this.name);} else if (document.all) { table = document.all[this.name];}
if (table) { if (this.vis == true) { table.style.visibility = "visible"
} else { table.style.visibility = "hidden"
}
}
}
function menuMouseCellClick(menup) { if (!this.valid) return
var celllink
eval('celllink = this.lista'+menup+'[3]')
if (celllink != 'javascript:void(0)') { window.location = celllink
}
}
function menuMouseTableOff() { if (!this.valid) return
this.activeOff()
setTimeout(this.name+".menuOff(-1)",Menu.backTimeOut)
}
function menuActiveOff() { this.aktiv = -1; if (this.parent != null) { this.parent.activeOff()
}
}
function menuMenuOff(menup) { if (this.aktiv == -1) { if (this.parent != null) { this.vis = false
this.visibilityControl()
}
if (menup == -1) { var k
for(k=0;k<this.menunum;k++) { this.activateMenuPoint(k,false)
}
} else { this.activateMenuPoint(menup,false)
}
if (this.parent != null) { this.parent.menuOff(this.menuparent)
}
} else if (this.aktiv == 0) { var k
for(k=0;k<this.menunum;k++) { this.activateMenuPoint(k,false)
}
}
}
function menuMouseCellOff(menup) { Menu.activeMenu = null
Menu.activeMenuPoint = -1
if (!this.valid) return
var fmenu
eval('fmenu = this.lista'+menup+'[0]')
if (fmenu != null) { fmenu.aktiv = -1
setTimeout(fmenu.name+".menuVisOff()",Menu.forwTimeOut)
}
this.cellan = false;}
function menuMenuVisOff() { if (this.parent != null) { if (this.aktiv == -1) { this.vis = false
this.visibilityControl()
}
}
}
function menuMouseCellOn(menup) { Menu.activeMenu = this
Menu.activeMenuPoint = menup
if (!this.valid) return
this.mouseTableOn(-1)
this.cellan = true; this.activateMenuPoint(menup,true)
if (eval('this.lista' + menup + '[0] != null')) { eval('this.lista' + menup + '[0].refreshCoordinates()')
eval('this.lista' + menup + '[0].aktiv = 0')
eval('this.lista' + menup + '[0].vis = true')
eval('this.lista' + menup + '[0].visibilityControl()')
}
}
function getWindowWidth() { return document.body.clientWidth
}
function menuRefreshCoordinates() { if (this.parent == null) { if (this.windowWidth == getWindowWidth()) { return
} else { this.windowWidth = getWindowWidth()
}
var eltolas
if (getWindowWidth() < 901) { eltolas = 2
} else { eltolas = ((getWindowWidth()-900)/2) + 2
}
this.x = eltolas
this.y = 140
} else { this.x = this.parent.x + this.parent.width - 6
this.y = eval('this.parent.y + this.parent.lista'+this.menuparent+'[2]')
document.getElementById(this.name).style.left = this.x
document.getElementById(this.name).style.top = this.y
}
}
function menuValidate() { this.setDimension()
this.refreshCoordinates()
if (this.parent != null) this.valid = true
var i
for(i=0;i<this.menunum;i++) { eval('if (this.lista'+i+'[0] != null) {this.lista'+i+'[0].validate()}')
}
if (this.parent == null) this.valid = true
}
function hideMenu() { if (Menu.activeMenu != null) { Menu.activeMenu.mouseCellOff(Menu.activeMenuPoint)
}
}
function menuReki() { tesztkiir(this.name + '.szélesség: ' + this.width)
var i
for(i=0;i<this.menunum;i++) { tesztkiir(this.name + '.cella' + i + '.magasság: ' + eval('this.lista' + i + '[2]'))
eval('if (this.lista' + i + '[0] != null) {this.lista' + i + '[0].reki()}')
}
}
function tesztkiir(ezt,abool) { if (!document.tesztform) { Menu.uzenet = Menu.uzenet + '\n' + ezt
} else { if (abool) { document.tesztform.tesztarea.value = ezt
} else { document.tesztform.tesztarea.value = document.tesztform.tesztarea.value + '\n' + ezt
}
}
}
function tki() { document.tesztform.tesztarea.value = document.tesztform.tesztarea.value + '\n' + Menu.uzenet
}
function torol() { document.tesztform.tesztarea.value = ''
}
Menu.count = 0
Menu.offmouse = "#eeeeee"
Menu.onmouse = "#ff6e2f"
Menu.onBorderColor = "#000000"
Menu.offBorderColor = "#e5e1da"
Menu.backTimeOut = 20
Menu.forwTimeOut = 10
Menu.uzenet = ''
Menu.activeMenu = null
Menu.activeMenuPoint = -1
