//	This function cancels the link for the thumbnails and instead causes
//	the background image to change based on changing the class of
//	div#content-area.  It also builds a list of those images so that the
//	images swap can be disabled if it is the active element.

//	Array to hold all of the images that are having rollover states
//	assigned to them.
var holdImgObjs = new Array();

function gallerySwapLinks(imgList, removeString) {
	if (document.getElementById) {
		for(var a = 0; a < document.getElementById(imgList).childNodes.length; a++) {
			tempObject = document.getElementById(imgList).childNodes[a];
			
			//	When we hit an <A> tag, assign an onClick event to it.
			if(tempObject.tagName && tempObject.tagName.toUpperCase() == "A") {
				tempObject.onclick = function() {
					
					//	imageNumber is pulled from the <A> tags ID, which takes the form of SECX,
					//	where "SEC" is a three letter sequence to define the type of page -- "det" =
					//	details, "int" = interior -- plus a number from 0 - 3.
					imageNumber = this.id.replace(removeString, "");
					
					//	Swap the background of the content area of assign it to the corresponding
					//	thumbnail that has been clicked.
					document.getElementById('content-area').className = "bkgd" + imageNumber;
					
					//	If we are NOT in IE, which does not support PNGs.  If we are in IE, the images
					//	have been swapped with transparents GIFs and the IMG has a background set to
					//	the PNG.
					if (!browser.isIE) {
						
						//	Replace all of the images with their "off" value.
						for (var c = 0; c < holdImgObjs.length; c++) {
							holdImgObjs[c].src = holdImgObjs[c].src.replace("-on", "-off");
							
							//	Changes its class to add "current" since that overrides the mouseover
							//	event to change its src to "-on".
							holdImgObjs[c].className = holdImgObjs[c].className.replace(" current", "");
						}
						
						//	Then, set the clicked image to "-on"
						holdImgObjs[imageNumber].src = "images/" + removeString + "-" + imageNumber + "-on.png";
						
						//	Set that image's class to "current"
						holdImgObjs[imageNumber].className = holdImgObjs[imageNumber].className + " current";
					}
					return false;
				}
				
				for (var b=0; b < tempObject.childNodes.length; b++) {
					//	Setting this to NOT happen it we are using IE5 or lower since:
					//	* IE5.0 breaks on the .push event for an array
					//	* Will be interpreting the ie-fixes.css file anyway
					if (tempObject.childNodes[b].tagName=="IMG" && (browser.isIE55up || !browser.isIE)) {
						holdImgObjs.push(tempObject.childNodes[b]);
					}
				}
			}
		}
	}
}