var menuLeft = new Array();
menuLeft.push(new menuItemLeft("index_menu_1", "intro.shtml"));
menuLeft.push(new menuItemLeft("index_menu_2", "forthcoming/"));
menuLeft.push(new menuItemLeft("index_menu_3", "staff.shtml"));
menuLeft.push(new menuItemLeft("index_menu_4", "research/"));
menuLeft.push(new menuItemLeft("index_menu_5", "publications/"));
menuLeft.push(new menuItemLeft("index_menu_6", "activities/"));

var menuLeftSub = new Array();
menuLeftSub.push(new Array());
menuLeftSub.push(new Array());
menuLeftSub.push(new Array());
menuLeftSub.push(new Array());
menuLeftSub.push(new Array());
menuLeftSub.push(new Array());

var imgSpr = "/images/spacer.gif";

function menuItemLeft(img, lnk) {
	this.img = img;
	this.lnk = lnk;
}

function menuItemLeftSub(wrd, lnk) {
	this.wrd = wrd;
	this.lnk = lnk;
}

function writeMenuLeft(id) {
	for (var i = 0; i < menuLeft.length; i++) {
		var strOut = "";
		var butName = "butMenuLeft"+i;
		var pathImg = root+"images/"+menuLeft[i].img;
		var pathLnk = menuLeft[i].lnk;
		var imgUp = pathImg+"_down.gif";

		if (pathLnk.substring(4,7) != "://") pathLnk = root + pathLnk;

		if (i != id) imgUp = pathImg+"_up.gif";
		strOut += "<a href=\""+pathLnk+"\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('"+butName+"','','"+pathImg+"_over.gif"+"',1)\">";
		strOut += "<img src=\""+imgUp+"\" name=\""+butName+"\" width=\"175\" height=\"48\" border=\"0\">";
		strOut += "</a>";

		strOut += "<br>";
		document.writeln(strOut);

		if (i == id && menuLeftSub[i].length != 0) writeMenuLeftSub(i);
	}
}

function writeMenuLeftSub(id) {
	var strOut = "";
	var h = 18;
	var h2 = 8;
	var n = menuLeftSub[id].length;
	strOut += "<table border=\"0\" cellspacing=\"0\". cellpadding=\"2\">\n";
	for (var i = 0; i < n; i++) {
		var pathLnk = menuLeftSub[id][i].lnk;
		if (pathLnk.substring(4,7) != "://") pathLnk = root + pathLnk;
		strOut += "\t<tr><td><img src=\""+imgSpr+"\" width=\"1\" height=\""+h+"\"></td><td align=\"center\"><a href=\""+pathLnk+"\" class=\"fnt1\">"+menuLeftSub[id][i].wrd+"</a></td><td><img src=\""+imgSpr+"\" width=\"1\" height=\"1\"></td></tr>\n";
	}
	strOut += "\t<tr><td><img src=\""+imgSpr+"\" width=\"1\" height=\""+h2+"\"></td><td align=\"center\"></td></tr>\n";
	strOut += "</table>\n";
	document.write(strOut);
}

function writeHdrA(str, pt) {
	var strOut = "";
	var pathImg = root+"images/";
	if (pt != "") strOut += "<a name=\""+pt+"\"></a>";
	strOut += "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
	strOut += "\t<tr>\n";
	strOut += "\t\t<td><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
	strOut += "\t\t\t<tr> \n";
	strOut += "\t\t\t\t<td width=\"6\" background=\""+pathImg+"hdrA_1.gif\">&nbsp;</td>\n";
	strOut += "\t\t\t\t<td background=\""+pathImg+"hdrA_2.gif\" class=\"fntHdrA\">"+str+"</td>\n";
	strOut += "\t\t\t\t<td width=\"6\" background=\""+pathImg+"hdrA_3.gif\">&nbsp;</td>\n";
	strOut += "\t\t\t</tr>\n";
	strOut += "\t\t</table></td>\n";
	strOut += "\t\t<td align=\"right\">";
	if (pt != "") strOut += "<a href=\"#top\" class=\"lnk2\">TOP</a>";
	strOut += "</td>";
	strOut += "\t</tr>\n";
	strOut += "\t<tr>\n";
	strOut += "\t\t<td colspan=\"2\" class=\"clrHdrA\"><img src=\""+imgSpr+"\" width=\"1\" height=\"1\"></td>\n";
	strOut += "\t</tr>\n";
	strOut += "</table>\n";
	document.write(strOut);
}

function writeContact() {
	var strOut = "";
	strOut += "<img src=\""+imgSpr+"\" width=\"1\" height=\"30\"><br>";
	strOut += "<a href=\"mailto:prinfo@ln.edu.hk\"><img src=\""+root+"images/index_but_contact.gif\" width=\"76\" height=\"15\" hspace=\"10\" border=\"0\"></a>";
	document.write(strOut);
}

//MM begins
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//MM ends
