function showLeaveComments() {
  document.getElementById('add-comments-body').style.display='block';
  document.getElementById('leave-comments').style.cursor='default';
}



function showNextPic() {
  cur = $("#img" + curPic);
  curPic += 1;
  if (curPic > maxPic) {
    curPic = 1;
  }
  next = $("#img" + curPic);
  adjustPics(cur, next);
}

function showPrevPic() {
  cur = $("#img" + curPic);
  curPic -= 1;
  if (curPic < 1) {
    curPic = maxPic;
  }
  next = $("#img" + curPic);
  adjustPics(cur, next);
}

function showPic(next) {
  cur = $("#img" + curPic);
  curPic = next;
  next = $("#img" + curPic);
  adjustPics(cur, next);
}

function adjustPics(cur, next) {
  cur.fadeOut(150, function() {next.fadeIn(200)});
}

function prevThumbnail() {
}

function nextThumbnail() {
  if (curThumb + numThumb > maxPic) {
    return;
  }
  remove = $("#thumb" + curThumb);
  add = $("#thumb" + (curThumb + numThumb));
  curThumb += 1;
  adjustThumbs(remove, add);
  checkThumbButtons();
}

function prevThumbnail() {
  if (curThumb <= 1) {
    return;
  }
  curThumb -= 1;
  remove = $("#thumb" + (curThumb + numThumb));
  add = $("#thumb" + curThumb);
  adjustThumbs(remove, add);
  checkThumbButtons();
}

function adjustThumbs(remove, add) {
  remove.hide();
  add.fadeIn("fast");
}

function checkThumbButtons() {
  if (curThumb <= 1) {
    $("#prevThumb").addClass("inactive");
  } else {
    $("#prevThumb").removeClass("inactive");
  }
  if (curThumb + numThumb > maxPic) {
    $("#nextThumb").addClass("inactive");
  } else {
    $("#nextThumb").removeClass("inactive");
  }
}
