// JavaScript Document
var continueFlag = new Boolean(true)
var currentItem
var arrOfIndices = new Array(4)//Fang: change
var fileStructure = new Array(10)
var pageTitle
var thePath
var FacFlag


arrOfIndices[0]=-1//Fang: change
var currentUrl = document.URL //retrieve the url of the js file.

if(currentUrl.substring(0, 24) == "http://cogs.indiana.edu/")
{
	currentUrl=currentUrl.substring(24, currentUrl.length);
}
else
{
	currentUrl=currentUrl.substring(28, currentUrl.length);
}

//currentUrl=currentUrl.substring(28, currentUrl.length); //strip the first 27 characters because the first 34 characters are the same for all the files
if (currentUrl.substring(currentUrl.length-11, currentUrl.length) == "/index.html") {
	currentUrl = currentUrl.substring(0, currentUrl.length-11);  //strip index.html
}
if (currentUrl.substring(currentUrl.length-1, currentUrl.length) == "/") {
	currentUrl = currentUrl.substring(0, currentUrl.length-1);  //strip /
}

index = -1

var images = new Array ("right-about.gif", "right-aca.gif", "right-people.gif", "right-spe.gif", "right-research.gif", "right-pub.gif", "right-news.gif", "right-events.gif", "right-multi.gif")

for (var i = 0; i <= 9; i++) {
	fileStructure[i] = new Array();
	for (var j=0; j <= 11; j++) {
		fileStructure[i][j] = new Array();
		 for (var k = 0; k <=11 ; k++) {
			fileStructure[i][j][k] = new Array();
			for (var f = 0; f <= 6; f++) {
			fileStructure[i][j][k][f] = new FileStructureObject("", "", "")	
			}
		}
	}
}

//right nav of About
fileStructure[0][0][0][0] = new FileStructureObject("general/general.html", "About")
fileStructure[0][1][0][0] = new FileStructureObject("general/what.html", "What is Cognitive Science?")
fileStructure[0][2][0][0] = new FileStructureObject("general/general.html", "About Our Program")
fileStructure[0][3][0][0] = new FileStructureObject("general/brochure.html", "Promotional Materials")
fileStructure[0][4][0][0] = new FileStructureObject("general/elist.html", "Cognoscente Email List")
fileStructure[0][5][0][0] = new FileStructureObject("general/life.html", "Life in Bloomington")
fileStructure[0][6][0][0] = new FileStructureObject("events/links.html", "Cognitive Science Links")
fileStructure[0][6][1][0] = new FileStructureObject("events/web.html", "Resources")
fileStructure[0][6][2][0] = new FileStructureObject("events/current.html", "Current Issues")
fileStructure[0][6][3][0] = new FileStructureObject("events/underg.html", "Undergraduate Programs")
fileStructure[0][6][4][0] = new FileStructureObject("events/grad.html", "Graduate Programs")
fileStructure[0][6][5][0] = new FileStructureObject("events/prof.html", "Professional Organizations")
fileStructure[0][7][0][0] = new FileStructureObject("general/contact.html", "Contact Information")
fileStructure[0][7][0][1] = new FileStructureObject("END", "", "")

//right nav of academics
fileStructure[1][0][0][0] = new FileStructureObject("academic/academic.html", "Academics")
fileStructure[1][1][0][0] = new FileStructureObject("underg", "Undergraduate")

fileStructure[1][1][1][0] = new FileStructureObject("underg/advising.html", "Advising")
fileStructure[1][1][2][0] = new FileStructureObject("underg/degree.html", "Degrees Offered")
fileStructure[1][1][2][1] = new FileStructureObject("underg/ba.html", "Bachelor of Arts")
fileStructure[1][1][2][2] = new FileStructureObject("underg/bs.html", "Bachelor of Science")
fileStructure[1][1][2][3] = new FileStructureObject("underg/minor.html", "Minor")
fileStructure[1][1][2][4] = new FileStructureObject("underg/honors.html", "Honors Program")
//fileStructure[1][1][3][0] = new FileStructureObject("academic/underlist.html", "Courses")//no file
fileStructure[1][1][3][0] = new FileStructureObject("academic/undercourses.html", "Courses")
//fileStructure[1][1][3][2] = new FileStructureObject("academic/underschedule.asp", "Course Schedule")//new asp file
fileStructure[1][1][4][0] = new FileStructureObject("http://www.indiana.edu/~iusocs/", "Student Organization (SOCS)")//outside link
fileStructure[1][1][5][0] = new FileStructureObject("iacs/index.html", "Indiana Archives of Cognitive Science")
fileStructure[1][1][6][0] = new FileStructureObject("underg/opportunities.html", "Opportunities")
fileStructure[1][1][6][1] = new FileStructureObject("underg/oppgrad.html", "Graduate School")
fileStructure[1][1][6][2] = new FileStructureObject("underg/oppcareer.html", "Career")
fileStructure[1][1][6][3] = new FileStructureObject("underg/oppintern.html", "Internship")
fileStructure[1][1][6][4] = new FileStructureObject("underg/oppresearch.html", "Research")
fileStructure[1][1][7][0] = new FileStructureObject("underg/visit.html", "Visiting Research Fellows")

