// Template: NandoTimes : template/photos/photo_index_js.html var photo = new Array( "blank_for_a_reason", "/world/photos/story/3920323p-13652246c.html", "/world/photos/story/3886814p-13558768c.html", "/world/photos/story/3760972p-13255318c.html", "/world/photos/story/3726633p-13181020c.html", "/world/photos/story/3724536p-13176081c.html", "/world/photos/story/3723341p-13173233c.html", "/world/photos/story/3694842p-13107785c.html", "/world/photos/story/3687478p-13090676c.html", "/world/photos/story/3694844p-13107572c.html", "/world/photos/story/3680397p-13073865c.html", "/world/photos/story/3675511p-13060632c.html", "/world/photos/story/3662237p-13029871c.html", "/world/photos/story/3661278p-13027609c.html", "/world/photos/story/3553224p-12778032c.html", "/world/photos/story/3549344p-12768145c.html" ); var no_of_photos = photo.length - 1; var array_number = photo.length; function set_counter() { var this_url = location.href; for(i=1; i < array_number; i++) { if (this_url.indexOf(photo[i]) >= 0) { counter = i; document.forms[0].current.value = i; } } if (location.href.indexOf('?') >= 0) { speed = location.href.substring(location.href.indexOf('?')+1, location.href.length); document.forms[0].speed.value = speed; if ((speed > 4) && (speed < 61)) { // alert("going to slideshow, speed: " + document.count.speed.value); slideshow(); } } } function autoget(counter) { // alert("auto photo #" + counter + " and url " + photo[counter]); var speed = document.count.speed.value; if ((speed < 5) || (speed > 60)) { // stop slide show counter--; // alert("the slide show has stopped in autoget"); return false; } location = photo[counter] + "?" + speed; } function manualget(pixnum) { // alert("manual photo #" + pixnum + " and url " + photo[pixnum]); location = photo[pixnum]; } function startshow() { var speed = document.count.speed.value; if ((speed < 5) || (speed > 60)) { speed = 10; // set default speed document.count.speed.value = speed; } slideshow(); } function slideshow() { counter = document.count.current.value; counter++; var speed = document.count.speed.value; var timer = speed * 1000; if ((counter <= no_of_photos) && (speed > 4)) { // alert("telling autoget to get photo " + counter); setTimeout("autoget(counter)",timer); } else { // alert("the slide show has stopped in slideshow"); counter--; return false; } return false; } function go(direction, number) { if (direction == "stop") { document.count.speed.value = 1; return false; } else if (direction == "speed") { var speed = document.count.speed.value; // get the current value of speed if (speed < 5) { speed = 10; } // sets a default speed of 10 seconds new_speed = prompt("Enter a speed between 5 and 60 seconds.",speed); if ((new_speed > 60) || (new_speed < 5)) { new_speed = 10; } document.count.speed.value = new_speed; // set the new speed return false; } else if (direction == "go") { if (number <= no_of_photos) { manualget(number); counter = number; } else { alert("I'm sorry, there are only " + no_of_photos + " photos in the gallery.\n\nPlease select another number."); document.count.current.value = number; return false; } } else if ((number == "1") && (direction == "minus")) { number = no_of_photos; // moving from 1 to the last photo backward } else if (direction == "plus") { number++; // adding 1 } else if (direction == "minus") { number--; // subtracting 1 } if ((number > 0) && (number < (no_of_photos+1))) { manualget(number); // a # in the right range gets sent up for a photo change } else { number = 1; manualget(number); // if it's off the map, then go to #1 } document.count.current.value = number; // no matter what, we show the current pix return false; }