var MenuLoaded = false;
var TempPic = new Image();
var OpenMenu = 0;
var VisibleDiv = "";
var SelectedPic = "";
var SelectedPicNum = 0;
ns = (document.layers) ? true:false;


over = new Array(16);
for(i = 0; i <= 16; i++){over[i] = new Image();}
over[0].src  = "}images/nav/scholars02.gif";
over[1].src  = "}images/nav/news02.gif";
over[2].src  = "}images/nav/partners02.gif";
over[3].src  = "}images/nav/enquiries02.gif";
over[4].src  = "}images/nav/app02.gif";
over[6].src  = "}images/nav/gallery02.gif";
over[7].src  = "}images/nav/speeches02.gif";
over[8].src  = "}images/nav/faq02.gif";
over[9].src  = "}images/nav/legal02.gif";
over[16].src  = "}images/nav/home02.gif";

original = new Array(16);
for(i = 0; i <= 16; i++){original[i] = new Image();}
original[0].src  = "}images/nav/scholars01.gif";
original[1].src  = "}images/nav/news01.gif";
original[2].src  = "}images/nav/partners01.gif";
original[3].src  = "}images/nav/enquiries01.gif";
original[4].src  = "}images/nav/app01.gif";
original[6].src  = "}images/nav/gallery01.gif";
original[7].src  = "}images/nav/speeches01.gif";
original[8].src  = "}images/nav/faq01.gif";
original[9].src  = "}images/nav/legal01.gif";
original[16].src  = "}images/nav/home01.gif";

function MenuOver(i,o)
{
	if (MenuLoaded && !ns)
	{
		document.images[o].src=over[i].src;
	}
}

function MenuOut(i,o)
{
	if (MenuLoaded && !ns && SelectedPic != o)
		document.images[o].src=original[i].src;
}


function Clicked(which,howmuch,showdiv,pageifnotloggedin)
{
	if (which == OpenMenu)
	{
		for (count=which+1;count<=14;count++)
		{
			var div = "m" + count
			var x = new getObj(div)
			x.style.top = (count * 19) - 4
		}
		OpenMenu = 0;
		Hide(showdiv);
	}
	else
	{
		if (OpenMenu != 0)
		{
			for (count=2;count<=14;count++)
			{
				var div = "m" + count
				var x = new getObj(div)
				x.style.top = (count * 19) - 4
			}
			Hide(VisibleDiv);
		}
		for (count=which+1;count<=14;count++)
		{
			var div = "m" + count
			var x = new getObj(div)
			x.style.top = (count * 19) + howmuch + 15
		}
		OpenMenu = which;
		Show(showdiv);
		VisibleDiv = showdiv;
	}
}

function SetMenu(i,o)
{
	if (MenuLoaded && !ns)
	{
		if (SelectedPic != o && SelectedPicNum != -1)
		{
			document.images[SelectedPic].src = original[SelectedPicNum].src;
		}
		document.images[o].src=over[i].src;
		SelectedPic = o;
		SelectedPicNum = i;
	}	
}

function getObj(name){
  if (document.getElementById){
  	this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;		
  }
  else if (document.all){
		this.obj = document.all[name];
		this.style = document.all[name].style;
  }
  else if (document.layers){
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}


function Show(div)
{
	if (ns)
		eval('document.'+div+'.visibility = "show";');
	else
		eval(div+'.style.visibility = "visible";');
}

function gotosection(value)
{
	if (value.length > 0)
	{
		if (confirm('Are you sure you want to jump to the section without saving?'))
			parent.mainframe.location.href = value;
	}
}