
function getElem(id) {
return document.all ? document.all(id) :
document.getElementById ? document.getElementById(id) :
document.layers ? document.layers[id] :
null;
}

function getVisibility(el) {
if (el.style) {
if (el.style.visibility && el.style.visibility != 'inherit') return el.style.visibility;
if (el.currentStyle && el.currentStyle.visibility && el.currentStyle.visibility != 'inherit')
return el.currentStyle.visibility;
else while (el = el.parentElement) {
if (el != null && el.style.visibility && el.style.visibility != 'inherit')
return el.style.visibility;
if (el != null && el.currentStyle && el.currentStyle.visibility && 
el.currentStyle.visibility != 'inherit')
return el.currentStyle.visibility;
}
} else if (document.layers) {
if (el.visibility != 'inherit') return el.visibility;
else while (el = el.parentLayer) {
if (el != null && el.visibility != 'inherit') {
return el.visibility;
}
}
}
return (!document.layers) ? 'visible' : 'show';
}

function toggleVis() {
var currArg;
for (var a=0; a<arguments.length; ++a) {
currArg = arguments[a];
var el = getElem(currArg);
if (!el) return;
if (el.style)
el.style.visibility = (getVisibility(el) == 'visible') ? 'hidden' : 'visible';
else if (document.layers)
el.visibility = (getVisibility(el) == 'show') ? 'hide' : 'show';
}
}
