
/*
 * Contains the number of images for the current application
 */
var appImageNum = 0;

/*
 * Contains the application name
 */
var appName;

/*
 * Contains the application category
 */
var appCategory;

/*
 * Contains the index of the currently shown image
 */
var imageIndex = 0;

/*
 * Sets the application data
 */
function setApplicationData(name, category, imageNum) {
  appImageNum = imageNum;
  appName = name;
  appCategory = category;
}

/*
 * Shows the next image
 */
function showNextImage() {
  imageIndex++;
  if (imageIndex >= appImageNum) {
    // Start again
    imageIndex = 0;
  }
  showImage();
}

/*
 * Shows the previous image
 */
function showPreviousImage() {
  imageIndex--;
  if (imageIndex < 0) {
    // Start again
    imageIndex = appImageNum - 1;
  }
  showImage();
}

/*
 * Shows the image given by the index
 */
function showImage() {
  var imageFilename = "images/" + appCategory + "/" + (imageIndex + 1) + "_" + appName + ".png";
  document.getElementById("screenImage").src = imageFilename;
}


/*
 * Shows/Hides a hidden image
 */
function showHiddenImage(id, show) {
  document.getElementById(id).style.display = show ? "block" : "none";
}

