// 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/illus/elephant.jpg","Images/illus/giraffe.gif","Images/illus/butterflies.gif","Images/illus/bird_paradise.jpg","Images/illus/dragonflies.gif");	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 'illustrations2':												//ILLUSTRATIONS 2			switch(index) {				case 1:											//INDEX #1					switch(line) {						case 1:							return 'Card Design, Banyan Grove';	// LINE #1						case 2:							return 'Elephant card';	// LINE #2						case 3:							return 'digital media: Illustrator';	// LINE #3					}											case 2:											//INDEX #2					switch(line) {						case 1:							return 'Card Design, Banyan Grove';	// LINE #1						case 2:							return 'Giraffe card';	// LINE #2						case 3:							return 'digital media: Illustrator';	// LINE #3					}													case 3:											//INDEX #3					switch(line) {						case 1:							return 'Card Design, Banyan Grove';	// LINE #1						case 2:							return 'Butterfly card';	// LINE #2						case 3:							return 'digital media: Illustrator';	// LINE #3					}									case 4:											//INDEX #4					switch(line) {						case 1:							return 'Card Design, Banyan Grove';	// LINE #1						case 2:							return 'Bird of Paradise card';	// LINE #2						case 3:							return 'digital media: Illustrator';	// LINE #3					}									case 5:											//INDEX #5					switch(line) {						case 1:							return 'Card Design, Banyan Grove';	// LINE #1						case 2:							return 'Dragonfly card';	// LINE #2						case 3:							return 'digital media: Illustrator';	// LINE #3					}													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													//currently hardcoded for 3 lines of text.	for (var line = 1; line < 4; line++) replaceLine(document.getElementById('l' + line), index, line);		}function chgImg(imgField,newImg) {					//rollovers for menu items at top of page	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 starting 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	}}
