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 class="head"><h1>' + glossTitle + '</h1><a href="javascript:closeSoftPopup()>"><img src="/daimler/annual/2007/gb/layout/pic/misc/glossar_popup_close.gif" /></a></div><div class="clear"></div><div>' + 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 = '';
	}
}

