/**
 * Replaces a link specified by an ID with a <span> element
 * and optionally ads a style.
 */
function replaceLinkWithText(id, style) {
	var thisLink = document.getElementById(id);
	if (thisLink != null) { 
	    var par = thisLink.parentNode;
	    var span = document.createElement('span');
	    var text = document.createTextNode(thisLink.childNodes[0].nodeValue);
	    span.appendChild(text);
	    if (style != '') {
		    if (navigator.appName == 'Microsoft Internet Explorer') {
		    	span.setAttribute("className", style);
		    } else {
		    	span.setAttribute("class", style);
		    }
	    }	    
	    par.replaceChild(span, thisLink); 
	}
	return false;
}

/**
 * Changes the CSS-Class attribute of an item specified by its id
 */
function change(id, newClass) {
	identity = document.getElementById(id);
	if (identity != null) {
		identity.className=newClass;
	}
	return false;
}


function hideElement(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showElement(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}
