﻿function getCoordinates(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function setCoordinatesRelative(trigger, target, offsetX, offsetY) {
    var coordinates = getCoordinates(trigger);
    document.getElementById(target).style.left = coordinates[0] + offsetX;
    document.getElementById(target).style.top  = coordinates[1] + offsetY;
}

//Beispielaufruf - <a href="legal/contact.html" onclick="javascript:openWindow('legal/contact.html', 'contact'); return false">Kontakt</a>
function openWindow(url,target) {
	var parameter = 'status=no,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,titlebar=no,width=780,height=430';	
	var newwin = window.open(url,target,parameter);
	isOpen = url;
	newwin.focus();
}