fileStructure[1][2][0][0] = new FileStructureObject("academic/gradprogram.html", "Graduate")
fileStructure[1][2][1][0] = new FileStructureObject("academic/graddegree.html", "Degrees Offered")
fileStructure[1][2][1][1] = new FileStructureObject("academic/standalone.html", "Ph.D.")
fileStructure[1][2][1][2] = new FileStructureObject("academic/joint.html", "Combined Ph.D.")
fileStructure[1][2][1][3] = new FileStructureObject("academic/minor.html", "Ph.D. Minor")
fileStructure[1][2][2][0] = new FileStructureObject("academic/adm.html", "Admissions")
fileStructure[1][2][3][0] = new FileStructureObject("academic/certificate.html", "Certificates")
fileStructure[1][2][4][0] = new FileStructureObject("academic/gradlist.html", "Courses")
fileStructure[1][2][4][1] = new FileStructureObject("academic/gradcourses.html", "Cognitive Science Courses")
fileStructure[1][2][4][2] = new FileStructureObject("academic/cross.html", "Cross-Listed Courses")
//fileStructure[1][2][4][2] = new FileStructureObject("academic/gradschedule.asp", "Course Schedule")//new asp file
fileStructure[1][2][5][0] = new FileStructureObject("academic/gradresearch.html", "Research")
fileStructure[1][2][6][0] = new FileStructureObject("academic/funding.html", "Funding")
fileStructure[1][2][7][0] = new FileStructureObject("dissertation", "Dissertation")
fileStructure[1][2][8][0] = new FileStructureObject("academic/orientation.html", "Orientation Guide")
fileStructure[1][2][9][0] = new FileStructureObject("academic/gradforms.html", "Forms")
fileStructure[1][2][10][0] = new FileStructureObject("academic/tools.html", "Thesis Tools")


fileStructure[1][3][0][0] = new FileStructureObject("academic/fellow.html", "Fellowships")
fileStructure[1][3][1][0] = new FileStructureObject("academic/modelingcog.html", "Modeling Cognition")
fileStructure[1][3][1][1] = new FileStructureObject("academic/modelingGrant/models.html", "Major Models")
fileStructure[1][3][1][2] = new FileStructureObject("academic/modelingGrant/modelcorefac.html", "Core Faculty")
fileStructure[1][3][1][3] = new FileStructureObject("academic/modelingGrant/addfac.html", "Affiliated Faculty")
fileStructure[1][3][1][4] = new FileStructureObject("academic/modelingGrant/predocFellow.html", "Predoctoral Fellowships")
fileStructure[1][3][1][5] = new FileStructureObject("academic/modelingGrant/postdocFellow.html", "Postdoctoral Fellowships")
fileStructure[1][3][2][0] = new FileStructureObject("academic/grants.html", "Affiliated Training Grants")
fileStructure[1][3][3][0] = new FileStructureObject("academic/visit.html", "Visiting Undergraduate Research")
fileStructure[1][3][4][0] = new FileStructureObject("academic/scholar.html", "Undergraduate Summer Research Scholarships")
fileStructure[1][3][4][1] = new FileStructureObject("END", "")

//right nav of people
fileStructure[2][0][0][0] = new FileStructureObject("people/people.html", "People")
fileStructure[2][1][0][0] = new FileStructureObject("people/adm.html", "Administration")
fileStructure[2][2][0][0] = new FileStructureObject("people/faculty.html", "Faculty")
fileStructure[2][3][0][0] = new FileStructureObject("people/emeriti.html", "Emeriti")
fileStructure[2][4][0][0] = new FileStructureObject("people/staff.html", "Staff")
fileStructure[2][5][0][0] = new FileStructureObject("events/faculty_ad_fall07.html", "Employment")
fileStructure[2][5][0][1] = new FileStructureObject("END", "")

//right nav of specialties
fileStructure[3][0][0][0] = new FileStructureObject("specialties", "Specialties")
fileStructure[3][1][0][0] = new FileStructureObject("animalcog", "Animal Cognition")
//fileStructure[3][1][1][0] = new FileStructureObject("animalcog/strengths.html", "Strengths")
fileStructure[3][1][1][0] = new FileStructureObject("animalcog/faculty.html", "Faculty")
fileStructure[3][1][2][0] = new FileStructureObject("animalcog/courses.html", "Courses")
fileStructure[3][1][3][0] = new FileStructureObject("animalcog/talks.html", "Talks")
fileStructure[3][1][4][0] = new FileStructureObject("animalcog/links.html", "Links")
fileStructure[3][2][0][0] = new FileStructureObject("http://jones.ling.indiana.edu/~cl/", "Computational Linguistics")
fileStructure[3][3][0][0] = new FileStructureObject("", "Dynamical Systems")
fileStructure[3][4][0][0] = new FileStructureObject("embodied", "Embodied Cognitive Science")
fileStructure[3][5][0][0] = new FileStructureObject("http://site.educ.indiana.edu/Default.aspx?alias=site.educ.indiana.edu/learnsci", "Learning Sciences")
fileStructure[3][6][0][0] = new FileStructureObject("http://bl-psy-appsrv.ads.iu.edu:8080/graduate/courses/cognitive.asp", "Mathematical and Computational Models of Cognition")
fileStructure[3][7][0][0] = new FileStructureObject("networksAndComplexSystems", "Networks and Complex Systems")
fileStructure[3][8][0][0] = new FileStructureObject("http://www.indiana.edu/~roboclub/", "Robotics")
fileStructure[3][8][0][1] = new FileStructureObject("END", "")


