var req;function showEmployees(organisationUnit) {	var url = '../organisationUnitEmployees/'+organisationUnit;	if (window.XMLHttpRequest) {		req = new XMLHttpRequest();		req.onreadystatechange = replaceEmployeeList;		req.open("GET", url, true);		req.send(null);	} else if (window.ActiveXObject) {		req = new ActiveXObject("Microsoft.XMLHTTP");		if (req) {			req.onreadystatechange = replaceEmployeeList;			req.open("GET", url, true);			req.send();		}	}	var h2Organisationsplan = document.getElementById('Organisationsplan');	if (h2Organisationsplan != null)		window.scrollTo(0, getAbsolutePositionTop(h2Organisationsplan));}function replaceEmployeeList() {	if (req.readyState == 4) { // only if req shows "loaded"		if (req.status == 200) { // only if "OK"			var dynamicContent = document.getElementById('dynamicContent');			dynamicContent.innerHTML = req.responseText;		} else {			alert("There was a problem retrieving the XML data:\n" + req.statusText);		}	}}function showBusinessCard(aElement) {	var personKey = aElement.hash.substr(1);	var url = '../getPersonData?OpenAgent&id='+personKey;	if (window.XMLHttpRequest) {		req = new XMLHttpRequest();		req.open("GET", url, false);		req.send(null);	} else if (window.ActiveXObject) {		req = new ActiveXObject("Microsoft.XMLHTTP");		if (req) {			req.open("GET", url, false);			req.send();		}	}	if (req.status == 200) {		var contentDiv = document.getElementById('content');		var businessCard = document.getElementById('businessCard');		if (businessCard == null) {			businessCard = document.createElement('div');			businessCard.id = 'businessCard';			businessCard.setAttribute('style', 'display:none;');			contentDiv.appendChild(businessCard);  		}		if (businessCard != null) {			var response = req.responseXML.documentElement;			var orgUnit = getElementText(response, 'organisationUnit');			var name = getElementText(response, 'name');			var title = getElementText(response, 'title');			var phone = getElementText(response, 'phone');			var cellphone = getElementText(response, 'cellphone');			var email = getElementText(response, 'email');			var imageUrl;			var imageUrlTags = response.getElementsByTagName('imageUrl');			if (imageUrlTags != null && imageUrlTags[0] != null) {				imageUrl = imageUrlTags[0].firstChild.data;			}			var toinsert = imageUrl ? '<img src="'+imageUrl+'" alt="">' : '';			toinsert += '<div>';			toinsert += '<p><label>Kontakt</label></p>';			toinsert += '<p>'+name+'<br>';			toinsert += title+'</p>';			toinsert += '<p>Tel.: '+phone+'<br>';			if (cellphone != null) toinsert += 'Mobil: ' + cellphone + '<br>';			toinsert += 'E-mail: <a href="mailto:'+email+'?cc=anp@eogp.dk">'+email+'</a></p>';			toinsert += '</div>';			toinsert += '<span style="float:right; clear:right;"><a href="javascript:closeBusinessCard()">Luk</a></span>';			businessCard.innerHTML = toinsert;//			alert('\ngetAbsolutePositionTop(contentDiv): ' + getAbsolutePositionTop(contentDiv)+'\ngetRelativePositionTop(aElement): ' + getRelativePositionTop(aElement)+'\ngetRelativePositionTop(aElement.offsetParent): ' + getRelativePositionTop(aElement.offsetParent)+'\ngetAbsolutePositionTop(aElement): ' + getAbsolutePositionTop(aElement)+'\ngetAbsolutePositionTop(aElement.offsetParent): ' + getAbsolutePositionTop(aElement.offsetParent));//			alert('\ngetAbsolutePositionTop(contentDiv): ' + getAbsolutePositionTop(contentDiv)+'\ngetAbsolutePositionTop(aElement): ' + getAbsolutePositionTop(aElement));			businessCard.style.top = getAbsolutePositionTop(aElement)-getAbsolutePositionTop(contentDiv)+170+'px';			businessCard.style.left = getAbsolutePositionLeft(aElement)-getAbsolutePositionLeft(contentDiv)+'px';			businessCard.style.display = 'block';			businessCard.focus();		}	} else {		alert('There was a problem retrieving the XML data:\n' + req.statusText);	}}function getElementText(xmlTree, elementName) {	var textNode = xmlTree.getElementsByTagName(elementName)[0].firstChild	if (textNode != null && textNode.data) return textNode.data;	else return null;}function closeBusinessCard() {	var businessCard = document.getElementById('businessCard');	businessCard.style.display='none';}function getAbsolutePositionTop(someElement) {	var ofs = someElement.offsetTop;	if (someElement.offsetParent) ofs += getAbsolutePositionTop(someElement.offsetParent);	return ofs;}function getAbsolutePositionLeft(someElement) {	var ofs = someElement.offsetLeft;	if (someElement.offsetParent) ofs += getAbsolutePositionLeft(someElement.offsetParent);	return ofs;}function getRelativePositionTop(someElement) {	var ofs;	if (someElement.parentNode) ofs = someElement.parentNode.offsetTop	else ofs = 0;	return ofs;}
