/****************************************************************************************
* By: Peter C. Y. Leung                                                                 *
* For: San Francisco State University, School of Engineering                            *
* Date: April 28, 2006                                                                  *
* Updated: April 28, 2006                                                               *
* Version: 0.90                                                                         *
* Site: http://engineering.sfsu.edu/faculty_and_staff                                   *
* Desciption: Javascript to take care effect for" Faculty / Staff" section              *
* Copyright 2004-2006 San Francisco State University, School of Engineering,            *
* San Francisco, California, U.S.A.                                                     *
****************************************************************************************/
people_num = 0;

function changeImages() {
	var face_name, img_name, tag_name, ppl_path;

	for (var i = 0; i < 9; i++) {
		face_name = "face" + i.toString();
		img_name = face_name + "_img";
		tag_name = face_name + "_tag";
		if (document.images[img_name].complete) {
			ppl_path = engr_people[people_num].path.indexOf("/");
			while ((ppl_path == -1 || ppl_path == null) && people_num < (engr_people.length - 1)) {
				people_num++;
				ppl_path = engr_people[people_num].path.indexOf("/");
			}
			document.images[img_name].src = engr_people[people_num].image;
			document.images[img_name].alt = engr_people[people_num].name;
			if (document.links[tag_name]) {
				document.links[tag_name].href = engr_people[people_num].link;
			} else {
				eval(tag_name + ".href = engr_people[people_num].link;");
			}
			people_num < (engr_people.length - 1) ? people_num++ : people_num = 0;
		}
	}
}

function peopleObj(name, path, room, phone, email) {
	this.name = name;
	this.path = path;
	this.image = "profiles_and_office_hours/" + this.path + "/images/portrait.jpg";
	this.link = "profiles_and_office_hours/" + this.path + "/index.html";
	this.room = room;
	this.phone = phone;
	this.email = email;
	this.text2HTML = text2HTML;
}

function text2HTML() {
	var out_text = "";

	out_text = this.name + "<br>";
	out_text += "Office: " + this.room + "<br>";
	out_text += "Phone: " + this.phone + "<br>";
	out_text += "Email: " + this.email;
	return(out_text);
}

function preLoadString(people) {
	var arr_name = new Array();
	var over_str = new Array();

	if (document.getElementById) {
		for (var i = 0; i < people.length; i++) {
			arr_name = people[i].path.split("/");
			over_str[arr_name[arr_name.length - 1]] = new loadString(people[i].text2HTML(), people[i].name);
		}
		return(over_str);
	}
}

var engr_people = new Array(
	new peopleObj("Mamdouh Abo-El-Ata","faculty/mamdouh_aboelata","SCI 122","(415) 338-2741","mamdouh@sfsu.edu"),
	new peopleObj("Alex Barszap","staff/alex_barszap","SCI 140B","(415) 405-0956","barszap@sfsu.edu"),
	new peopleObj("Cheng Chen","cheng_chen","SCI 168A.","(415) 338-7740","chcsfsu@sfsu.edu"),
	new peopleObj("A. S. (Ed) Cheng","faculty/ed_cheng","SCI 123","(415) 405-3486","N.A."),
	new peopleObj("Timothy D'Orazio","faculty/timothy_dorazio","SCI 168B","(415) 338-2262","EJKuczynsk@aol.com"),
	new peopleObj("Elahe Enssani","faculty/elahe_enssani","SCI 120","(415) 338-6581","enssani@sfsu.edu"),
	new peopleObj("Philip Frances","staff/philip_frances","SCI 140","(415) 405-0591","pfrances@sfsu.edu"),
	new peopleObj("Sergio Franco","faculty/sergio_franco","SCI 130","(415) 338-7741","sfranco@sfsu.edu"),
	new peopleObj("Ahmad Ganji","faculty/ahmad_ganji","SCI 129","(415) 338-7736","aganji@sfsu.edu"),
	new peopleObj("Marsha Harris","staff/marsha_harris","SCI 163","(415) 338-1228","mch7@sfsu.edu"),
	new peopleObj("Tom Holton","tom_holton","SCI 170","(415) 338-1529","tholton@sfsu.edu"),
	new peopleObj("Sung Hu","faculty/sung_hu","TH 323","(415) 338-2839","shu@sfsu.edu"),
	new peopleObj("Hao Jiang","faculty/hao_jiang","SCI 213C","(415) 338-6379","jianghao@sfsu.edu"),
	new peopleObj("Larry Klingenberg","faculty/larry_klingenberg","SCI 153","(415) 338-7734","larryk@sfsu.edu"),
	new peopleObj("V. V. Krishnan","faculty/v_krishnan","SCI 100","(415) 338-7821","krishnan@sfsu.edu"),
	new peopleObj("Shy Shenq Liou","faculty/shy_shenq_liou","SCI 163","(415) 338-1228","ssl@sfsu.edu"),
	new peopleObj("Hamid Mahmoodi","faculty/hamid_mahmoodi","SCI 213C","(415) 338-6579","mahmoodi@sfsu.edu"),
	new peopleObj("Morris Megerian","faculty/morris_megerian","SCI 120","(415) 338-1174","meguerdich@yahoo.com"),
	new peopleObj("Norman Owen","faculty/norman_owen","SCI 168A","(415) 338-7740","normowen@sfsu.edu"),
	new peopleObj("Mutlu Ozer","faculty/mutlu_ozer","SCI 112B","(415) 338-6578","ozer@sfsu.edu"),
	new peopleObj("Nilgun Ozer","faculty/nilgun_ozer","SCI 250","(415) 338-1328","mnozer@sfsu.edu"),
	new peopleObj("Wenshen Pong","faculty/wenshen_pong","SCI 121","(415) 338-7738","wspong@sfsu.edu"),
	new peopleObj("Hamid Shahnasser","faculty/hamid_shahnasser","SCI 128","(415) 338-2124","hamid@sfsu.edu"),
	new peopleObj("Dipendra Sinha","faculty/dipendra_sinha","SCI 131","(415) 338-7737","dsinha@sfsu.edu"),
	new peopleObj("Amir Tabrizi","faculty/amir_tabrizi","SCI 144","(415) 338-6181","atabrizi@sfsu.edu"),
	new peopleObj("Ghassan Tarakji","faculty/ghassan_tarakji","SCI 126","(415) 338-1851","gtarakji@sfsu.edu"),
	new peopleObj("Kwok-Siong Teh","faculty/kwok_siong_teh","SCI 124","(415) 405-4168","ksteh@sfsu.edu"),
	new peopleObj("Ronald Trauner","faculty/ronald_trauner","SCI 170A","(415) 338-6203","rtrauner@sfsu.edu"),
	new peopleObj("Anthony Wheeler","faculty/anthony_wheeler","SCI 123","(415) 338-1053","awheeler@sprintmail.com")
);