//right nav of research
fileStructure[4][0][0][0] = new FileStructureObject("research", "Research")
fileStructure[4][1][0][0] = new FileStructureObject("general/affiliates.html", "Departments, Labs, Centers and Institutes")
fileStructure[4][2][0][0] = new FileStructureObject("people/liasons.html", "Departmental Liasons")
fileStructure[4][4][0][0] = new FileStructureObject("underg/fair.html", "Undergraduate Research Fair")
fileStructure[4][4][0][1] = new FileStructureObject("END", "")

//right nav of publications
fileStructure[5][0][0][0] = new FileStructureObject("publications/publications.html", "Publications")//no file
fileStructure[5][1][0][0] = new FileStructureObject("inprogress/publications.html", "Faculty Publications")//no file
fileStructure[5][2][0][0] = new FileStructureObject("publications/newsletters/sp09.pdf", "Mind Reader Newsletter")
fileStructure[5][3][0][0] = new FileStructureObject("publications", "Technical Report Series")//original is in publications/index.html.  Need to decide whether index will be still used to hold tech reports.
//fileStructure[5][4][0][0] = new FileStructureObject("ugpapers/ugpapers.html", "Undergraduate Paper Repository")
fileStructure[5][4][0][0] = new FileStructureObject("publications/workingpapers.html", "IULC Working Papers")
fileStructure[5][5][0][0] = new FileStructureObject("publications/proc.html", "MAICSC Proceedings")
fileStructure[5][6][0][0] = new FileStructureObject("http://www.cogs.indiana.edu/iacs/journal.html", "Undergraduate Journal of Cognitive Science")//original is in publications/index.html.  Need to decide whether index will be still used to hold tech reports.
fileStructure[5][7][0][1] = new FileStructureObject("END", "")
//right nav of news
fileStructure[6][0][0][0] = new FileStructureObject("news", "News")
fileStructure[6][1][0][0] = new FileStructureObject("news/stories.asp","Cognitive Science News")
fileStructure[6][2][0][0] = new FileStructureObject("news/scientists.asp", "Cognitive Scientists in the News")
fileStructure[6][3][0][0] = new FileStructureObject("events/awardee.html", "Award Recipients")
fileStructure[6][3][1][0] = new FileStructureObject("events/awards2004.html", "2003-2004 Awards Ceremony")
fileStructure[6][3][2][0] = new FileStructureObject("events/awards2006.html", "2005-2006 Awards Ceremony")
fileStructure[6][3][3][0] = new FileStructureObject("events/awards2007.html", "2006-2007 Awards Ceremony")
fileStructure[6][3][4][0] = new FileStructureObject("events/awards2008.html", "2007-2008 Awards Ceremony")
fileStructure[6][3][4][1] = new FileStructureObject("END", "")
//right nav of events
fileStructure[7][0][0][0] = new FileStructureObject("events", "Events")
fileStructure[7][1][0][0] = new FileStructureObject("events/calendar.asp", "Calendar")//new asp file
fileStructure[7][2][0][0] = new FileStructureObject("events/coming.html", "Upcoming Talks")//no file
fileStructure[7][2][1][0] = new FileStructureObject("events/thisweek.asp", "This Week")//new asp file
fileStructure[7][2][2][0] = new FileStructureObject("events/nextweek.asp", "Next Week")//new asp file
fileStructure[7][3][0][0] = new FileStructureObject("events/q733.asp", "Q733 Colloquium")
fileStructure[7][4][0][0] = new FileStructureObject("events/coglunch.asp", "Cognitive Lunch")
fileStructure[7][5][0][0] = new FileStructureObject("http://www.informatics.indiana.edu/colloquia/", "Informatics Colloquia")//outside link
fileStructure[7][6][0][0] = new FileStructureObject("http://biocomplexity.indiana.edu/events/seminars.php", "Biocomplexity Seminars")//outside link
fileStructure[7][7][0][0] = new FileStructureObject("http://vw.indiana.edu/talks-spring09/", "Networks and Complex Systems")//outside link, undecide which URL should be used
fileStructure[7][8][0][0] = new FileStructureObject("events/special.asp", "Cognitive Science Special Events")
fileStructure[7][9][0][0] = new FileStructureObject("events/conference.html", "Conferences")
fileStructure[7][9][1][0] = new FileStructureObject("http://www.isls.org/icls2006/", "Learning Sciences")//outside link and has finished
fileStructure[7][9][2][0] = new FileStructureObject("http://www.alifex.org/", "Alife X")//outside link and has finished
fileStructure[7][9][3][0] = new FileStructureObject("http://www.icdl06.org/", "Development and Learning")//outside link and has finished
//fileStructure[7][9][4][0] = new FileStructureObject("http://www.indiana.edu/~psymodel/HML2006.shtml", "Hoosier Mental Life")//outside link and has finished
fileStructure[7][9][4][0] = new FileStructureObject("asic", "ASIC")
fileStructure[7][9][5][0] = new FileStructureObject("http://www.cognitivesciencesociety.org/index.html", "Cognitive Science Society")//outside link
fileStructure[7][9][6][0] = new FileStructureObject("http://www.mathpsych.org/", "Math Psych")
fileStructure[7][10][0][0] = new FileStructureObject("events/meetings.html", "Meetings")
//fileStructure[7][10][1][0] = new FileStructureObject("cogx", "COG-X - ROBOT-X")
fileStructure[7][10][2][0] = new FileStructureObject("spackled", "SPACKLED")
fileStructure[7][10][2][1] = new FileStructureObject("END", "")

