function getProgressionNav (currentSelection) {
	var navArr = [
		["Selecting a Research Advisor", "selecting_advisor.php"],
		["BBC Journal Club Requirements", "bbc_requirements.php"],
		["Second Year Seminar", "second_year_seminar.php"],
		["Qualifying Exam", "qualifying_exam.php"],
		["Advancement to Candidacy &amp; Thesis Progression", "candidacy.php"]
	];
	
	var str = "<select name='progressionNav' onChange='window.location = this.value'>";
	
	var i = 0;
	while (i < navArr.length) {
		var menuTitle = navArr[i][0];
		var fileName = navArr[i][1];
		
		if (currentSelection == fileName) {
			str += "<option value='" + fileName + "' selected>" + menuTitle + "</option>";
		} else {
			str += "<option value='" + fileName + "'>" + menuTitle + "</option>";
		}
		
		i++;
	}
	
	str += "</select>";
	
	return str;
}

function getCurrentEventsNav (currentSelection) {
	var navArr = [
		["BMI Retreat 2006", "bmi_retreat_2006.php"],
		["BBC Journal Club", "bbc_journal_club.php"],
		["Thesis Seminars", "thesis_seminars.php"],
		["Second Year Bioinformatics Seminars", "second_year_seminars.php"],
		["Bioinformatics Pizza Talks", "pizza_talks.php"]
	];
	
	var str = "<select name='currentEventsNav' onChange='window.location = this.value'>";
	
	var i = 0;
	while (i < navArr.length) {
		var menuTitle = navArr[i][0];
		var fileName = navArr[i][1];
		
		if (currentSelection == fileName) {
			str += "<option value='" + fileName + "' selected>" + menuTitle + "</option>";
		} else {
			str += "<option value='" + fileName + "'>" + menuTitle + "</option>";
		}
		
		i++;
	}
	
	str += "</select>";
	
	return str;
}

function cookieImage (cookieName, dir, div, doAutoFlip, customArr) {
	if (!customArr) {
		var arr = [
			["pool.gif", "250", "167", "Aerial view of the UCSF Mission Bay Community Center rooftop pool. <i>Photo by Mark Defeo</i>", "UCSF Community Center Rooftop Pool"],
			["community_center_1.jpg", "250", "169", "The UCSF Mission Bay Community Center. <i>Photo by Lisa Cisneros</i>", "UCSF Community Center"],
			["community_center_2.jpg", "250", "187", "Jeanne Darrah, center, swims with her children, Guard and Darrah, in the rooftop pool. <i>Photo by Lisa Cisneros</i>", "UCSF Community Center"],
			["community_center_3.gif", "250", "333", "Architectural detail of the UCSF Community Center. <i>Photo by Majed</i>", "UCSF Community Center"],
			["hammering_man.jpg", "250", "355", "<b>Hammering Man at 2,903,440</b> by Jonathan Borofsky, on loan to UCSF from the San Francisco Museum of Modern Art. <i>Photo by Mark Citret</i>", "Public Art at UCSF"],
			["genentech_1.jpg", "250", "375", "View looking up from the floor of the atrium. <i>Photo by Majed</i>", "Genentech Hall"],
			["genentech_2.jpg", "250", "333", "Genentech Hall ampitheatre. <i>Photo by Roxanne Malek</i>", "Genentech Hall"],
			["genentech_3.jpg", "250", "373", "Visitors to Genentech Hall look at the expansive atrium that serves as a focal point in the 434,000-square-foot research building. <i>Photo by Christine Jegan</i>", "Genentech Hall"],
			["genentech_4.jpg", "250", "188", "Young researchers enjoy a break in the atrium's main lounge area. <i>Photo by Majed</i>", "Genentech Hall"],
			["genentech_5.jpg", "250", "188", "Laboratory space has been designed for efficiency and ease of movement. <i>Photo by Majed</i>", "Genentech Hall"]
		];
	} else {
		var arr = customArr;
	}
	
	var currNum = parseInt(readCookie(cookieName));
	currNum += flipDirection;
	
	if (isNaN(currNum) || currNum > (arr.length - 1)) currNum = 0;
	if (currNum < 0) currNum = arr.length - 1;
	
	writeCookie(cookieName, currNum, 24 * 365);
	
	var img = dir + "/" + arr[currNum][0];
	var width = arr[currNum][1];
	var height = arr[currNum][2];
	var caption = arr[currNum][3];
	var altText = (arr[currNum][4] != null) ? arr[currNum][4] : "";
	
	var writeDiv = div != false;
	var newDiv = "";
	
	if (writeDiv) newDiv += "<div class=\"pic\" style=\"width: " + width + "px;\">";
	if (writeDiv) newDiv += "<a href=\"javascript:autoFlip(-1)\">&larr;</a>&nbsp;&nbsp;<a href=\"javascript:autoFlip(1)\">&rarr;</a>";
	
	newDiv += "<a class=\"imagelink\" href=\"javascript:autoFlip(1)\"><img border=\"0\" src=\"" + img + "\" width=\"" + width + "\" height=\"" + height + "\" alt=\"" + altText + "\" /></a>";
	
	if (caption !== "") newDiv += "<div class=\"caption\">" + caption + "</div>";
	if (!writeDiv) newDiv += "<div id=\"splash_arrows\" style=\"text-align: center;\"><a href=\"javascript:autoFlip(-1)\">&larr;</a>&nbsp;&nbsp;<a href=\"javascript:autoFlip(1)\">&rarr;</a></div>";
	
	if (writeDiv) newDiv += "</div>";
	
	document.getElementById("cookie_pic").innerHTML = newDiv;
	
	myArr = [cookieName, dir, div, doAutoFlip, customArr];
	if (doAutoFlip) id = setTimeout("autoFlip()", 10000);
}

function autoFlip (dir) {
	flipDirection = (!dir) ? 1 : dir;
	
	clearTimeout(id);
	cookieImage(myArr[0], myArr[1],  myArr[2], myArr[3], myArr[4]);
}

function makeVisible (idStr, boo) {
	var e = document.getElementById(idStr);
	if (!e.style) return;
	
	var str = (boo) ? "inline" : "none";
	e.style.display = str;
}

//GLOBAL VARS
flipDirection = 1;
id = null;
myArr = null;
