// Border Highlight / Link Color Changer
// Michael McKennedy
// McKennedy.org 2009
//
// variable maxImgs must be set on each page or IE will return an 'object required error'

function changeBorderColor(whichImg) {
	var i=1; // the first image is always img1
	var image=0; // stores the image ID
	var notActiveLink=0; // stores the value to change link color
	var activeLink=whichImg + 'Link'; // find the active link
	for (i=1;i<=maxImgs;i++) { 
		image='img'+i; // ids of thumbnails use the format img1, img2, etc...
		notActiveLink='img' + i + 'Link'; // ids of links use the format img1Link, img2Link, etc...
		document.getElementById(image).style.borderColor="#4b3b24"; // set all borders back to orginal state
		document.getElementById(whichImg).style.borderColor="#999966"; // display border for selected image
		if (document.getElementById(notActiveLink)) { // do the elements exist?
				document.getElementById(notActiveLink).style.color="#ffffff"; // set all links back to original color
			}
		if (document.getElementById(activeLink)) { // do the elements exist?
				document.getElementById(activeLink).style.color="#999966"; // change the active link color
			}
		
	}
}