//right nav of multimedia
fileStructure[8][0][0][0] = new FileStructureObject("media", "Multimedia")
fileStructure[8][1][0][0] = new FileStructureObject("pod", "Podcasting")//under construction
fileStructure[8][2][0][0] = new FileStructureObject("software", "Academic Software")
fileStructure[8][2][1][0] = new FileStructureObject("software/SigDetJ2/index.html", "Signal detection experiment")
fileStructure[8][2][2][0] = new FileStructureObject("software/STMScanJ2/index.html", "Sternberg's STM scanning experiment")
fileStructure[8][2][3][0] = new FileStructureObject("http://www.indiana.edu/~annotate/", "Annotate")//outside link, http://www.indiana.edu/~annotate/
fileStructure[8][2][4][0] = new FileStructureObject("software/linalg/linalg.html", "Matrix Arithmetic")
fileStructure[8][2][5][0] = new FileStructureObject("software/ttest/ttest.html", "t Statistic calculator")
fileStructure[8][2][6][0] = new FileStructureObject("http://www.indiana.edu/~cortex/connectivity_toolbox.html", "Brain Connectivity Toolbox")
fileStructure[8][3][0][0] = new FileStructureObject("events/photos.html", "Photo Gallery")
fileStructure[8][3][0][1] = new FileStructureObject("END", "")


var exceptionArr = new Array
exceptionArr[0] = new Array ("academic/positions.html", "Academic", "Postdoctoral Visitor and Faculty Positions")//the first string is the location, the second string is the beginning part of the path, the third part is the title and the last part of the path
exceptionArr[1] = new Array ("animalcog/ssr", "Speicialties", "Tool Manufacture by Enculturated Bonobos ")
exceptionArr[2] = new Array ("events/q733fall05.html", "Events", "Fall 2005 Q733")
exceptionArr[3] = new Array ("events/q733spr05.html", "Events", "Spring 2005 Q733")
exceptionArr[4] = new Array ("events/coglunchfall05.html", "Events", "Fall 2005 Cognitive Lunch")
exceptionArr[5] = new Array ("events/coglunchSpring04.html", "Events", "Spring 2004 Cognitive Lunch")
exceptionArr[6] = new Array ("events/coglunchSpring05.html", "Events", "Spring 2005 Cognitive Lunch")
exceptionArr[7] = new Array ("events/events.html", "Events", "Cognitive Science Newsletter")
exceptionArr[8] = new Array ("events/coglunchspr06.html", "Events", "Spring 2006 Cognitive Lunch")
exceptionArr[9] = new Array ("events/q733spr06.html", "Events", "Spring 2006 Q733")
exceptionArr[10] = new Array ("underg/alumletters.html", "Academic : Undergraduate", "Open Letter from an Alumnus")
exceptionArr[11] = new Array ("underg/gradSchoolPrep.html", "Academic : Undergraduate : Opportunities : Graduate School", "Preparation")
exceptionArr[12] = new Array ("underg/hci.html", "Academic : Undergraduate : Opportunities", "Human Computer Interaction")
exceptionArr[13] = new Array ("underg/resume.html", "Academic : Undergraduate : Opportunities : Career", "Resumés and Cover Letters")
exceptionArr[14] = new Array ("underg/samplecover.html", "Academic : Undergraduate : Opportunities : Career", "Sample Cover Letter")
exceptionArr[15] = new Array ("underg/sampleresume.html", "Academic : Undergraduate : Opportunities : Career", "Sample Resumés")
exceptionArr[16] = new Array ("underg/submit.html", "Academic : Undergraduate : Opportunities : Research", "Submit Research Assistant Advertisement")
exceptionArr[17] = new Array ("underg/whatisletterRG.html", "About : What is Cognitive Science?", "Perspectives on What is Cognitive Science?")
exceptionArr[18] = new Array ("academic/admissions.html", "Academic : Admission", "Admission to the Cognitive Science Ph.D. Program")
exceptionArr[19] = new Array ("events/coglunchFall04.html", "Events", "Fall 2004 Cognitive Lunch")
exceptionArr[20] = new Array ("events/cognosamples.html", "About", "Cognoscente Sample Post Page")
exceptionArr[21] = new Array ("animalcog/talks06s.html", "Specialties : Animal Cognition", "2006 Spring Talks")
exceptionArr[22] = new Array ("events/q733fall06.asp", "Events", "Fall 2006 Q733")
exceptionArr[23] = new Array ("events/coglunchfall06.asp", "Events", "Fall 2006 Cognitive Lunch")
exceptionArr[24] = new Array ("events/q733spr07.asp", "Events", "Spring 2007 Q733")
exceptionArr[25] = new Array ("events/coglunchspring07.asp", "Events", "Spring 2007 Cognitive Lunch")
exceptionArr[26] = new Array ("events/q733fall07.asp", "Events", "Fall 2007 Q733")
exceptionArr[27] = new Array ("feedback/feedback.html", "", "Feedback")
exceptionArr[28] = new Array ("feedback/feedback.asp", "", "Feedback")
exceptionArr[29] = new Array ("feedback/feedbackDisplay.asp", "", "Feedback Display")
exceptionArr[30] = new Array ("events/q733spr08.asp", "Events", "Spring 2008 Q733")
exceptionArr[31] = new Array ("events/coglunchfall07.asp", "Events", "Fall 2007 Cognitive Lunch")
exceptionArr[32] = new Array ("events/coglunchspring08.asp", "Events", "Spring 2008 Cognitive Lunch")
exceptionArr[33] = new Array ("events/coglunchfall08.asp", "Events", "Fall 2008 Cognitive Lunch")
exceptionArr[26] = new Array ("events/q733fall08.asp", "Events", "Fall 2008 Q733")
exceptionArr[34] = new Array ("events/q733spr09.asp", "Events", "Spring 2009 Q733")

