function swapPhotoLinks (swatchName) {
    photoLinks = document.getElementsByClassName('productImageLink');
    for (i = 0; i < photoLinks.length; i++) {
        fileNameBegin = photoLinks[i].href.indexOf("images/");
        fileNameEnd = photoLinks[i].href.indexOf(".jpg") + 4;
        fileName = photoLinks[i].href.substring(fileNameBegin,fileNameEnd);
        fileNameComponents = fileName.split("_");
        photoLinks[i].href = photoLinks[i].href.replace(fileNameComponents[2],swatchName);
        if (i == 0) document.getElementById('productMainImage_IMG').src = fileName.replace(fileNameComponents[2],swatchName);
    }
    
    return;
}