var glossaryWords = new Object();
var softPopupID = "softPopup";


function addGlossaryWord(linkID, glossaryID, glossaryTitle, glossaryDescription) {
	glossaryWords[glossaryID] = new Object();
	glossaryWords[glossaryID]["title"] = glossaryTitle;
	glossaryWords[glossaryID]["description"] = glossaryDescription;
}


function openGlossary(e, glossaryID) {
	openSoftPopup(e, "glossaryPopup", glossaryWords[glossaryID]["title"], glossaryWords[glossaryID]["description"]);
	return false;
}

function openSoftPopup(e, className, glossTitle, content) {
	
	var mySoftPopup = document.getElementById(softPopupID);
	
	if (mySoftPopup == null) {
		document.getElementsByTagName('body')[0].innerHTML = 
			"<div id=\""+softPopupID+"\" style=\"display:none;\"></div>" +
			document.getElementsByTagName('body')[0].innerHTML;
			;
		mySoftPopup = document.getElementById(softPopupID);
	}
	closeSoftPopup();
	
	mySoftPopup.innerHTML = '<div id="heading"><div id="closeButton"><a href="javascript:closeSoftPopup()"></a></div>' + glossTitle + '</div><div class="clear"></div><div id="glossarText">' + content + '</div>';
	mySoftPopup.className = className;
	mySoftPopup.style.position = "absolute";
	
	/*Prototype Solution:*/
	mySoftPopup.style.left = (Event.pointerX(e)+10)+"px";
	mySoftPopup.style.top = (Event.pointerY(e)+10)+"px";
	
	mySoftPopup.style.display = "block";
	mySoftPopup.onclick = closeSoftPopup;
}

function closeSoftPopup() {
	if (document.getElementById(softPopupID) != null) {
		document.getElementById(softPopupID).style.display = 'none';
		document.getElementById(softPopupID).innerHTML = '';
		document.getElementById(softPopupID).className = '';
	}
}