var peopleArr = new Array //all people's homepage go here.
peopleArr[0] = new Array ("people/homepages/alexander.html", "Faculty", "Joyce M. Alexander")
peopleArr[1] = new Array ("people/homepages/allen.html", "Faculty", "Colin Allen")
peopleArr[2] = new Array ("people/homepages/barab.html", "Faculty", "Sasha Barab")
peopleArr[3] = new Array ("people/homepages/bingham.html", "Faculty", "Geoffrey P. Bingham")
peopleArr[4] = new Array ("people/homepages/bradley.html", "Faculty", "Arthur Bradley")
peopleArr[5] = new Array ("people/homepages/burnett.html", "Faculty", "Theresa Burnett")
peopleArr[6] = new Array ("people/homepages/busemeyer.html", "Faculty", "Jerome R. Busemeyer")
peopleArr[7] = new Array ("people/homepages/busey.html", "Faculty", "Thomas A. Busey")
peopleArr[8] = new Array ("people/homepages/candy.html", "Faculty", "T. Rowan Candy")
peopleArr[9] = new Array ("people/homepages/cunningham.html", "Faculty", "Donald J. Cunningham")
peopleArr[10] = new Array ("people/homepages/dejong.html", "Faculty", "Kenneth de Jong")
peopleArr[11] = new Array ("people/homepages/dhar.html", "Faculty", "Sumit Dhar")
peopleArr[12] = new Array ("people/homepages/duffy.html", "Faculty", "Thomas M. Duffy")
peopleArr[13] = new Array ("people/homepages/dunn.html", "Faculty", "J. Michael Dunn")
peopleArr[14] = new Array ("people/homepages/eberle.html", "Faculty", "Ruth Eberle")
peopleArr[15] = new Array ("people/homepages/estes.html", "Faculty", "William K. Estes")
peopleArr[16] = new Array ("people/homepages/nubli.html", "Staff", "Nubli Kasa")
peopleArr[17] = new Array ("people/homepages/jaebrown.html", "Staff", "James E. Brown")
peopleArr[18] = new Array ("people/homepages/chaouli.html", "Faculty", "Michel Chaouli")
peopleArr[19] = new Array ("people/homepages/fox.html", "Faculty", "Julia R. Fox")
peopleArr[20] = new Array ("people/homepages/franks.html", "Faculty", "Steven Franks")
peopleArr[21] = new Array ("people/homepages/garraghty.html", "Faculty", "Preston Evans Garraghty")
peopleArr[22] = new Array ("people/homepages/gasser.html", "Faculty", "Michael Gasser")
peopleArr[23] = new Array ("people/homepages/gershkoff.html", "Faculty", "Lisa Gershkoff-Stowe")
peopleArr[24] = new Array ("people/homepages/gierut.html", "Faculty", "Judith Gierut")
peopleArr[25] = new Array ("people/homepages/gold.html", "Faculty", "Jason M. Gold")
peopleArr[26] = new Array ("people/homepages/goldstone.html", "Faculty", "Robert Goldstone")
peopleArr[27] = new Array ("people/homepages/hanson.html", "Faculty", "Andrew J. Hanson")
peopleArr[28] = new Array ("people/homepages/hofstadter.html", "Faculty", "Douglas Hofstadter")
peopleArr[29] = new Array ("people/homepages/isaacson.html", "Faculty", "Eric J. Isaacson")
peopleArr[30] = new Array ("people/homepages/james.html", "Faculty", "Thomas W. James")
peopleArr[31] = new Array ("people/homepages/kewley.html", "Faculty", "Diane Kewley-Port")
peopleArr[32] = new Array ("people/homepages/kidd.html", "Faculty", "Gary R. Kidd")
peopleArr[33] = new Array ("people/homepages/king.html", "Staff", "Terri King")
peopleArr[34] = new Array ("people/homepages/kirk.html", "Faculty", "Karen Iler Kirk")
peopleArr[35] = new Array ("people/homepages/lang.html", "Faculty", "Annie Lang")
peopleArr[36] = new Array ("people/homepages/leake.html", "Faculty", "David B. Leake")
peopleArr[37] = new Array ("people/homepages/lester.html", "Faculty", "Frank K. Lester, Jr.")
peopleArr[38] = new Array ("people/homepages/lsmith.html", "Faculty", "Linda B. Smith")
peopleArr[39] = new Array ("people/homepages/martins.html", "Faculty", "Emília P. Martins")
peopleArr[40] = new Array ("people/homepages/mcrobbie.html", "Faculty", "Michael A. McRobbie")
peopleArr[41] = new Array ("people/homepages/mills.html", "Faculty", "Jonathan W. Mills")
peopleArr[42] = new Array ("people/homepages/moss.html", "Faculty", "Lawrence S. Moss")
peopleArr[43] = new Array ("people/homepages/mostafa.html", "Faculty", "Javed Mostafa")
peopleArr[44] = new Array ("people/homepages/murray.html", "Faculty", "Laura Murray")
peopleArr[45] = new Array ("people/homepages/newman.html", "Faculty", "Sharlene D. Newman")
peopleArr[46] = new Array ("people/homepages/nosofsky.html", "Faculty", "Robert M. Nosofsky")
peopleArr[47] = new Array ("people/homepages/ostrom.html", "Faculty", "Elinor Ostrom")
peopleArr[48] = new Array ("people/homepages/peebles.html", "Faculty", "Christopher S. Peebles")
peopleArr[49] = new Array ("people/homepages/pisoni.html", "Faculty", "David B. Pisoni")
peopleArr[50] = new Array ("people/homepages/plucker.html", "Faculty", "Jonathan A. Plucker")
peopleArr[51] = new Array ("people/homepages/port.html", "Faculty", "Robert F. Port")
peopleArr[52] = new Array ("people/homepages/rawlins.html", "Faculty", "Gregory J. E. Rawlins")
peopleArr[53] = new Array ("people/homepages/beer.html", "Faculty", "Randall D. Beer")
peopleArr[54] = new Array ("people/homepages/rogers.html", "Faculty", "Yvonne Rogers")
peopleArr[55] = new Array ("people/homepages/sherman.html", "Faculty", "Steven J. Sherman")
peopleArr[56] = new Array ("people/homepages/shiffrin.html", "Faculty", "Richard M. Shiffrin")
peopleArr[57] = new Array ("people/homepages/steinmetz.html", "Faculty", "Joseph E. Steinmetz")
peopleArr[58] = new Array ("people/homepages/stolt.html.html", "Faculty", "Erik Stolterman")
peopleArr[59] = new Array ("people/homepages/stotz.html", "Faculty", "Karola Stotz")
peopleArr[60] = new Array ("people/homepages/stringer.html", "Faculty", "David Stringer")
peopleArr[61] = new Array ("people/homepages/thelen.html", "Faculty", "Esther Thelen")
peopleArr[62] = new Array ("people/homepages/thibos.html", "Faculty", "Larry N. Thibos")
peopleArr[63] = new Array ("people/homepages/timberlake.html", "Faculty", "William D. Timberlake")
peopleArr[64] = new Array ("people/homepages/wade.html", "Faculty", "Michael J. Wade")
peopleArr[65] = new Array ("people/homepages/towle.html", "Staff", "Susan Towle")
peopleArr[66] = new Array ("people/homepages/townsend.html", "Faculty", "James T. Townsend")
peopleArr[67] = new Array ("people/homepages/watson.html", "Faculty", "Charles S. Watson")
peopleArr[68] = new Array ("people/homepages/weinberg.html", "Faculty", "Jonathan Weinberg")
peopleArr[69] = new Array ("people/homepages/winston.html", "Faculty", "Wayne L. Winston")
peopleArr[70] = new Array ("people/homepages/yu.html", "Faculty", "Chen Yu")
peopleArr[71] = new Array ("pmtodd.html", "Faculty", "Peter M. Todd")
peopleArr[72] = new Array ("people/homepages/beggs.html", "Faculty", "John Beggs")
peopleArr[73] = new Array ("people/homepages/kruschke.html", "Faculty", "John K. Kruschke")
peopleArr[74] = new Array ("people/homepages/rinella.html", "Staff", "Kelsey Rinella")
peopleArr[75] = new Array ("people/homepages/stolt.html", "Faculty", "Erik Stolterman")
peopleArr[76] = new Array ("people/homepages/moczek.html", "Faculty", "Armin P. Moczek")
peopleArr[77] = new Array ("people/homepages/brown.html", "Faculty", "Joshua W. Brown")
peopleArr[78] = new Array ("people/homepages/hagar.html", "Faculty", "Amit Hagar")
peopleArr[79] = new Array ("people/homepages/trosset.html", "Faculty", "Michael W. Trosset")
peopleArr[80] = new Array ("people/homepages/anderson.html", "Faculty", "Raquel T. Anderson")
peopleArr[81] = new Array ("people/homepages/kuebler.html", "Faculty", "Sandra K&uuml;bler")
peopleArr[82] = new Array ("people/homepages/hamid.html", "Faculty", "Hamid R. Ekbia")
peopleArr[83] = new Array ("people/homepages/davies.html", "Faculty", "Ivor Kevin Davies")
peopleArr[84] = new Array ("people/homepages/darcy.html", "Faculty", "Isabelle Darcy")
peopleArr[85] = new Array ("people/homepages/tbent.html", "Faculty", "Tessa Bent")
peopleArr[86] = new Array ("people/homepages/amyecook.html", "Faculty", "Amy Cook")
peopleArr[87] = new Array ("people/homepages/goldstone2.html", "Faculty", "Robert Goldstone")






