/* Written by Daniel J. Berger, 2004
 * This script may be used or modified freely.
 *
 * The function NavCheck returns the value of newBrowser, which initializes false. 
 * If the instruction getElementById is defined, the browser supports DOM 2+ and 
 * newBrowser is set to true.
 *
 * If the browser does not support DOM 2+, a small window opens with the footnote text within it.
 *
 * The variable myWindow is used by the function replaceText; it is instantiated if and only 
 * if the browser does not support DOM2+.
 *
 * The function replaceText(myElement,myText,myColor) replaces the text node within 
 * myElement with myText, and sets the background color of myElement to myColor.
 * It begins by ensuring that this operation can be done, using NavCheck!
 *
 * The functions showNote(myElement) and hideNote(myElement) change the visibility of the 
 * document element myElement by resetting the style attribute for that element. These functions 
 * do nothing if the browser does not support DOM2.
 */
 

function NavCheck() {
	var newBrowser = (document.getElementById) ? true : false;
//	return false;
	return newBrowser;
}

if (!NavCheck()) {
	var myWindow = new Object();
	myWindow.closed = true;
}

function replaceText(myElement,myText,myColor) {
 	if (NavCheck()) {
		if (myElement.lastChild) myElement.removeChild(myElement.lastChild);
		myElement.appendChild(document.createTextNode(myText));
		myElement.style.backgroundColor = myColor;
		if (myColor == "#ffffff") myElement.style.fontStyle = "italic";
		else myElement.style.fontStyle = "normal";
	}
	else {
		if (myColor != "#ffffff") {
			myWindow = window.open("","","height=100,width=100,resizable");
			myWindow.document.write("<html><head><title>Translation</title><style type=\"text/css\">body { font-family: Arial, sans serif; font-size: x-small; color: Black; background-color: White; text-align: left; } </style></head><body>" + myText + "</body></html>");
			myWindow.moveTo(10,10);
		}
		else if (!myWindow.closed) myWindow.close();
	}
	return;
 }
 
 function showNote(myElement) {
 	if (NavCheck()) myElement.setAttribute("className","visibleNote");
 }
 
 function hideNote(myElement) {
 	if (NavCheck()) myElement.setAttribute("className","hiddenNote");
 }
