// Global constants var replacementChar = /%s/ var timeoutID var playing // Global variables var outputTitle var outputSubTitle var outputURL var imagesOnAPage var index function parseCommandLine() { if (location.href.indexOf("?") == -1) { return 0 } // Parse any command line arguments urlQuery = location.href.split("?") urlTerms = urlQuery[1].split(",") if (urlTerms[0] != null) { index = parseInt(urlTerms[0]) } if (urlTerms[1] != null) { playing = parseInt(urlTerms[1]) } } function printBodyStartTag() { document.write("") document.write("") } function stopStartSlideShow(firstTime) { if (playing == 1) { playing = 0 clearTimeout(timeoutID) if (firstTime != 1) { index = -1 slideShow() } } else { playing = 1 timeoutID = setInterval("slideShow()", 3000) } } function slideShow() { index = index + 1 if (index >= imageDB.length) { index = 0 } // Change the image window.location.href = "page.htm?" + index + "," + playing // Change the play text to stop slideShowControl.innerText="Stop"; } function init() { // Make output strings from theme.js and data.js outputTitle = themeTitle.replace(replacementChar, title); outputSubTitle = themeSubTitle.replace(replacementChar, subTitle); outputURL = themeURL.replace(replacementChar, URL); outputURL = outputURL.replace(replacementChar, URL); // Perform some initial calculations imagesOnAPage = rows*columns playing = 0 index = 0 parseCommandLine() // Start or stop the slideshow if (playing == 0) { playing = 1 } else { playing = 0 } stopStartSlideShow(1) } function printTitle(writePageTitle) { if ((rows == 1 || columns == 1) && writePageTitle == 0) { return } document.write("
") document.write("") document.write(outputTitle) document.write("") document.write("
") } function printSubTitle(writePageSubTitle) { if ((rows == 1 || columns == 1) && writePageSubTitle == 0) { return } document.write("
") document.write("") document.write(outputSubTitle) document.write("") document.write("
") } function printImage() { document.write("
") document.write("") document.write("") document.write("") document.write("") for (var i = index*6; i < index*6+6; i++) { document.write("") document.write("") document.write("") } document.write("") document.write("
") document.write("
") outputImageLink = themeImageLink.replace(replacementChar, index); outputImageLink = outputImageLink.replace(replacementChar, playing); document.write(outputImageLink) document.write("
" + imageMetadataDB[i] + "
"); document.write("
") } function writeLinks(writePageLinks) { if ((rows == 1 || columns == 1) && writeLinks == 1) { return } var themePreviousHolder = themeImageLinkPrevious var themeNextHolder = themeImageLinkNext var themePlayHolder = themeImageLinkPlay var themeStopHolder = themeImageLinkStop if (writePageLinks == 1) { themePreviousHolder = themeThumbLinkPrevious themeNextHolder = themeThumbLinkNext themePlayHolder = themeThumbLinkPlay themeStopHolder = themeThumbLinkStop } document.write("") } function printTable() { document.write("
") document.write("") counter = index for (var i = 0; i < rows; i++) { document.write("") for (var j = 0; j < columns; j++) { if (counter < thumbDB.length) { document.write("") } counter++ } document.write("") } document.write("
") document.write("") document.write("") document.write("") document.write("") // Write out the metadata for (var k = counter*6; k < counter*6+6; k++) { document.write("") document.write("") document.write("") } document.write("") document.write("
") document.write("
") outputThumbLink = themeThumbLink.replace(replacementChar, counter) outputThumbLink = outputThumbLink.replace(replacementChar, playing) document.write(outputThumbLink) document.write("
" + thumbMetadataDB[k] + "
"); document.write("
") document.write("
") } function loadImages() { for (var i = 0; i < imagesOnAPage; i++) { if ((i+index) < thumbDB.length) { var j = 0 while (document.images[j] != null && document.images[j].name == "IGNORE") { j++ } if (document.images[i+j] != null) { document.images[i+j].src = thumbDB[i+index] } } } } function loadImage() { var i = 0 while (document.images[i].name == "IGNORE") { i++ } document.images[i].src = imageDB[index] }