// JavaScript Document
function showImage(elem) {
	if(!document.getElementById) {
		return false;
	} else {
		var bigPic = elem.getAttribute('href');
		var newCaption = elem.firstChild.getAttribute('alt');
		var newDescription = elem.firstChild.getAttribute('descMain');//(8) sets the new description from the "descmain" parameter in the thumb
		var newWidth = elem.firstChild.getAttribute('widthMain');
		var newHeight = elem.firstChild.getAttribute('heightMain');
		document.getElementById('mainpic').firstChild.setAttribute('src',bigPic);
		document.getElementById('mainpic').firstChild.setAttribute('alt',newCaption);
		document.getElementById('mainpic').firstChild.setAttribute('title',newCaption);//attempt to make the title / alt correct in the main pic
		//issue was that initial alt in the mainpic was overrriding the alt from here, whereas title takes precedence now and so corrected
		document.getElementById('mainpic').firstChild.setAttribute('width',newWidth);
		document.getElementById('mainpic').firstChild.setAttribute('height',newHeight);
		var theCaption = document.getElementById('picCaption');
		var theDescription = document.getElementById('picDescription');//(18) tells the code the id of the element displaying the description
		theCaption.firstChild.nodeValue = newCaption;
		theDescription.firstChild.nodeValue = newDescription;//(20)this picks up the value of the dscription from (8) above
	}
}