function AL_MainMenu(name,menu,path,activ) {

// IDPARENT | ID | NAME | LINK | posx | posy

	var sName=name;
	var sPath=path;
	var aMenu=menu;
	var VisFl;
	var LaySub;
	var pAct=activ;

	this.SubMenuShow = function(flag) {
		if (flag) {
			LaySub.style.visibility="visible";
			VisFl=1;
		} else {
			if (VisFl==0) LaySub.style.visibility="hidden";
		}
	}

	this.SubMenuHide = function() {
		VisFl=0;
		setTimeout("eval('"+sName+".SubMenuShow(0);')",100);
	}

	this.SubMenu = function(nr) {
		var y=aMenu[nr];
		var sub=y[1];
		var posx=y[5];
		var posy=y[6];

		var txt="";
		podfl=1;
		while(podfl) {
			nr++;
			y=aMenu[nr];
			if (y[0]==sub) txt+="<a href='"+y[3]+"'>"+y[2]+"</a>";
			else podfl=0;
		}

		wri(LaySub,txt+"<div id='Bkg'></div>");
		LaySub.style.left=posx+"px";
		LaySub.style.top=posy+"px";
		this.SubMenuShow(1);
		LaySub.getElementsByTagName("div")[0].style.height=LaySub.clientHeight;
	}

	this.SubMenuView = function(nr,stan,subfl) {
		fname=sPath+nr+stan+".jpg";
		document[nr].src=fname;
		if (subfl!="0") {
			if (stan==2) this.SubMenu(subfl);
			if (stan==1) this.SubMenuHide();
		}
	}

	wri("<div class='MenuMainCont'><div class='MenuMainSub' id='MenuMainSub' onMouseOver='"+sName+".SubMenuShow(1);' onMouseOut='"+sName+".SubMenuHide();'></div>");
	LaySub=$("MenuMainSub");
	for(i=0;i<aMenu.length;i++) {
		x=aMenu[i];
		if (x[0]=="0") {
			subfl=(x[5])? i : "0";
			st=(pAct==x[1])? 2 : 1;
			wri("<a href='"+x[3]+"' onMouseOver='"+sName+".SubMenuView (\""+x[4]+"\",\"2\",\""+subfl+"\");' onMouseOut='"+sName+".SubMenuView (\""+x[4]+"\",\""+st+"\",\""+subfl+"\");'><img src='"+sPath+x[4]+st+".jpg' border=0 name='"+x[4]+"' title='"+x[2]+"' alt='"+x[2]+"'></a>");
		}
	}
	wri("</div>");
}

function MakeBkg(div1,div2) {
	if (div1) {
		sze=div1.clientWidth;
		wys=div1.clientHeight;
		if (div2) {
			div2.style.width=sze+"px";
			div2.style.height=wys+"px";
		}
		div1.style.height=wys+30+"px";
	}
}
