/*
var right_pic=new preload('/vdr-resources/images/icons/right.gif');
var left_pic=new preload('/vdr-resources/images/icons/left.gif');
var space_pic=new preload('/vdr-resources/images/space.gif');
*/
function initpos(obj)
{
	if(!obj)
		return;
	obj.settop();
	obj.setleft();

	if(obj.nextlevel)
	initpos(obj.nextlevel);
	if(obj.nextME)
		initpos(obj.nextME);
}

function init_4()
{
	this.menu=0;
	this.menuname="m1";
	this.onmouseover=mover;
	this.onmouseout=mout;
	this.img=this.getElementsByTagName("img")[0];

	switch(this.level)
	{
		case 1:
			this.active=active;
			this.inactive=inactive;
			this.hide=inactive;
			this.show=dummy;
			this.showlevel=active;
			this.hidelevel=dummy;
			this.settop=settopL1;
			this.setleft=setleftL1;
			break;
		default:
			this.img.style.visibility="hidden";

			this.active=activeHL;
			this.inactive=inactiveHL;
			this.hide=hideME;
			this.show=showME;
			this.showlevel=showlevel;
			this.settop=settopME;
			this.setleft=setleftME;
			break;
	}
}

function mover()
{
	hideall(m1[aktmenu]);
	m_mouseover=this;
	aktmenu=m_mouseover.menu
	hideall(m1[aktmenu]);
	m_mouseover.active();
	if(m_mouseover.nextlevel)
	{
		m_mouseover.nextlevel.showlevel();
		m_mouseover.nextlevel.inactive();
	}
	else
		m_mouseover.showlevel();
}

function mout()
{
	m_mouseover.inactive();
	m_mouseover=0;
	if(timer)
	{
		window.clearInterval(timer);
		timer=0;
	}
	timer=window.setInterval("hidei()",500);
}

function active()
{
	this.style.borderBottomWidth="2px";
	this.img.style.visibility="visible";
}

function inactive()
{
	if(this.id!=akt_menu.split(".")[0])
	{
		this.style.borderBottomWidth="0px";
		this.img.style.visibility="hidden";
	}
}

function activeHL()
{
	this.style.backgroundColor="#9BA4B2";
	this.img.style.visibility="visible";
}

function inactiveHL()
{
	this.style.backgroundColor="#F2F3F7";
	this.img.style.visibility="hidden";
}

function hideall(obj)
{
	if(!obj)
		return;
	obj.hide();
	hideall(obj.nextME);
	hideall(obj.nextlevel);
}

function hidei()
{
	if(m_mouseover)
	{
		window.clearInterval(timer);
		timer=0;
		return;
	}
	hideall(m1[aktmenu]);
	window.clearInterval(timer);
	timer=0;
}

function showlevel()
{
	this.show();
	if(this.nextlevel)
		this.active();
	var tmp=this.nextME;
	while(tmp)
	{
		tmp.show();
		tmp=tmp.nextME;
	}
	tmp=this;
	while(tmp.prevME)
	{
		tmp=tmp.prevME;
		tmp.show();
	}
	if(tmp.prevlevel)
		tmp.prevlevel.showlevel();
}

function dummy()
{
 return 0;
}

function hideME()
{
	this.style.visibility="hidden";
	this.inactive();
}

function showME()
{
	this.style.visibility="visible";
}

var row_counter=1;
function settopL1()
{
	if(this.prevME)
	{
		var w=this.prevME.offsetLeft+this.prevME.offsetWidth;
		if((w+this.offsetWidth>document.getElementById("navigation_pos").offsetWidth+1) )
		{
			row_counter++;
			if(row_counter<3)
			{
				document.getElementById("blank_n").style.display="block";
				document.getElementById("navigation_pos2").style.display="block";
				this.style.top=String(173)+"px";
			}else
			{
				document.getElementById("blank_n3").style.display="block";
				document.getElementById("navigation_pos3").style.display="block";
				this.style.top=String(198)+"px";
			}
		}else{
			this.style.top=this.prevME.offsetTop+"px";
		}
	}else{
		this.style.top=String(document.getElementById("navigation_pos").offsetTop+5)+"px";
	}
        this.settop=dummy;
}

function setleftL1()
{
	if(this.prevME)
	{
		var w=this.prevME.offsetLeft+this.prevME.offsetWidth;
		if(w+this.offsetWidth>document.getElementById("navigation_pos").offsetWidth+1)
		{
			this.style.left=String(document.getElementById("navigation_pos2").offsetLeft+29)+"px";
		}else
			this.style.left=String(w+7)+"px";
	}else{
		this.style.left=String(document.getElementById("navigation_pos").offsetLeft+29)+"px";
	}
}

function settopME()
{
	if(this.prevME)
	{
		this.style.top=String(this.prevME.offsetTop+this.prevME.offsetHeight)+"px";
	}else{
		if(this.prevlevel)
		{
			if(this.prevlevel.level==1)
				this.style.top=String(this.prevlevel.offsetTop+this.prevlevel.offsetHeight+7)+"px";
			else
				this.style.top=String(this.prevlevel.offsetTop)+"px";
		}else{
			this.style.top="0px";
		}
	}
}

function setleftME()
{
	if(this.prevME)
	{
		this.style.left=String(this.prevME.offsetLeft)+"px";
	}else
	{
		if(this.prevlevel)
		{
			if(this.prevlevel.level==1)
				this.style.left=String(this.prevlevel.offsetLeft)+"px";
			else
				this.style.left=String(this.prevlevel.offsetLeft + this.prevlevel.offsetWidth)+"px";
		}else{
			this.style.top="0px";
		}
	}
}