// display the right side splash page image
var imageCount = 0;var splashImages = new Array();var displayImage = 0;

// constructor for the image object
function SplashImage(title,caption,credit,imagename) {
  this.title = title;this.caption = caption;this.credit = credit;this.imagePath = imagename;
}

splashImages[imageCount++] = new SplashImage( "The Eagle Nebula",
                        "The Hubble Space Telescope took this amazing image of dust pillars<br>in the Eagle Nebula",
                        "Hubble Space Telescope",
                        "eagle.jpg");
splashImages[imageCount++] = new SplashImage( "Earthrise",
                        "The crew of Apollo 8 sent back this awe-inspiring image of Earth rising over the horizon of the Moon in December 1968",
                        "NASA",
                        "earthrise.jpg");
splashImages[imageCount++] = new SplashImage( "Buzz Aldrin on the Moon",
                        "Neil Armstrong took this famous picture of fellow astronaut Buzz Aldrin soon after they landed on the Moon in July 1969",
                        "NASA",
                        "buzzaldrin.jpg");
splashImages[imageCount++] = new SplashImage( "The Triffid Nebula",
                        "The Triffid Nebula got its name because it resembles a fungus found here on Earth",
                        "Hubble Space Telescope",
                        "triffid.jpg");
splashImages[imageCount++] = new SplashImage( "The Crab Nebula",
                        "The Crab Nebula is the remnant<br>of a star that exploded<br>almost a thousand years ago.<br>The explosion was so bright that it could be seen in broad daylight<br>from here on Earth",
                        "Hubble Space Telescope",
                        "crab.jpg");
splashImages[imageCount++] = new SplashImage("Spacewalk",
                        "The dream of every astronaut<br> is to walk in space.<br> Bruce McCandless took this spacewalk<br>during shuttle mission STS-41B",
                        "NASA",
                        "spacewalk.jpg");

// get the current time and figure out which image to display
now = new Date();secs = now.getTime();secs /= 10000;secs = parseInt(secs);displayImage = secs % splashImages.length;

// make up the text for the initial splash div content
var splashText = splashImages[displayImage].title + '<br>';
splashText += '<img src="' + "/afk/images/mainsplash/" + splashImages[displayImage].imagePath + '"';
splashText += ' width="240" height="180" border="0" alt="' + splashImages[displayImage].title + '"><br>';
splashText += splashImages[displayImage].caption + '<br>';
splashText += 'Image Courtesy of:<br>' + splashImages[displayImage].credit + '<br>';

var splashTimer = null;var hsDiv = null;

function splashStart()
{
  hsDiv = document.getElementById('homeSplash');setSplashTimer();loadImages();
}

function setSplashTimer()
{
  splashTimer = setInterval("changeSplash()", 15000);
}

function changeSplash()
{
  //alert(hsDiv);
  displayImage++;displayImage = displayImage >= imageCount ? 0 : displayImage;
  var imageText = splashImages[displayImage].title + '<br>';
  //alert(imageText);
  imageText += '<img src="' + "/afk/images/mainsplash/" + splashImages[displayImage].imagePath + '"';
  imageText += ' width="240" height="180" border="0" alt="' + splashImages[displayImage].title + '"><br>';
  imageText += splashImages[displayImage].caption + '<br>';
  imageText += 'Image Courtesy of:<br>' + splashImages[displayImage].credit + '<br>';
  //alert(imageText);
  hsDiv.innerHTML = imageText;
}


