// Javascript to go with estieg site portfolio. manages changing of main window and descriptive text// when new Image is selected from thumbnail or portfolio is browsed via the arrow images. if (document.images) {		illusText = new Image		designText = new Image		photoText = new Image		resumeText = new Image		contactText = new Image		blankText = new Image		illusText.src = "Images/label_illustration.gif"		designText.src = "Images/label_design.gif"		photoText.src = "Images/label_photo.gif"		resumeText.src = "Images/label_resume.gif"		contactText.src = "Images/label_contact.gif"		blankText.src = "Images/label_blank.gif"	}	var thisPic = 0;				//Keeps track of the currently displayed picture.								//array of all of the main imagesmyPix = new Array("Images/photos/fern.jpg","Images/photos/giantsequoia.jpg","Images/photos/newleaf.jpg","Images/photos/poppies1.jpg","Images/photos/seedpod.jpg","Images/photos/arches.jpg","Images/photos/painted_desert2.jpg","Images/photos/grass.jpg","Images/photos/tree.jpg");	var imgCt = myPix.length-1;		//the total number of images on the page, as determined from the arrayvar page = ""					//set on page loading to allow for generic use on different portfolio pages. function setPage(input) {		//run on load to set the current page being displayed.	page = input;	}			function selectNewText (index, line) {		//nested switch functions to select the page, the index/picture, and the line text for replacing the text to the left of the images.	switch(page) {							//changes the text of one line; called from replaceLine			case 'photo3':												//PHOTO GALLERY 3			switch(index) {				case 1:											//INDEX #1					switch(line) {						case 1:							return 'Fern';	// LINE #1						case 2:							return '35 mm';   // LINE #2					}											case 2:											//INDEX #2					switch(line) {						case 1:							return 'Giant Sequoia - Sequoia National Park';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}													case 3:											//INDEX #3					switch(line) {						case 1:							return 'New Leaf';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}													case 4:											//INDEX #4					switch(line) {						case 1:							return 'Poppies';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}													case 5:											//INDEX #5					switch(line) {						case 1:							return 'Seedpod';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}													case 6:											//INDEX #6					switch(line) {						case 1:							return 'Arches National Park';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}													case 7:											//INDEX #7					switch(line) {						case 1:							return 'Painted Desert';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}													case 8:											//INDEX #8					switch(line) {						case 1:							return 'Grass - Lake Tahoe';	// LINE #1						case 2:							return '35 mm';  // LINE #2				}							case 9:											//INDEX #9					switch(line) {						case 1:							return 'Tree - Huntington Library - Pasadena, CA';	// LINE #1						case 2:							return '35 mm';  // LINE #2					}																												default:					return 'defaulted at index';				}		default:			return 'defaulted at page';		}	}													function replaceLine(n, index, line) {				// THERE WILL BE PROBLEMS IS TEXT IS SEPARATED WITH ANY OTHER TAGS.													//finds the text node and then replaces it with the new text returned from selectNewText	if (n.nodeType == 3 /*Node.TEXT_NODE*/) {		var newNode = document.createTextNode(n);			var parent = n.parentNode;		newNode.data = selectNewText(index, line);	//set the data for the new node to that looked up in selectNewText based on the picture index value and the line value.						parent.replaceChild(newNode, n);			//replace the old node with this new one.	}	else {		var kids = n.childNodes;					//necessary to iterate through to get to the text node.		for (var i = 0; i< kids.length; i++) replaceLine(kids[i], index, line);	}}function replaceText(index) {						//Given the new picture index, calls replaceLine to find new text and replace old text														for (var line = 1; line < 3; line++) replaceLine(document.getElementById('l' + line), index, line);		}function chgImg(imgField,newImg) {	if (document.images) {		document[imgField].src= eval(newImg + ".src")	}}function chgMainImg(imgField,index) {				//changes main image and text when thumbnail is selected	if (document.images) {		thisPic = index - 1;						//updates thisPic value to newly selected picture		document[imgField].src= myPix[thisPic];		//selects new image source from myPix array based on thisPic index		replaceText(index);							//updates text for newly selected pic	}}function chgSlide(direction) {						//iterates through pics in main window strating from currently shown pic	if (document.images) {		thisPic = thisPic + direction				//new pic is either one up or one down in the array		if (thisPic > imgCt) {						//go to beginning if trying to go past the end			thisPic = 0		}		if (thisPic < 0) {							//go to end if trying to go back from the beginning			thisPic = imgCt		}		document.myPicture.src=myPix[thisPic]		//show this new pic in main window		replaceText(thisPic + 1);					//update text to go with this new picture	}}
