NS6 = (document.getElementById&&!document.all)
IE = (document.all)
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")

items=new Array();
moving=setTimeout('null',1);
YOffsetNS=43;
YOffsetNS6=41;
YOffsetIE=43;
XOffset=0;
slideSpeed=2;
waitTime=200;
menuWidth=800;
menuHeight=14;
menuCols=6;
linkBGColor="#de8122";
linkAlign="left";
bar='<img src="../images-new/blank.gif" width=800 height=5 border=0>';

function moveDown() {
	if (parseInt(ssm.top)<0) {
		clearTimeout(moving);
		moving = setTimeout('moveDown()', slideSpeed);
		slideMenuUpDown(2);
	}
	else {
		clearTimeout(moving);
		moving=setTimeout('null',1);
	}
}

function moveUp() {
	clearTimeout(moving);
	moving = setTimeout('moveUp1()', waitTime);
}

function moveUp1() {
	if (parseInt(ssm.top)>(-menuHeight)) {
		clearTimeout(moving);
		moving = setTimeout('moveUp1()', slideSpeed);
		slideMenuUpDown(-2);
	}
	else {
		clearTimeout(moving);
		moving=setTimeout('null',1);
	}
}

function slideMenuUpDown(num){
	ssm.top = parseInt(ssm.top)+num;
	if (NS) {
		bssm.clip.bottom+=num;
		bssm2.clip.bottom+=num;
	if(bssm.top+bssm.clip.bottom>document.height)
		document.height+=num
	}
}

function initSlide() {
	if (NS6||IE){
		ssm=(NS6)?document.getElementById("thessm"):document.all("thessm");
		bssm=(NS6)?document.getElementById("basessm").style:document.all("basessm").style;
		bssm.clip="rect(0 "+ssm.offsetWidth+" "+(((IE)?document.body.clientHeight:0)+ssm.offsetHeight)+" 0)";
		bssm.visibility="visible";
		ssm=ssm.style;
		if(NS6)	bssm.top=YOffset
	}
	else if (NS) {
		bssm=document.layers["basessm1"];
		bssm2=bssm.document.layers["basessm2"];
		ssm=bssm2.document.layers["thessm"];
		bssm2.clip.left=0;
		bssm2.clip.top=0;
		ssm.visibility = "show";
	}
}

function buildBar() {
document.write('<tr><td colspan='+items.length+'>'+bar+'</td></tr>')
}


function buildMenu() {
	if (NS) {document.write('<LAYER name="basessm1" top="'+YOffsetNS+'" left='+XOffset+' visibility="show" onload="initSlide();moveUp();"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" left=0px top=0px onmouseover="moveDown()" onmouseout="moveUp()">');}
	if (IE) {document.write('<DIV ID="basessm" width='+menuWidth+' style="visibility:hidden; Position:Absolute; Left:'+XOffset+'; Top:'+YOffsetIE+'; Z-Index:20; width:'+menuWidth+'"><DIV ID="thessm" width='+menuWidth+' style="Position:Absolute; Left:0px; Top:0px; Z-Index:21;width:'+menuWidth+'" onmouseover="moveDown()" onmouseout="moveUp()">');}
	if (NS6) {
		document.write('<DIV ID="basessm" width='+menuWidth+' style="visibility:hidden; Position:Absolute; Left:'+XOffset+'; Top:'+YOffsetNS6+'; Z-Index:20; width:'+menuWidth+'"><DIV ID="thessm" width='+menuWidth+' style="Position:Absolute; Left:0px; Top:0px; Z-Index:21;width:'+menuWidth+'" onmouseover="moveDown()" onmouseout="moveUp()">');
		document.write('<table border="0" cellpadding="0" cellspacing="0"><TR><TD>');
	}
	document.write('<table border="0" cellpadding="0" cellspacing="0"><TR>');
	
	for(i=0;i<items.length;i++) {
		if(items[i][1])	document.write('<TD valign=top BGCOLOR="'+linkBGColor+'"><ILAYER><LAYER WIDTH="100%" ALIGN="'+linkAlign+'"><DIV ALIGN="'+linkAlign+'"><A HREF="'+items[i][1]+'" CLASS="ssmItems">'+items[i][0]+'</A></DIV></LAYER></ILAYER></TD>')
		else document.write('<TD valign=top BGCOLOR="'+linkBGColor+'"><ILAYER><LAYER WIDTH="100%" ALIGN="'+linkAlign+'"><DIV ALIGN="'+linkAlign+'">'+items[i][0]+'</DIV></LAYER></ILAYER></TD>')
	}
	document.write('</tr>');
	buildBar();
	document.write('</table>');
	if (NS6){document.write('</TD></TR></TABLE>')}
	if (IE||NS6) {document.write('</DIV></DIV>');setTimeout('initSlide();moveUp();', 1)}
	if (NS) {document.write('</ILAYER></LAYER>')}}

function addItem(name, link){
	items[items.length]=[name, link];
}

function buildSlidingMenu(){
	addItem('<img src="../images-new/blank.gif" width=52 height=14 border=0>', '');
	addItem('<img src="../images-new/about.gif" border=0>', '../about/');
	addItem('<img src="../images-new/blank.gif" width=50 height=14 border=0>', '');
	addItem('<img src="../images-new/people.gif" border=0>', '../people/');
	addItem('<img src="../images-new/blank.gif" width=50 height=14 border=0>', '');
	addItem('<img src="../images-new/publications.gif" border=0>', '../publications/');
	addItem('<img src="../images-new/blank.gif" width=50 height=14 border=0>', '');
	addItem('<img src="../images-new/projects.gif" border=0>', '../projects/');
	addItem('<img src="../images-new/blank.gif" width=50 height=14 border=0>', '');
	addItem('<img src="../images-new/faq.gif" border=0>', '../faq/');
	addItem('<img src="../images-new/blank.gif" width=50 height=14 border=0>', '');
	addItem('<img src="../images-new/contact.gif" border=0>', '../contact/');
	addItem('<img src="../images-new/blank.gif" width=73 height=14 border=0>', '');
	
	buildMenu();
}