// Demesy.JS

// Activates mouseover window
function openWindow (caller, win) {
    var myX = findPosX(caller);
    var myY = findPosY(caller)+20;
    watchWin=document.getElementById(win);
    watchWin.style.left = myX + 'px';
    watchWin.style.top = myY + 'px';
    watchWin.style.display = 'block';
}

// Closes mouseover window
function closeWindow(win) {
	watchWin=document.getElementById(win);
	watchWin.style.display = 'none';
}

// Gets the X coordinate of the parent object
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

// Gets the Y coordinate of the parent object
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

// Page jump function
// Used for drop down menu headers. (obsolete?)
function jumpToPage(form)
{
	var index;
	var URL;
	index=form.selectName.selectedIndex;
	URL=form.selectName.options[index].value;
	form.selectName.selectedIndex=0;
	window.location=URL;
}