//To add a section//  Fill in hidden fields on page//  Add name to chapter//  Add URL to chapter urls// include link from contents page// indicate available modesvar chapterNames = new Array("Home", "1. Language", "2. Attention and Perception", "3. Thinking", "4. Autism")//section namesvar h = new Array("Title", "Contents")var ch1 = new Array("Introduction", "Speech Perception", "Word Comprehension", "Sentence Comprehension (I)", "Sentence Comprehension (II)", "Word Production (I)", "Word Production (II)", "Sentence Production", "References", "Multimedia")var ch2 = new Array("Visual System","Shape Constancy", "Attention", "Attention Deficit Disorder", "References", "Multimedia")var ch3 = new Array("Thinking", "References")var ch4 = new Array("Introduction", "Theory of Autism", "References")var sectionNames = new Array(h,ch1,ch2,ch3,ch4)//URL's for each sectionvar homeUrl = new Array("title","contents","instructions")var ch1Urls = new Array("langIntro/MLintro","sPerception/sPerception", "wordComp/wordComprehension", "sentComp/comprehension1", "sentComp/comprehension2", "wordProd1/wordProduction", "wordProd2/PDP", "sentProd/sentProduction", "references/references", "sum_lang")var ch2Urls = new Array("visual_system/v_system","shapeConstancy/shapeConstancy", "attention/attention", "ADHD/adhd", "references/references", "sum_attn")var ch3Urls = new Array("section1/thinking", "references/references")var ch4Urls = new Array("autismIntro", "autismTheory", "references/references")var sectionUrls = new Array(homeUrl,ch1Urls,ch2Urls,ch3Urls,ch4Urls)//directory of each chaptervar dir = new Array("home", "language", "attention", "thinking", "autism")var chapterIndex=0var sectionIndex=0function changeChapter(chapterID){    v = getSectionUrl(chapterID,0)    parent.mainFrame.location = v      chapterIndex = document.forms[0].chapter.selectedIndex    upDateSections(chapterIndex,sectionNames[chapterIndex][0])    document.forms[0].section.selectedIndex = 0}function changeSection() {   	sectionIndex = document.forms[0].section.selectedIndex   	chapterIndex = document.forms[0].chapter.selectedIndex   	parent.mainFrame.location = getSectionUrl(chapterIndex,sectionIndex)	}function getSectionUrl(theChapter, theSection) {//   x = "langChapter" + (theChapter) + "/" + sectionUrls[theChapter][theSection] + ".html"	x = dir[theChapter] + "/" + sectionUrls[theChapter][theSection] + ".html"    return x}function goNext() {	if (document.forms[0].section.length == document.forms[0].section.selectedIndex +1) {			if (document.forms[0].chapter.length != document.forms[0].chapter.selectedIndex +1){			document.forms[0].chapter.selectedIndex++		    changeChapter(document.forms[0].chapter.selectedIndex)		}   	}   	else {      	document.forms[0].section.selectedIndex++		changeSection()	}}function goPrev() {	if (document.forms[0].section.selectedIndex != 0) {		document.forms[0].section.selectedIndex--		changeSection()   	}	else if (document.forms[0].chapter.selectedIndex != 0) {		document.forms[0].chapter.selectedIndex--		var L = sectionNames[document.forms[0].chapter.selectedIndex].length		v = getSectionUrl(document.forms[0].chapter.selectedIndex,L-1)		parent.mainFrame.location = v		chapterIndex = document.forms[0].chapter.selectedIndex		upDateSections(chapterIndex,sectionNames[chapterIndex][L-1])        document.forms[0].section.selectedIndex = L-1	}}function upDateSections(chapterIndex,theSection) {	var sectionIndex=0    document.forms[0].chapter.selectedIndex=chapterIndex		var sl = document.forms[0].section.options.length;   	var theseSections = sectionNames[chapterIndex]   	for (i=0; i<theseSections.length; i++)			if (i+1 > sl)			document.forms[0].section.options[i] =	new Option(i+1 + ". " + theseSections[i], "i")		else 			document.forms[0].section.options[i].text = i+1 + ". " +theseSections[i]		   	if (sl > theseSections.length) 		for (i = sl-1; i>= theseSections.length;i--)			document.forms[0].section.options[i] = null}function loaded () {   	if (parent.ready) {//   	  	alert("chapter="+document.forms[0].chapter.value+", section="+document.forms[0].section.value)      	setNav(document.forms[0].chapter.value, document.forms[0].section.value)	}	if(parent.name != "MMTBN") this.location= "http://psych.rice.edu/mmtbn/"}function setNav(chapter,theSection) {  	if(parent.ready) {       var chapterIndex = 0;       var sectionIndex = 0;  	   for (i=0; i<parent.frames[0].chapterNames.length; i++)		    if(chapter == parent.frames[0].chapterNames[i]) {		       	chapterIndex = i;		        break;	        } 		parent.frames[0].upDateSections(chapterIndex,theSection)	 		for (i=0;i<parent.frames[0].chapterNames[chapterIndex].length;i++)		    		if(theSection == parent.frames[0].sectionNames[chapterIndex][i]) {		        sectionIndex = i;       			break;		    } 				parent.frames[0].window.document.forms[0].chapter.selectedIndex=chapterIndex		parent.frames[0].window.document.forms[0].section.selectedIndex=sectionIndex   }   else {			    window.location = "../home/" + parent.frames[0].homeUrl[0]+".html"   }}function newWindow3(url, w, h, top, left) {	var x = "window.open(url,\"\",\"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + w + ",height=" + h +",top=" + top + ",left=" + left +  "\")"	eval(x)}function showMovie(movieTitle) {	var movieURL	if(parent.conn == 1)		movieURL = movieTitle + "_h.html"	else if(parent.conn == 2)		movieURL = movieTitle + "_l.html"	else //parent.conn == 3		movieURL = movieTitle + "_s.html"//	alert(movieURL)	newWindow3(movieURL, 600, 420, 50, 50)}function playSound(sound) {	//sound implemented as html with embedded .mov 	newWindow3(sound, 500, 400, 100, 100)}