function showSlide() {
if(!slideShowSlides) {throw "Slide show slides not loaded!";}
var maxSize = 580;
var previous = slideShowIndex - 1 < 0 ? slideShowSlides.length - 1 : slideShowIndex - 1;
var next = slideShowIndex + 1 == slideShowSlides.length ? 0 : slideShowIndex + 1;
var currentUrl = "/slideshow/" + slideShowSlides[slideShowIndex][0];
var nextUrl = "/slideshow/" + slideShowSlides[next][0];
var previousUrl = "/slideshow/" + slideShowSlides[previous][0];
var title = slideShowSlides[slideShowIndex][1];
var description = slideShowSlides[slideShowIndex][2];
var width = slideShowSlides[slideShowIndex][3];
var height = slideShowSlides[slideShowIndex][4];
var wide = height < width;
var smallSideSize = wide ? height * (maxSize / width) : width * (maxSize / height);
var padding = (maxSize - smallSideSize) / 2;
$("#slideTitleDiv")[0].innerHTML = title;
$("#slideDiv")[0].innerHTML = "

";
$("#slideDescriptionDiv")[0].innerHTML = description;
}
$('#previousButton').click(function() {
slideShowIndex--;
if(slideShowIndex == -1) {
slideShowIndex = slideShowSlides.length - 1;
}
showSlide();
});
$('#nextButton').click(function() {
slideShowIndex++;
if(slideShowIndex == slideShowSlides.length) {
slideShowIndex = 0;
}
showSlide();
});
$.getJSON('/SlideShowViewController.java?Request=List', null, function(data, textStatus, httpRequest) {
if(httpRequest.readyState == 4) {
if((httpRequest.status == 200) || (httpRequest.status == 0)) {
slideShowSlides = data.slides;
showSlide();
}
}
});