home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 June
/
Chip_2004-06_cd1.bin
/
tema
/
zme6c
/
www_info
/
archivace_soubory
/
menu.js
< prev
next >
Wrap
Text File
|
2004-05-05
|
3KB
|
103 lines
var dom = document.getElementById ? true : false;
var ie4 = ((document.all) && (!dom)) ? true : false;
var ns4 = document.layers ? true : false;
var opera = navigator.userAgent.indexOf('Opera') != -1 ? true : false;
var dhtml = dom ? true : ie4 ? true : ns4 ? true : false;
var msie = navigator.userAgent.indexOf('MSIE') != -1 ? true : false;
var menucount = 5
var counts = new Array(menucount+1);
var timeouts = new Array(menucount+1);
function hideTable(element) {
if (dhtml) {
if (dom) document.getElementById(element).style.display = 'none';
else if (ie4) document.all[element].style.display = 'none';
else if (ns4) eval('document.' + element + '.display = \'none\'');
}
}
function showElement(element,newVisibility) {
if (dhtml) {
//alert(element +':'+ newVisibility);
if (dom) document.getElementById(element).style.visibility = newVisibility;
else if (ie4) document.all[element].style.visibility = newVisibility;
else if (ns4) eval('document.' + element + '.visibility = newVisibility');
}
}
function showMenu(i) {
//alert('showMenu('+i+')');
showElement('menuBox'+i, 'visible');
}
function hideMenu(i) {
//alert('hideMenu('+i+')');
// if (counts[i] <= 0)
showElement('menuBox'+i, 'hidden');
}
function alignMenu(i) {
element1 = 'menuBox'+i;
element2 = 'menuTitle'+i;
if (dhtml) {
if (dom) {
e1 = document.getElementById(element1);
e2 = document.getElementById(element2);
e1.style.left = e2.style.left;
//e1.style.width = e2.style.width;
e1.style.top = e2.style.bottom;
} else if (ie4) {
e1 = document.all[element1];
e2 = document.all[element2];
e1.style.left = e2.style.left;
//e1.style.width = e2.style.width;
e1.style.top = e2.style.bottom;
} else if (ns4) {
eval('document.' + element1 + '.left = document.' + element2 + '.left');
//eval('document.' + element1 + '.width = document.' + element2 + '.width');
eval('document.' + element1 + '.top = document.' + element2 + '.bottom');
}
}
}
function hideAll() {
for (i = 1; i <= menucount; i++) {
clearTimeout(timeouts[i]);
counts[i] = 0;
hideMenu(i);
}
}
function showMenuBox(i, e) {
clearTimeout(timeouts[i]);
showMenu(i);
if (e.id.length > 8) {
e.className = "menuItem2";
}
}
function hideMenuBox(i, e) {
clearTimeout(timeouts[i]);
timeouts[i] = setTimeout('hideMenu('+i+')', 33);
if (e.id.length > 8) {
e.className = "menuItem";
}
}
function mouseover(e) {
if (e.target.id.indexOf("menuBox") != -1) {
var i = parseInt(e.target.id.charAt(7));
showMenuBox(i, e);
}
}
function mouseout(e) {
if (e.target.id.indexOf("menuBox") != -1) {
var i = parseInt(e.target.id.charAt(7));
hideMenuBox(i, e);
}
}