   var globalImageSide = 1;
   var globalImageId = 1;

   function chg(imageId) {
    globalImageId = imageId;
    globalImageSide = 1;
    switchImage(globalImageId,globalImageSide);
   }

   function bck() {
    if (globalImageSide == 1) {
     globalImageSide = 2;
    } else {
     globalImageSide--;
    }
    switchImage(globalImageId,globalImageSide);
   }

   function nxt(imageId) {
    if (globalImageSide == 2) {
     globalImageSide = 1;
    } else {
     globalImageSide++;
    }
    switchImage(globalImageId,globalImageSide);
   }

   function switchImage(imageId,imageSide) {
    var s = "./images/l/";
    if (imageSide == 1) {
     s += "front-0000";
    } else if (imageSide == 2) {
     s += "back-00000";
    }
    s += imageId + ".jpg";
    document.getElementById('mainImage').src = s;
   }


   // Total number of images
   var imageCount = 4;

   // Index of the image we are on
   var imageIndex = 1;
   
   function slowlyRotate() {
    var s = "./images/l/";
    if (imageIndex == imageCount) {
     imageIndex = 1;
    }
    s += "front-0000" + imageIndex + ".jpg";
    document.getElementById('mainImage').src = s;
    imageIndex++;
    setTimeout("slowlyRotate()",7500);
   }
