
function hideElements(ids)
{
if(document.getElementById!==undefined)
{
for(var key in ids)
{
var element=document.getElementById(ids[key]);
if(element!==null)
{
element.style.display='none';
}
else
{
alert('The specified element does not seem to exist.');
}
}
}
}
function showElement(id)
{
if(document.getElementById!==undefined)
{
var element=document.getElementById(id);
if(element!==null)
{
element.style.display='block';
}
else
{
alert('The specified element does not seem to exist.');
}
}
}
function toggleElementDisplay(id)
{
if(document.getElementById!==undefined)
{
var element=document.getElementById(id);
if(element!==null)
{
if(element.style.display==='none')
{
element.style.display='block';
}
else if(element.style.display==='block')
{
element.style.display='none';
}
else
{
alert('The "display" attribute of the referenced element is neither "block" nor "none", so it cannot be toggled between the two.');
}
}
}
}
function toggleElementClassById(id,classNameOne,classNameTwo)
{
if(document.getElementById!==undefined)
{
var element=document.getElementById(id);
if(element!==null)
{
if(element.className===classNameOne)
{
element.className=classNameTwo;
}
else if(element.className===classNameTwo)
{
element.className=classNameOne;
}
else
{
alert('The class name of the referenced element is not the same as either of the specified alternatives, so it cannot be toggled between the two.');
}
}
}
}
function setElementClassById(id,className)
{
if(document.getElementById!==undefined)
{
var element=document.getElementById(id);
if(element!==null)
{
element.className=className;
}
}
}
function setElementClassesByIds(ids,className)
{
if(document.getElementById!==undefined)
{
for(var key in ids)
{
var element=document.getElementById(ids[key]);
if(element!==null)
{
element.className=className;
}
}
}
}
function toggleHeadingClass(element){
if(element!==null){
var the_class=element.className;
if(the_class.search('Open')>-1){
element.className=the_class.replace('Open','Closed');
}else if(the_class.search('Closed')>-1){
element.className=the_class.replace('Closed','Open');
}else{
alert('The class name of the referenced heading ('
+element.className
+') has neither an "Open" nor a "Closed" aspect, so it cannot be toggled between the two.');
}
}
}
function toggleElementDisplay(id)
{
if(document.getElementById!==undefined)
{
var element=document.getElementById(id);
if(element!==null)
{
if(element.style.display==='none')
{
element.style.display='block';
}
else if(element.style.display==='block')
{
element.style.display='none';
}
else
{
alert('The "display" attribute of the referenced element is neither "block" nor "none", so it cannot be toggled between the two.');
}
}
}
}
function toggleElementDisplayStateClass(id){
if(document.getElementById!==undefined){
var element=document.getElementById(id);
if(element!==null){
var the_class=element.className;
if(the_class.search('Open')>-1){
element.className=the_class.replace('Open','Closed');
}else if(the_class.search('Closed')>-1){
element.className=the_class.replace('Closed','Open');
}else{
alert('The class name of the referenced heading ("'
+element.className
+'") has neither an "Open" nor a "Closed" aspect, so it cannot be toggled between the two.');
}
}
}else{
alert('The specified element "'+id+'" does not seem to exist.');
}
}
