// 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_1.jpg","Images/illus_2.jpg","Images/illus_3.jpg","Images/illus_4.gif","Images/illus_5.gif","Images/illus_6.jpg","Images/illus_7.jpg","Images/illus_8.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 'illustrations':												//ILLUSTRATIONS			switch(index) {				case 1:											//INDEX #1					switch(line) {						case 1:							return 'Original art';	// LINE #1						case 2:							return 'October 2002 cover';	// LINE #2						case 3:							return 'digital media: Painter';	// LINE #3					}											case 2:											//INDEX #2					switch(line) {						case 1:							return 'Original art';	// LINE #1						case 2:							return 'September 2001 cover';	// LINE #2						case 3:							return 'Watercolor painting';	// LINE #3					}													case 3:											//INDEX #3					switch(line) {						case 1:							return 'Personal project';	// LINE #1						case 2:							return 'Watercolor painting';	// LINE #2						case 3:							return '';	// LINE #3					}													case 4:											//INDEX #4					switch(line) {						case 1:							return 'Icon set 1';	// LINE #1						case 2:							return 'for customized professional development portal';	// LINE #2						case 3:							return 'Adobe Illustrator';	// LINE #3					}													case 5:											//INDEX #5					switch(line) {						case 1:							return 'Icon set 2';	// LINE #1						case 2:							return 'for customized professional development portal';	// LINE #2						case 3:							return 'Adobe Illustrator';	// LINE #3					}													case 6:											//INDEX #6					switch(line) {						case 1:							return 'Personal piece';	// LINE #1						case 2:							return 'Watercolor painting';	// LINE #2						case 3:							return '';	// LINE #3					}													case 7:											//INDEX #7					switch(line) {						case 1:							return 'Personal piece';	// LINE #1						case 2:							return 'Watercolor painting';	// LINE #2						case 3:							return '';	// LINE #3					}													case 8:											//INDEX #8					switch(line) {						case 1:							return 'Personal piece';	// LINE #1						case 2:							return 'Watercolor painting';	// LINE #2						case 3:							return '';	// LINE #3					}				case 9:											//INDEX #9					switch(line) {						case 1:							return 'index 9 line 1';	// LINE #1						case 2:							return 'index 9 line 2';	// LINE #2						case 3:							return 'index 9 line 3';	// 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	}}