FindSelect(fileStructure);
//alert(currentUrl)
//alert(arrOfIndices[0])
//alert(arrOfIndices[1])
//alert(arrOfIndices[2])
//alert(arrOfIndices[3])
var index0 = arrOfIndices[0];
var index1 = arrOfIndices[1];
var index2 = arrOfIndices[2];
var index3 = arrOfIndices[3];
if (index3==undefined && (currentUrl.indexOf("people/homepages")==0 || currentUrl.indexOf("pmtodd")==0)) {
	for (var x=0; x<peopleArr.length; x++) {
		if (peopleArr[x][0]==currentUrl) {
			pageTitle=peopleArr[x][2];
			if (peopleArr[x][1]=="Faculty") {
				facFlag = 1;
			}
			thePath="Cognitive Science : People : " + peopleArr[x][1] + " : " + pageTitle;
			break;
		}
	}	
}
else if (index3==undefined) {
	for (var y=0; y<exceptionArr.length; y++) {
		if (exceptionArr[y][0]==currentUrl || currentUrl.indexOf(exceptionArr[y][0].concat("#"))==0 || currentUrl.indexOf(exceptionArr[y][0].concat("/index.html#"))==0 || currentUrl.indexOf(exceptionArr[y][0].concat("/index.htm#"))==0) {
			pageTitle=exceptionArr[y][2];
			thePath="Cognitive Science : " + exceptionArr[y][1] + " : " + pageTitle;
			break;
		}
	}
}
else {
	pageTitle = fileStructure[index0][index1][index2][index3].text
	
	thePath = pageTitle;
	
	if (index3 > 0) {  //path goes to 4th level
		thePath = "Cognitive Science : " + fileStructure[index0][0][0][0].text + " : " + fileStructure[index0][index1][0][0].text + " : " + fileStructure[index0][index1][index2][0].text + " : " + thePath;
	}
	else if ((index3 == 0) & (index2 != 0)) {  //path is 3 levels
		thePath = "Cognitive Science : " + fileStructure[index0][0][0][0].text + " : " + fileStructure[index0][index1][0][0].text + " : " + thePath;
	} 
	else if (index2 == 0) {  //path is 2 levels
		thePath = "Cognitive Science : " +  fileStructure[index0][0][0][0].text + " : " + thePath; 
	}//Fang: each case was added a new part of fileStructure[index0][0][0][0]
}
//document.title = thePath;

