baseimg = "img/navigation/";
timerSet = false;

mainPops = new Array();

visiblePop = new Array();
for (i=1; i<=4; i++)
{
	visiblePop[i]=false;
}

function changePopVis(PopName,ImgName,state)
{

	imgURL=baseimg + ImgName + "_" + state + ".gif";

	if (document.getElementById) //IE 5/6 NN 6
	{
		if (document.getElementById(ImgName))
		{
			document.getElementById(ImgName).src=imgURL;
		}

		if (document.getElementById(PopName))
		{
			if (state=="off")
			{
				if (document.getElementById(PopName).style.visibility!="hidden") document.getElementById(PopName).style.visibility="hidden";
			}
			else
			{
				if (document.getElementById(PopName).style.visibility!="visible") document.getElementById(PopName).style.visibility="visible";
			}
		}
	}
	else if (document.all) //IE 4.0 (?)
	{
		if (document.all(ImgName))
		{
			document.all(ImgName).src=imgURL;
		}

		if (document.all(PopName))
		{
			if (state=="off")
			{
				if (document.all(PopName).style.visibility!="hide") document.all(PopName).style.visibility="hidden";
			}
			else
			{
				if (document.all(PopName).style.visibility!="show") document.all(PopName).style.visibility="visible";
			}
		}
	}
}

function OpenClosePop()
{
	for (i=1; i<=4; i++)
	{
		if (visiblePop[i]==true)
		{
			changePopVis("menu"+i,"ml_"+i,"on");
		}
		else
		{
			changePopVis("menu"+i,"ml_"+i,"off");
		}
	}
}

function OpenClosePopTimer()
{
	if (timerSet==true) { OpenClosePop(); }
}


function showPop(sub1)
{
	for (i=1; i<=4; i++)
	{
		visiblePop[i]=false;
	}
	visiblePop[sub1]=true;

	timerSet=false;
	OpenClosePop();
}

function hidePop(sub1)
{
	for (i=1; i<=4; i++)
	{
		visiblePop[sub1]=false;
	}
	timerSet=true;
	window.setTimeout("OpenClosePopTimer()",1500);
}

function hideAllPop()
{
	for (i=1; i<=4; i++)
	{
		changePopVis("menu"+i,"ml_"+i,"off");
	}
}


function ChangeImage(ImgName,state)
{
	baseimg = "img/navigation/";
	url=baseimg + ImgName + "_" + state + ".gif";

	if (document.getElementById)
	{
		if (document.getElementById(ImgName)) document.getElementById(ImgName).src=url;
	}
	else if (document.all)
	{
		if (document.all(ImgName)) document.all(ImgName).src=url;
	}
}

function closeMenu()
{
	hideAllPop();
}
