var menu=new Array(6);
menu[1]="WhatsNew";
menu[2]="Profile";
menu[3]="Research";
menu[4]="Cources";
menu[5]="Publications";
menu[6]="Lighterside";

var N_submenu=new Array(7);
N_submenu[1]=6;   // # of first level menus;
N_submenu[2]=2;   // # of first submenus under WhatsNew;
N_submenu[3]=1;   // # of first submenus under Profile;
N_submenu[4]=1;   // # of first submenus under Research;
N_submenu[5]=0;   // # of first submenus under Cources;
N_submenu[6]=2;   // # of first submenus under Publications;
N_submenu[7]=1;   // # of first submenus under Lighterside;


function MM_findObj(n, d) {
//v4.01 Find an object in the document
  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_nbGroup(event, grpName) {
//v6.0 Initialize and controle the manu accroding to operations.
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
  //initialize
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
  //onMouseOver
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
  //onMouseOut
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
  //onClick
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_preloadImages() {
//v3.0
 var c=document; if(c.images){ if(!c.MM_p) c.MM_p=new Array();
   var i,j=c.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ c.MM_p[j]=new Image; c.MM_p[j++].src=a[i];}}
}


function closebut(x,y,z)
{
  switch(y){
	case 1:
//undisplay all the tables and display the focused one:x
		for(var i=1;i<=N_submenu[y];i++) if(document.getElementById("M"+menu[i])) document.getElementById("M"+menu[i]).style.display="none"; 
		x.style.display="block";
		break;
	case 2:
	//undisplay all the blocks in table 'WhatsNew' and display the focused one:x
		for(var i=1;i<=N_submenu[y];i++)if(document.getElementById(menu[1]+i)) document.getElementById(menu[1]+i).style.display="none";
		x.style.display="block";
	//change the picture in the right according to z
	//document.getElementById("PCourses").src="images/PCourses"+z+".jpg";
		break;
	case 3:
	//undisplay all the blocks in table 'Profile' and display the focused one:x
		for(var i=1;i<=N_submenu[y];i++)if(document.getElementById(menu[2]+i)) document.getElementById(menu[2]+i).style.display="none";
		x.style.display="block";
	//change the picture in the right according to z
		if(document.getElementById("P"+menu[2])){
			document.getElementById("P"+menu[2]).src=(z==1)?"images/illman.jpg":(z==2)?"images/craig.jpg":(z==3)?"images/galluzzo.jpg":(z==4)?"images/hruby.jpg":(z==5)?"images/iverson.jpg":(z==6)?"images/kim.jpg":(z==7)?"images/liu.jpg":(z==8)?"images/massi.jpg":(z==9)?"images/neumann.jpg":(z==10)?"images/yin.jpg":"images/illman.jpg";
			document.getElementById("P"+menu[2]).alt=title[z];
		}
		if(document.getElementById("CV")) document.getElementById("CV").href=cvLink[z];
		break;
	case 4:
	//undisplay all the blocks in table 'Research' and display the focused one:x
	//	for(var i=1;i<=N_submenu[y];i++)if(document.getElementById(menu[3]+i)) document.getElementById(menu[3]+i).style.display="none";
	//	x.style.display="block";
	//change the picture in the right according to z
	//document.getElementById("PResearch").src="images/PResearch"+z+".jpg";
		break;
	case 5:
	//undisplay all the blocks in table 'Courses' and display the focused one:x
	//	for(var i=1;i<6;i++)if(document.getElementById(menu[4]+i)) document.getElementById(menu[4]+i).style.display="none";
	//	x.style.display="block";
	//change the picture in the right according to z
	//document.getElementById("PCourses").src="images/PCourses"+z+".jpg";
		break;
	case 6:
	//undisplay all the blocks in table 'Publications' and display the focused one:x
		for(var i=1;i<=N_submenu[y];i++)if(document.getElementById(menu[5]+i)) document.getElementById(menu[5]+i).style.display="none";
		x.style.display="block";
	//change the picture in the right according to z
	//document.getElementById("PPublications").src="images/PCourses"+z+".jpg";
		break;
	case 7:
	//undisplay all the blocks in table 'Lighterside' and display the focused one:x
		for(var i=1;i<=N_submenu[y];i++)if(document.getElementById(menu[6]+i)) document.getElementById(menu[6]+i).style.display="none";
		x.style.display="block";
	//change the picture in the right according to z
	//document.getElementById("PLighterside").src="images/PCourses"+z+".jpg";
		break;
	}
}
function contentSwitch(x,y,z)
{
	if(x.style.display!="none")
//undisplay it if it is clicked while displayed
	{
		x.style.display="none";
		if(y==1){
//change the status of the image of the title of the focused table
			for(var i=1;i<7;i++) if(x==document.getElementById("M"+menu[i])) b=document.getElementById(menu[i]); 
			b.src=b.MM_up;b.MM_dn=0;
		}
	}
	else
//display it undisplay the others if it is clicked while undisplayed
	{
		closebut(x,y,z);
	}
}

function load()
{
	MM_preloadImages('images/WhatsNew.gif','images/Profile_onclick.gif','images/Research_onclick.gif','images/Publications_onclick.gif','images/Lighterside_onclick.gif');
	MM_nbGroup('init','navbar1','WhatsNew','images/WhatsNew.gif',1);
	if(menustatus1=(readCookie("menustatus1")*1)) {
		MM_nbGroup('down','navbar1',menu[menustatus1],'images/'+menu[menustatus1]+'_onclick.gif',1);
		contentSwitch(document.getElementById("M"+menu[menustatus1]),1,0);
		if(document.getElementById("M"+menu[menustatus1])) document.getElementById("M"+menu[menustatus1]).style.display="block";
		if(menustatus2=(readCookie("menustatus2")*1)) {contentSwitch(document.getElementById(menu[menustatus1]+menustatus2), menustatus1+1, menustatus2);
		if(document.getElementById(menu[menustatus2]+menustatus2)) document.getElementById(menu[menustatus1]+menustatus2).style.display="block";
		}
	}
  // update the citation numbers
	for(var i=1;i<=num_pub;i++){
    if(document.getElementById('pub_journal_'+i) && cite_info[i-1]>0){
      document.getElementById('pub_journal_'+i).innerHTML=cite_info[i-1];
    }
  }	
}

function unLoad()
{
	for(var i=1;i<7;i++){ 
        if(document.getElementById("M"+menu[i])&&document.getElementById("M"+menu[i]).style.display=="block"){
            createCookie("menustatus1",i,0,0,10);
			for(var j=1;j<11;j++)if(document.getElementById(menu[i]+j)&&document.getElementById(menu[i]+j).style.display=="block"){
                createCookie("menustatus2",j,0,0,10);
            }
		}
    }
}

-->