// Nubli: Being used in "specialties\index.html" and etc
// Don't have to change the index.html anymore, simply change the nav.js fileStructure accordingly
function WriteLinks() {
	if (index3!=undefined) {
		SetIDs(fileStructure[index0]);
		WriteMenuLinks(fileStructure[index0]);
	}
}

// ============== WriteMenuItem2() =================
function WriteAMenuItem2(theArray) {
	var url = theArray.name;
	var startLetters=url.substring(0,7);
	if (startLetters=="http://") {
		document.write ("<p><a href='" + theArray.name + "'>" + theArray.text + "</a></p>");
	}
	else {
		document.write ("<p><a href='http://www.cogs.indiana.edu/" + theArray.name + "' id='");
		document.write(theArray.id);
		document.write ("'>" + theArray.text + "</a></p>");
	}
}

// ============== WriteMenuLinks() =================
function WriteMenuLinks(arr) {
	var foundFirst = 0, foundSecond = 0, foundThird = 0, foundFourth=0;
	var continueFlag2 = new Boolean(true)
	if (continueFlag2) {
		for (var m = 1; m < arr.length; m++) {
			if (continueFlag2) {
				for (var n = 0; n < arr[m].length; n++) {
					if (continueFlag2) {
						for (var t = 0; t < arr[m][n].length; t++) {
							if (arr[m][n][t].name == "END") {//no more nav items
								continueFlag2 = false;
								break;
							}
							else if ((arr[m][n][t].name == "") & (t > 1) & (index1 == m & index2 == n)) {  //end of a fourth level menu
								if (arr[m][n][t-1].name != "") {
									break;
								}
							}
							else if ((arr[m][n][t].name == "") & (t == 0) & (index1 == m) & (n > 1)) {  //end of a third level menu
								if (arr[m][n-1][0].name != "") {
									break;
								}
							}
							else if (arr[m][n][t].name == "") {  //an item with no submenus
								break;
							}
							else {
								if ((index1 == m & index2 == n) & (t != 0)) {
									if (foundFourth == 0) {

										foundFourth = 1;
									}
									WriteAMenuItem2(arr[m][n][t]);
								}
								else if ((index1==m) & (n != 0) & (t == 0)) {
									if (foundThird == 0) {
										foundThird = 1;
									}
									WriteAMenuItem2(arr[m][n][t]);
								}
								else if (n == 0 & t == 0){
									if (foundSecond == 0) {
										foundSecond = 1;
									}
									WriteAMenuItem2(arr[m][n][t]);
								}

							}
						}
					}
					else {
						break;
					}
				}
			}
			else {
				break;
			}
		}
	}
}
// ============== WriteMenuLinks() END =================

function WriteNavigation() {
	if (index3!=undefined) {//Fang: if this is an navigation item
		SetIDs(fileStructure[index0]);
		WriteImage(fileStructure[index0][0][0][0]);
		document.write("<div id='rightnav'>");
		WriteMenu(fileStructure[index0]);
		document.write("</div>");
	}
}
	
function WritePath() {//Fang: change
	if (index1!=-1) {
	document.write(thePath);
	}
}

function WriteTitle() {
	document.write(pageTitle);
}

function WriteTitleInBrowser() {
	document.title = thePath;
}

function FileStructureObject(name, text) {
  this.name = name;
  this.id = "";
  this.text = text;
}

function WriteImage(theObj) {
	document.write("<div class='fileStructure'><a href='http://www.cogs.indiana.edu/" + theObj.name + "'><img src='/images/2006/" + images[index0] + "' border=0></a></div>");//Fang: changed theObj.text to images[index0]
}

