// JavaScript for auto-linking of glossary terms


/*	COMMENTS OR DEFINITIONS 
	____________________________________________________________________ */


function makeDefinitionLinks() {
	// Don't run this if we're in print mode.
	var url = window.location.href;
	if( url.indexOf('style=print') == -1 ) {
		if (document.getElementById) {
			if( glossary = document.getElementById('page-glossary')) {
				while( dl = glossary.getElementsByTagName("DL")[0]) {
					// We're removing the first node each time through, so the next one will always be first!
					document.body.appendChild(dl);
					dl.style.display = "none";
					dl.style.position = "absolute";
					dl.className = "popup";
				}
				glossary.style.display = "none";
	
				anchors = document.getElementsByTagName("A");
				for (i=0;i<anchors.length;i++) {
					if (anchors[i].rel == "definition") {
						if (href = anchors[i].href) {
							// Only apply actions to links with hrefs, i.e. links to valid glossary terms
							defId = href.substring(href.indexOf('#') + 1);
							if (document.getElementById(defId)) {
								addEvent(anchors[i],'mouseover',showComment);
								addEvent(anchors[i],'mouseout',hideComment);
							}
						}
					}
				}
			}
		}
	}
	return;
}





