﻿window.status = "Μέγας Αλέξανδρος Ηρακλείας";

var ie=document.all
var ns6=document.getElementById&&!document.all

function ToggleMenu(link, divid, notMove)
{
	var div = document.getElementById(divid);

	if (div.style.display == 'none' || div.style.display == "")
		div.style.display = "block";

	link.onmouseout = function(e) {
		if (ie)
		{
			if (!event.fromElement.contains(event.toElement) && !link.contains(event.toElement))
				t = setTimeout("closeMenu('" + divid + "')", 100);
		}
		else
		{
			var targetAncestor = e.relatedTarget;
			while (targetAncestor.parentNode) {
				if (targetAncestor === e.currentTarget) {
					return; // ITS MOVING OUT OF US, BUT INTO OUR PROGENY, SO NOT REALLY OUT!
				}
				targetAncestor = targetAncestor.parentNode;
			}

			t = setTimeout("closeMenu('" + divid + "')", 100);
		}
	}

	div.onmouseover = function() {
		clearTimeout(t);
	}
	div.onmouseout = function(e) {
		if (ie)
		{
			if (!event.fromElement.contains(event.toElement) && !div.contains(event.toElement))
				t = setTimeout("closeMenu('" + divid + "')", 100);
		}
		else
		{
			var targetAncestor = e.relatedTarget;
			while (targetAncestor.parentNode) {
				if (targetAncestor === e.currentTarget) {
					return; // ITS MOVING OUT OF US, BUT INTO OUR PROGENY, SO NOT REALLY OUT!
				}
				targetAncestor = targetAncestor.parentNode;
			}

			t = setTimeout("closeMenu('" + divid + "')", 200);
		}
	}

	if(notMove != false) {
		var docPos = getPosition(link);
		document.getElementById(divid).style.top = docPos.y - 40;
		document.getElementById(divid).style.left = docPos.x + 130;
	}
}

function getPosition(e) {
	var left = 0;
	var top  = 0;

	while (e.offsetParent){
		left += e.offsetLeft;
		top  += e.offsetTop;
		e     = e.offsetParent;
	}

	left += e.offsetLeft;
	top  += e.offsetTop;

	return {x:left, y:top};
}

function closeMenu(divid)
{
	var div = document.getElementById(divid);
	div.style.display = "none";
}

function popUp(url, name, attr)
{
	window.open(url, name, attr + ",status=no,resizable=no,scrollbars=no,location=no,menubar=no,toolbar=no");
}