function SetIDs(arr) {
	
	if (index3 != 0) {
		arr[index1][index2][index3].id = "select";
		arr[index1][index2][0].id = "selectsub";
		arr[index1][0][0].id = "selectsub";
	}
	else if (index2 != 0) { //if index3==0
		if (arr[index1][index2][1].name != "" & arr[index1][index2][1].name != "END") {//Fang: the next one's name can equal to "END"
			arr[index1][index2][0].id = "selectsub";
		}
		else {
			arr[index1][index2][0].id = "select";			
		}
		arr[index1][0][0].id = "selectsub";
	}
	else if (index1 != 0) { //if index3==0	and index2==0
		arr[index1][0][0].id = "select";//Fang: shall it be "select"?
	}
}

function FindSelect(arr) {
	for (var h = 0; h < arr.length; h++){
		if (continueFlag == true) {
			if (arr[h].constructor == Array) {//if the current item is still an array, go to the next level
				index = index+1;
				arrOfIndices[index] = h;
				FindSelect(arr[h]);
			}
			else if (arr[h].name == ""){//when the loop has reached the end of the right navigation items, get out of the current loop
				break;
			}
			else if ((currentUrl==arr[h].name) || currentUrl.indexOf(arr[h].name.concat("#"))==0 || currentUrl.indexOf(arr[h].name.concat("/index.html#"))==0 || currentUrl.indexOf(arr[h].name.concat("/index.htm#"))==0 || currentUrl.indexOf(arr[h].name.concat("/index.asp#"))==0){//find the index of the current file and exit the whole operation
				//alert (currentUrl)
				//alert (arr[h].name)
				currentItem = arr[h];
				index = index+1;
				continueFlag = false;
				arrOfIndices[index] = h;
				break;
			}
		}
		else {
			return;
		}
	}
	index = index - 1;//if the current file is not an item in this loop, go back to the upper level of loop	
}		

//code here will find the appropriate menu items to be displayed and put them into the arrOfMenu array 
function WriteMenu(arr) {
	var foundFirst = 0, foundSecond = 0, foundThird = 0, foundFourth=0;
	var continueFlag2 = new Boolean(true)
	if (continueFlag2) {
		for (var m = 1; m < arr.length; m++) {
			if (continueFlag2) {
				for (var n = 0; n < arr[m].length; n++) {
					if (continueFlag2) {
						for (var t = 0; t < arr[m][n].length; t++) {
							if (arr[m][n][t].name == "END") {//no more nav items
								document.write("</ul>")	;
							//	alert("</ul> 1")
								continueFlag2 = false;
								break;
							}
					/*		else if ((t == 0) & (arr[m][n][t].name == "")) {
								alert("breaking" );
								alert("m: " + m)
								alert("n: " +  n)
								alert("t: " + t)
								break
							}	*/
							else if ((arr[m][n][t].name == "") & (t > 1) & (index1 == m & index2 == n)) {  //end of a fourth level menu
								if (arr[m][n][t-1].name != "") {
									document.write("</ul>")	;
									//alert("</ul> 2")
									break;
								}
							}
							else if ((arr[m][n][t].name == "") & (t == 0) & (index1 == m) & (n > 1)) {  //end of a third level menu
								if (arr[m][n-1][0].name != "") {
									document.write("</ul>")	
							//		alert("</ul> 3")
									
							//		alert("m: " + m)
							//		alert("n: " +  n)
							//		alert("t: " + t)
									break;
								}
							}
							else if (arr[m][n][t].name == "") {  //an item with no submenus
								break;
							}
							else {
								if ((index1 == m & index2 == n) & (t != 0)) {
									if (foundFourth == 0) {
										document.write("<ul id='subnav'>")	
										//alert("<ul id='subnav'>")
										foundFourth = 1;
									}
									WriteAMenuItem(arr[m][n][t]);
								}
								else if ((index1==m) & (n != 0) & (t == 0)) {
									if (foundThird == 0) {
										document.write("<ul id='subnav'>")	
										//alert("<ul id='subnav'>")
										foundThird = 1;
									}
									WriteAMenuItem(arr[m][n][t]);
								}
								else if (n == 0 & t == 0){
									if (foundSecond == 0) {
										document.write("<ul>")	
										//alert("<ul id='subnav'>")
										foundSecond = 1;
									}
									WriteAMenuItem(arr[m][n][t]);
								}

							}
						}
					}
					else {
						break;
					}
				}
			}
			else {
				break;
			}
		}
	}
}

function WriteAMenuItem(theArray) {
	var url = theArray.name;
	var startLetters=url.substring(0,7);
	//document.write (startLetters + "<br>")
	if (startLetters=="http://") {
		document.write ("<li><a href='" + theArray.name + "'>" + theArray.text + "</a></li>");
	}
	else {
		document.write ("<li><a href='http://www.cogs.indiana.edu/" + theArray.name + "' id='");
		document.write(theArray.id);
		document.write ("'>" + theArray.text + "</a></li>");
		//alert(theArray.text);
	}
}
//this function is only used in a few html pages: animalcog/faculty.html
function openWin(location) {
	newWin=window.open(location, 'win1','scrollbars=no,menubar=no,height=460,width=540,resizable=no,location=no,toolbar=no,status=no'); 
	newWin.focus()
}
function showNewWin(location) {
	newWin=window.open(location, 'win1','scrollbars=no,menubar=no,height=350,width=820,resizable=no,location=no,toolbar=no,status=no'); 
	newWin.focus()
}