/*
	addEvent
		usage: Ability to attach multiple events onto objects
		example: addEvent(window, 'onload', initMenu);
*/
function addEvent(oTarget, sType, fpDest) {
  var oOldEvent = oTarget[sType];
  if (typeof oOldEvent != "function") {
    oTarget[sType] = fpDest;
  } else {
    oTarget[sType] = function(e) {
      oOldEvent(e);
      fpDest(e);
    }
  }
}

function thumbnailSwap(){

	if( !document.getElementById || !document.getElementsByTagName ) return;
	
	var thumbContainer = document.getElementById("thumbContainer");
	var aTags = thumbContainer.getElementsByTagName("A");

	for(var index = 0; index < aTags.length; index++ ){
		var currentATag = aTags[index];
		currentATag.onclick = function(){
			var imgLarge = document.getElementById("imgLarge");
			var imgText = document.getElementById('imgText');
		
			var text = this.nextSibling;
			while( text.nodeName != 'P' ) text = text.nextSibling;
		
			imgText.innerHTML = text.innerHTML;
			imgText.style.visibility = 'visible';
		
		
			imgLarge.src = this.href
			return false;
		}

	}

}

// window.onload = thumbnailSwap;
addEvent(window,'onload',thumbnailSwap);