// Template: NandoTimes : template/photos/photo_index_js.html var photo = new Array( "blank_for_a_reason", "/politics/photos/story/3924391p-13662180c.html", "/politics/photos/story/3924385p-13662188c.html", "/politics/photos/story/3924386p-13661418c.html", "/politics/photos/story/3924381p-13661596c.html", "/politics/photos/story/3860859p-13487469c.html", "/politics/photos/story/3836353p-13434097c.html", "/politics/photos/story/3809622p-13375061c.html", "/politics/photos/story/3809592p-13374867c.html", "/politics/photos/story/3802250p-13356095c.html", "/politics/photos/story/3801647p-13354982c.html", "/politics/photos/story/3801648p-13354972c.html", "/politics/photos/story/3801353p-13354121c.html", "/politics/photos/story/3801354p-13354117c.html", "/politics/photos/story/3799797p-13349779c.html", "/politics/photos/story/3799798p-13349775c.html", "/politics/photos/story/3780642p-13300693c.html", "/politics/photos/story/3780162p-13299662c.html", "/politics/photos/story/3779110p-13296965c.html", "/politics/photos/story/3774761p-13287725c.html", "/politics/photos/story/3731406p-13192772c.html", "/politics/photos/story/3678074p-13068251c.html", "/politics/photos/story/3666220p-13039746c.html", "/politics/photos/story/3665520p-13038165c.html", "/politics/photos/story/3636992p-12967246c.html", "/politics/photos/story/3617000p-12917242c.html", "/politics/photos/story/3559879p-12792027c.html", "/politics/photos/story/3553990p-12779435c.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; }