/* Slide show script for Night Safari images. 
(c) Design For Life Consultancy Pte Ltd, 2008 */

var number = 10;

function nextImage(direction)
{
if (direction) {number = ++number;}
else number = --number;
if (number<10) {number=26;}
if (number>26) {number=10;}
var sp1 = document.createElement("div");
sp1.setAttribute("id", "org_div");
var altText = "Night Safari image "+number;
switch(number-9) 
{
case 1:
altText="The Leopard Trail, Night Safari, Singapore";
break;

case 2:
altText="Indian gharial";
break;

case 3:
altText="Indian gharial";
break;

case 4:
altText="Indian gharial";
break;

case 5:
altText="Hog deer";
break;

case 6:
altText="Indian Rhino";
break;

case 7:
altText="Indian Rhino";
break;

case 8:
altText="Indian Rhino";
break;

case 9:
altText="Indian wolf";
break;

case 10:
altText="Leopard";
break;

case 11:
altText="Leopard";
break;

case 12:
altText="Leopard";
break;

case 13:
altText="Leopard Cat";
break;

case 14:
altText="Indian lion";
break;

case 15:
altText="Red panda";
break;

case 16:
altText="Striped hyaena";
break;

case 17:
altText="Giant flying squirrels";
break;

default:
altText="";
break;
}
var imageSrc="nightsafari/ns-0"+number+".jpg";
var newImage = document.createElement("img");
newImage.setAttribute('src', imageSrc);
newImage.setAttribute('alt', altText);
newImage.style.width = "90%";
newImage.style.height = "90%";
sp1.appendChild(newImage);
  // add the newly created element and it's content into the DOM
var sp2 = document.getElementById("org_div");
var parentdiv = sp2.parentNode;
parentdiv.replaceChild(sp1, sp2);

var caption = document.getElementById('cap'); 
   // Delete the current content if there is any
   while (caption.firstChild) {
     caption.removeChild(caption.firstChild);
   } 
var content;
var n = 1;
switch(n=number-9) 
{
case 1:
content=("1. On the \'Leopard Trail\', Night Safari, Singapore<br /><br />");
break;
case 2:
content=("2. Indian gharial, <em>Gavialis gangeticus</em>, on the \'Fishing Cat Trail\' (viewed from boardwalk), Night Safari, Singapore");
break;

case 3:
content=("3. Indian gharial, <em>Gavialis gangeticus</em>, on the \'Fishing Cat Trail\' (viewed through glass), Night Safari, Singapore");
break;

case 4:
content=("4. Indian gharial, <em>Gavialis gangeticus</em>, on the \'Fishing Cat Trail\' (viewed through glass), Night Safari, Singapore");
break;

case 5:
content=("5. Hog deer, <em>Axis porcinus</em>, on the \'Fishing Cat Trail\', Night Safari, Singapore");
break;

case 6:
content=("6. Indian Rhino, <em>Rhinoceros unicornis</em>, in the \'Nepalese River Valley\', Night Safari, Singapore");
break;

case 7:
content=("7. Indian Rhino, <em>Rhinoceros unicornis</em>, in the \'Nepalese River Valley\', Night Safari, Singapore");
break;

case 8:
content=("8. Indian Rhino, <em>Rhinoceros unicornis</em>, in the \'Nepalese River Valley\', Night Safari, Singapore");
break;

case 9:
content=("9. Indian wolf, <em>Canis lupus pallipes</em>, in the \'Nepalese River Valley\', Night Safari, Singapore");
break;

case 10:
content=("10. Leopard, <em>Panthera pardus</em>, on the \'Leopard Trail\', Night Safari, Singapore");
break;

case 11:
content=("11. Leopard, <em>Panthera pardus</em>, on the \'Leopard Trail\', Night Safari, Singapore");
break;

case 12:
content=("12. Leopard paw (seen through glass).&nbsp; \'Leopard Trail\', Night Safari, Singapore");
break;

case 13:
content=("13. Leopard cat, <em>Felis bengalensis</em>, on the \'Fishing Cat Trail\', Night Safari, Singapore");
break;

case 14:
content=("14. Indian lion, <em>Panthera leo persica</em>, in the \'Gir Forest\', Night Safari, Singapore");
break;

case 15:
content=("15. Red panda, <em>Ailurus fulgens</em>, on the \'Fishing Cat Trail\', Night Safari, Singapore");
break;

case 16:
content=("16. Striped hyaena, <em>Hyaena hyaena</em>, on the \'Fishing Cat Trail\', Night Safari, Singapore");
break;

case 17:
content=("17. Giant flying squirrels in a walk-through flight cage on the \'Leopard Trail\', Night Safari, Singapore");
break; 

default:
content=("");
break;
}
caption.style.width = "90%";

caption.innerHTML = content  //write content to layer
}
