function swapPhoto(photoSRC,theCaption,theCredit) {
// if document has ID named caption then continue
if (document.getElementById("caption")) {

    // set variable to IMG with id of mainPhoto
	var theImage = document.getElementById("mainPhoto");
	// set variable to P with id of caption
	var displayedCaption = document.getElementById("caption");
	// set variable to P with id of credit
	var displayedCredit = document.getElementById("credit");
	// set variable to path of assets folder
	var imgFolder = "assets/";
	// DOM scripting to set the values of the first child nodes of the referenced HTML elements
	// set P caption to value from javascript call
	displayedCaption.firstChild.nodeValue = theCaption;
	// set P credit to value from javascript call
	displayedCredit.firstChild.nodeValue = theCredit;
	// set src attribute of main photo to assets folder and src value passed from javascript call
	theImage.setAttribute("src", imgFolder+photoSRC);

    }
  }

