

var menu_x = 0;
var menu_y = 0;
var menu_w = 0;
var menu_h = 0;
var menu_obj = null;
var timeout = "nincs"
var alpha = 90;
var m_alpha = 0.9
;

function Init() {
}

function Show(Menu) {
	Menu.rejtes = false;
	Menu.style.visibility="visible";
	Menu.arnyek.style.visibility="visible";
	if (timeout!="nincs")
		clearTimeout(timeout);
	timeout = "nincs";
}

function Hide_(id) {
	x = new getObj(id);
	if (x.obj.rejtes) {
		x.obj.style.visibility="hidden";
		x.obj.arnyek.style.visibility="hidden";
	}
	if (timeout!="nincs")
		clearTimeout(timeout);
	timeout = "nincs";
}

function Hide(Menu) {
	Menu.rejtes = true;
	id = Menu.id;
	if (timeout=="nincs")
		timeout = setTimeout("Hide_('"+id+"')",100);
}

function CreateMenu(x,y,w,h,nev,tartalom,hatter) {
	document.writeln("<div id=\""+nev+"\" name=\""+nev+"\" style=\"visibility: hidden; background-color: #000000; "+hatter+" color: black;filter:alpha(opacity="+alpha+");-moz-opacity: "+m_alpha+";position: absolute; width: "+w+"px; height: "+h+"px;top: "+y+"px; left: "+x+"px;z-index: 100;border-style: outset; border-width: 1px; font-weight: bold;\">"+tartalom+"</div>");
	document.writeln("<div id=\""+nev+"_arnyek\" name=\""+nev+"_arnyek\" style=\"visibility: hidden; background-color: #000000; color: black;filter:alpha(opacity=20);-moz-opacity: 0.2;position: absolute; width: "+w+"px; height: "+h+"px;top: "+(y+5)+"px; left: "+(x+5)+"px;z-index: 99;border: solid 1px #000000; font-weight: bold;\">"+tartalom+"</div>");
	this.nev = nev;
	this.x = x;
	this.y = y;
	this.w = w;
	this.h = h;
	this.Show = function () {
		menu_x = this.x;
		menu_y = this.y;
		menu_w = this.w;
		menu_h = this.h;
		if (menu_obj!=null) {
			if (menu_obj!=this)
				menu_obj.HideNow();
		}
		menu_obj = this;
		x = new getObj(nev);
		Show(x.obj);
	};
	this.Hide = function () {
		x = new getObj(nev);
		Hide(x.obj);
	};
	this.HideNow = function () {
		x = new getObj(this.nev);
		x.obj.rejtes=true;
		Hide_(this.nev);
		x.obj.rejtes=false;
	};
	x = new getObj(nev);
	arnyek = new getObj(nev+"_arnyek");
	x.obj.onmouseout = MouseListener2;
	x.obj.onmousemove = MouseListener;
	x.obj.nev = nev;
	x.obj.arnyek = arnyek.obj;
	x.obj.Show = function () {
		Show(document.getElementById(this.nev));
	};
	x.obj.Hide = function () {
		Hide(document.getElementById(this.nev));
	};
	x.obj.rejtes = false;
	//document.getElementById(nev).onmouseup = MouseListener;
}

function Valami() {
	alert("aaa");
}

function MouseListener(e) {
	var event_obj;
	if (document.all)  {
		event_obj = event;
	} else {
		event_obj = e;
	}
	//alert(document.body.scrollTop);
	if (window.pageYOffset) scrollY = window.pageYOffset;
	else scrollY = document.body.scrollTop;
	if ( (event_obj.clientX>menu_x) && (event_obj.clientX<menu_x+menu_w) &&
		 (event_obj.clientY+scrollY>menu_y) && (event_obj.clientY+scrollY<menu_y+menu_h) ) {
		if (menu_obj!=null) {
			if (timeout!="nincs")
				clearTimeout(timeout);
			menu_obj.Show();
		}
	}
	/*var tg = (event_obj.target) ? event_obj.target : event_obj.srcElement;
	if (tg.nev)
	{
		tg.Show();
	}*/
}

function MouseListener2(e) {
	var event_obj;
	if (document.all)  {
		event_obj = event;
	} else {
		event_obj = e;
	}
	var tg = (event_obj.target) ? event_obj.target : event_obj.srcElement;
	if (tg.nev)
	{
		tg.Hide();
	} else if (menu_obj) {
		menu_obj.Hide();
	}
}
