////////////////////////// EXPLORE SIDEBAR BANNER ROTATOR ///////////////////////////////////////////////////

var myNumbers = [];
function randomLink(){
  // ADD YOUR IMAGES/LINKS BELOW //;
  var theLinks = [
  [ 'http://www.jpl.nasa.gov/images/explorebanner10.jpg' , 'http://www.jpl.nasa.gov/multimedia/index.cfm?MMCategory=Video', 'HD video' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner1.jpg' , 'http://planetquest.jpl.nasa.gov/', 'PlanetQuest' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner2.jpg' , 'http://marsprogram.jpl.nasa.gov/', 'Mars Exploration' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner3.jpg' , 'http://climate.jpl.nasa.gov/', 'Global Climate Change' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner4.jpg' , 'http://saturn.jpl.nasa.gov/home/index.cfm', 'Cassini to Saturn' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner5.jpg' , 'http://blogs.jpl.nasa.gov/', 'JPL Blog' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner6.jpg' , 'http://sse.jpl.nasa.gov/index.cfm', 'Solar System Exploration' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner7.jpg' , 'http://www.spitzer.caltech.edu/', 'Spitzer Space Telescope' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner8.jpg' , 'http://www.jpl.nasa.gov/gallery/', 'JPL Space Gallery' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner9.jpg' , 'http://virtualfieldtrip.jpl.nasa.gov/smmk/top', 'Virtual Field Trip' ],
  [ 'http://www.jpl.nasa.gov/images/explorebanner12.jpg' , 'http://marsprogram.jpl.nasa.gov/msl/', 'Mars Science Laboratory - The next mission to Mars' ],  [ 'http://www.jpl.nasa.gov/images/explorebanners_asteroids.jpg' , 'http://www.jpl.nasa.gov/asteroidwatch/', 'Asteroid Watch - Keeping track of near earth objects' ]
  ];

  var theNumber = Math.round(Math.random()*(theLinks.length-1));
  if (myNumbers.length < theLinks.length)
  {
      for(var count=0; count<myNumbers.length; count++)
      {
          while(theNumber == myNumbers[count])
          {
              theNumber = Math.round(Math.random()*(theLinks.length-1));
              count = 0;
          }
      }
            myNumbers.push(theNumber);
  } else {
      theNumber = 0
  };
  var anchor = '<a href="'+theLinks[theNumber][1]+'">';
  anchor += '<img src="'+theLinks[theNumber][0]+'" alt="'+theLinks[theNumber][2]+'" /></a>';
  document.writeln(anchor);
}

/////////////////////////// END EXPLORER SIDEBAR BANNER ROTATOR /////////////////////////////////////////////


/////////////////////////// FACTOID SIDEBAR SLIDESHOW ///////////////////////////////////////////////////////

var ImageLoad =[
['<h4>Most Distant Traveler</h4>', '', '../factoid/factoid1.jpg', '<p>Voyager 1, launched in 1977, is farther from Earth than any other human-made object.</p>', 'artist concept of Voyager', ],        //  ['URL to linked page', 'URL to image', 'Caption under picture']    //
['<h4>First Close Encounter</h4>', '', '../factoid/factoid2.jpg', '<p>In 1962, Mariner 2 became the first spacecraft to fly past another planet, studying Venus&#146; atmosphere and surface.</p>', 'artist concept of Mariner 2' ],        //  The caption is not required and may be left blank like this:        //
['<h4>Underground Ocean</h4>', '', '../factoid/factoid3.jpg', '<p>During its eight-year odyssey at Jupiter, Galileo established that the moon Europa probably has a subsurface ocean.</p>', 'Europa', ],        //  ['URL to linked page', 'URL to image', '']                            //
['<h4>Ring Around the Planet</h4>', '', '../factoid/factoid4.jpg',    '<p>Cassini&#146;s tour of Saturn and its moons has revealed the veiled surface of Titan and shown the potential habitability of Enceladus.</p>', 'Titan' ],        //  Add as many images as you like seperated by commmas   //
['<h4>Hubble&#146;s Eyes</h4>', '', '../factoid/factoid5.jpg', '<p>For many years, JPL&#146;s Wide Field and Planetary Camera 2 was the Hubble Space Telescope&#146;s main camera, recording scores of memorable images of the universe.</p>', 'Eagle Nebula' ],        //  Almost ALL errors are caused by the url or path being wrong   //
['<h4>First U.S. Satellite</h4>', '', '../factoid/factoid6.jpg', '<p>Launched in 1958, JPL&#146;s Explorer 1 was the first U.S. satellite.</p>', 'launch of Explorer 1' ],
['<h4>Ocean Observer</h4>', '',  '../factoid/factoid7.jpg', '<p>In 1997, Topex/Poseidon tracked the largest El Nino in a century, an event that changed weather patterns around the world.</p>', 'ocean data showing El Nino' ],
['<h4>Rovers on Mars</h4>', '',  '../factoid/factoid8.jpg', '<p>The Mars rovers Spirit and Opportunity have found evidence that, long ago, water was plentiful on the planet and conditions may have been suitable for life.</p>', 'Opportunity on Mars' ]        //  The LAST image declaration does NOT have a comma after it   //
];

var ImageCount        = 8;            //  *****  Change this to the total number of images loaded above  *****         //   
var ImageDelay        = 8000;            //  *****  Set this to the delay interval desired.  5000 = 5 seconds.           //
var LinkTarget        = "_self"        //  *****  Defines where you want linked page to open. _self, _blank, _top, etc    //
var ImageIndex        = 0;            //  DO NOT ALTER    //
var FirstLoad         = 0;            //  DO NOT ALTER    //
var QuickStartID      = 0;              //  DO NOT ALTER    //
var htmlString        = ""            //  DO NOT ALTER     //

if (document.images)
{
    preload_image_object = new Array();
    var i = 0;
    for(i=0; i<ImageLoad.length; i++) 
    {
        preload_image_object[i] = new Image(25,25);
        preload_image_object[i].src = ImageLoad[i][2];
  
    }
}


//  This function rotates the banner  //
function ImageChange()
{
    ImageIndex = Math.round(Math.random()*(ImageLoad.length-1));

    htmlString = '<left>';
    htmlString = htmlString + '<font face = "Verdana" size="3">';
    htmlString = htmlString + ImageLoad[ImageIndex][0];
    htmlString = htmlString + '</font><br />';
    htmlString = htmlString + '<font face = "Verdana" size="2">';
    if (ImageLoad[ImageIndex][1].length)
    {
        htmlString = htmlString +'<a target="';
        htmlString = htmlString + LinkTarget;
        htmlString = htmlString + '" href="';
        htmlString = htmlString + ImageLoad[ImageIndex][1];
        htmlString = htmlString + '">';
    }
    htmlString = htmlString + '<img border="0" src="';                //  Image border size may be changed here                //   
    htmlString = htmlString + ImageLoad[ImageIndex][2];
    htmlString = htmlString + '" alt="';
    htmlString = htmlString + ImageLoad[ImageIndex][4];
    htmlString = htmlString + '">';
    if (ImageLoad[ImageIndex][1].length)
    {
        htmlString = htmlString + '</a>';
    }
    htmlString = htmlString + '<br />';
    htmlString = htmlString + ImageLoad[ImageIndex][3];
    htmlString = htmlString + '</font>';
    htmlString = htmlString + '</center>';       
    
    document.getElementById('FactoidImage').innerHTML = htmlString;                
    
    if(FirstLoad == 0)                        //  Determines if this is the first time function has run.   //
    {
        SlowFinish();
    }
}
//  End Funtion  //

//  This function ensures first banner is displayted without a delay  //
function QuickStart()
{
  QuickStartID=setInterval("ImageChange()", 1000);
}
//  End Funtion  //                                                                       
//  This function sets display rate to user defined speed  //
function SlowFinish()
{
  clearInterval(QuickStartID);
  FirstLoad = 1;
  setInterval("ImageChange()", ImageDelay);   }
//  End Funtion  //

QuickStart()