// JavaScript Document

function makeMenu(thesection,thepage) {

	menulength = 9;

	//array to make the main menu
	var MenuItems= new Array(menulength+1);
	MenuItems[1]=new Array("home","Home","index.html",""); 
	MenuItems[2]=new Array("master","Master's Office","master.html",5); 
	MenuItems[3]=new Array("dean","Dean's Office","dean.html",4); 
	MenuItems[4]=new Array("about","About BK","about.html",14); 
	MenuItems[5]=new Array("security","Security","security.html",""); 
	MenuItems[6]=new Array("facilities","Facilities","facilities.html",16);  
	MenuItems[7]=new Array("fellowships","Fellowships","fellowships.html",5);
	MenuItems[8]=new Array("intramurals","Intramurals","intramurals.html",3);
	MenuItems[9]=new Array("calendar","Calendar","calendar.html",1);
	
	//arrays for submenus
	
	var master = new Array();
	master[1]=new Array("Master Marvin M. Chun","master_main.html");
	master[2]=new Array("Associate Master Woo-kyoung Ahn","master_associate.html");
	master[3]=new Array("Cyndi Erickson","master_opsmanager.html");
	master[4]=new Array("Eleanor Healey","master_admin.html");
	master[5]=new Array("Master's Aides","master_aides.html");
	
	var dean = new Array();
	dean[1]=new Array("Dean Kevin Hicks","dean_main.html");
	dean[2]=new Array("Michella Brophy","dean_admin.html");
	dean[3]=new Array("YCDO","http://www.yale.edu/yalecollege/students/administration/ycdo/index.html");	
	dean[4]=new Array("Academic Regulations","http://www.yale.edu/yalecollege/publications/ycps/index.html");
	
	var about = new Array();
	about[1]=new Array("Contact Information","about_contact.html");
	about[2]=new Array("BK Broadside","living_broadside.html");
	about[3]=new Array("BKCC","living_bkcc.html");
	about[4]=new Array("SAC","living_sac.html");
	about[5]=new Array("Fellows","about_fellows.html");
	about[6]=new Array("Old Campus Fellow","living_fellow.html");
	about[7]=new Array("Graduate Affiliates","about_gradaffiliates.html");
	about[8]=new Array("Tutors","living_tutors.html");
	about[9]=new Array("Computing Help","living_compasst.html");
	about[10]=new Array("BK Orchestra","living_orchestra.html");
	about[11]=new Array("Party Registration","living_partyreg.html");
	about[12]=new Array("Rooming","http://research.yale.edu/berkeleyhousing/");
	about[13]=new Array("Photos","living_photos.html");
	about[14]=new Array("History of BK","about_history.html");	
	
	var facilities = new Array();
	facilities[1]=new Array("Bagel Bar","facilities_bagelbar.html");
	facilities[2]=new Array("Multi-Purpose Room","facilities_mproom.html");
	facilities[3]=new Array("Dining Hall","facilities_dining.html");
	facilities[4]=new Array("Music Room","facilities_music.html");
	facilities[5]=new Array("Kitchen","facilities_kitchen.html");
	facilities[6]=new Array("Printing Press","facilities_printing.html");
	facilities[7]=new Array("Woodshop","facilities_woodshop.html");
	facilities[8]=new Array("Darkroom","facilities_darkroom.html");
	facilities[9]=new Array("Computer Cluster","facilities_compcluster.html");
	facilities[10]=new Array("Gym","facilities_gym.html");
	facilities[11]=new Array("Library","facilities_library.html");
	facilities[12]=new Array("Swiss Room","facilities_swiss.html");
	facilities[13]=new Array("Seminar Room","facilities_seminar.html");
	facilities[14]=new Array("Game Room","facilities_gameroom.html");
	facilities[15]=new Array("Common Room","facilities_commonrm.html");
	facilities[16]=new Array("Tunnel","facilities_tunnel.html");
	
	var fellowships = new Array();
	fellowships[1]=new Array("College Prizes","about_prizes.html");
	fellowships[2]=new Array("Sudler Fund","fellowships_sudler.html");
	fellowships[3]=new Array("Richter Fund","fellowships_richter.html");
	fellowships[4]=new Array("Commonplace Society","fellowships_commonplace.html");	
	fellowships[5]=new Array("Clare Mellon","fellowships_mellon.html");
	
	var intramurals = new Array();
	intramurals[1]=new Array("Schedule","intramurals_schedule.html");
	intramurals[2]=new Array("IM Secretaries","intramurals_secretaries.html");
	intramurals[3]=new Array("Photos","intramurals_photos.html");
	
	var calendar = new Array();
	calendar[1]=new Array("Master's Teas","master_teas.html");
	
	
	
	//make top of menu div
	document.write('<div id="menu"><table border="0" cellspacing="0" cellpadding="3">');
	
	for (x=1; x<=menulength; x++) {
	
		if (thesection==MenuItems[x][0]) {
			document.write('<tr><td valign="top"><a href="'+MenuItems[x][2]+'"><span class="boldgreen">'+MenuItems[x][1]+'</span></a>');
			
			//now make submenus, if any
			if(MenuItems[x][3]!="") {
				document.write('<div id="submenu"><table border="0" cellspacing="0" cellpadding="3">');
				for (y=1; y<=MenuItems[x][3]; y++) {
				document.write('<tr><td width="4"></td><td valign="top"><img src="images/menubullet.gif" width="7" height="9" /></td>');
				document.write('<td valign="top"><a href="'+eval(MenuItems[x][0])[y][1]+'"');
				if (eval(MenuItems[x][0])[y][1].match("http")) {
					document.write(' target="_blank"');
				}
				document.write('>');
				if (thepage==y) {
					document.write('<span class="boldgreen">'+eval(MenuItems[x][0])[y][0]+'</span>');
				} else {
					document.write(eval(MenuItems[x][0])[y][0]);
				}
				document.write('</a>');
				//add an extra table if rooming submenu
				if ((thesection=="living") && (y==8) && (thepage==8)) {
					roomingMenu();
				}
				document.write('</td></tr>');
				}
				document.write('</table><div>');
			}
			
			document.write('</td></tr>');
			
		} else {
			document.write('<tr><td valign="top"><a href="'+MenuItems[x][2]+'">'+MenuItems[x][1]+'</a></td></tr>');
		}
		
	}
	
	//make end of menu div
	document.write('</table><div>');
	
}

function roomingMenu() {
	document.write('<table border="0" cellspacing="0" cellpadding="2">');
	document.write('<tr><td colspan="2"><img src="images/spacer.gif" width="21" height="1" /></td></tr>');	
	document.write('<tr><td><img src="images/indent2.png" width="13" height="13" /></td><td><a href="living_rooming_calendar.html">Calendar</a></td></tr>');
	document.write('<tr><td><img src="images/indent2.png" width="13" height="13" /></td><td><a href="living_rooming_guidelines.html">Guidelines</a></td></tr>');
	document.write('<tr><td><img src="images/indent2.png" width="13" height="13" /></td><td><a href="living_rooming_committee.html">Committee</a></td></tr>');
	document.write('<tr><td><img src="images/indent2.png" width="13" height="13" /></td><td><a href="living_rooming_config.html">Configurations</a></td></tr>');
	document.write('<tr><td><img src="images/indent2.png" width="13" height="13" /></td><td><a href="living_rooming_plans.html">Floor Plans</a></td></tr>');
	document.write('</table>');
	
	
}