/**
 ** swapImg() -- swaps two images
 ** Params:
 **   ToImg - pass in the name of the target image
 **  FromImg - pass in the name of the original image
 **/

var currentPic = null;    // used to set active & non-active className
var currentPicUrl = "../images/gallery/galleryPhotos/lg_pic_1.jpg"; //used to set path to 1st pic on page load for greybox effects

function swapimg(ToImg, FromImg)
{
   // On page load currentPic global variable will be null.  Set currentPic global variable to img name that was just clicked
  if (currentPic == null)
  {
    currentPic = document.images[FromImg].name;
  }
  
  // Change last clicked img to non active & img that was just clicked to active
  document.images[currentPic].className = ("NonActivePic");
  document.images[FromImg].className = ("ActivePic");
  
 
  // Gets img path of img that was just clicked & change from small to med pic then display med pic
	var sFromImgSrc = document.images[FromImg].src;
	var sNewImageUrl = sFromImgSrc.replace("sm_pic","med_pic");
	document.images[ToImg].src=sNewImageUrl;
	
	
	// reset currentPic global variable to the name of the image that was just clicked
	currentPic = document.images[FromImg].name;
	
	// change global variable currentPicUrl to new large img for greybox script
	currentPicUrl = document.images[FromImg].src.replace("sm_pic","lg_pic");
	
}
