
var facts = new Array()

facts.push("Before NASA was formed, the National Advisory Committee for Aeronautics (NACA) was started by President Woodrow Wilson to supervise and \ direct the scientific study of the problems of flight. The NACA determined which problems should be experimentally worked on and discussed their \ solutions and their application to practical questions. The NACA also directed and conducted research and experiments in aeronautics.")

facts.push("Landsat was the series of revolutionary satellites that were first launched in 1972 for the purpose of systematically photographing the \ surface of the Earth from space.")

facts.push("The X-15 aircraft made a total of 199 flights over a period of nearly 10 years from 1959 to 1968. It set unofficial world speed and \
altitude records of 4,520 mph (Mach 6.7) and 354,200 feet. Information gained from the highly successful program contributed to the development of \
the Mercury, Gemini, and Apollo spacecraft and the Space Shuttle program.")

facts.push("NASA became operational on October 1, 1958 -- one year after the Soviets launched Sputnik 1, the world's first artificial satellite.")

facts.push("At any given moment, there are 1,800 thunderstorms happening somewhere on Earth. This amounts to 16 million storms each year! We know the \ cloud conditions that produce lightning, but we cannot forecast the location or time of a lightning strike.")

facts.push("The Mercury, Gemini, and Apollo spacecraft landed in the Atlantic and Pacific Oceans when they returned to Earth.")

facts.push("On October 14, 1947, in the rocket powered Bell X-1, Capt. Charles E. Yeager flew faster than sound for the first time.")

facts.push("The United Nations declared October 4-10, 1999 as World Space Week. These dates commemorate the launch of Sputnik in 1957 \
and the 1967 Outer Space Treaty.")

facts.push("The Altus II unmanned robot plane can circle for up to 24 hours over wildfires, beaming images and data back to computers via satellite. Originally introduced as part of the Environmental Research and Sensor Technology (ERAST) Program, Altus II can map dozens of fires in a day with no risk to a pilot.")

facts.push("In 1803, a man named Luke Howard used Latin words to categorize clouds. Cirrus, which means \"curl of hair,\" is used to describe high, wispy clouds that look like locks of hair.")

facts.push("On January 31, 1958, Explorer 1 became the first artificial satellite launched into space by the United States. Onboard was a cosmic ray detector designed to measure the radiation environment in Earth orbit.")

facts.push("Cumulonimbus clouds, or rain producing clouds, may stretch from their base near the Earth's surface to an altitude of 10 kilometers (33,000 feet) or higher.")

facts.push("NASA's Environmental Research Aircraft and Sensor Technology program (known as \"ERAST\") develops pilotless airplane technology. It also works on making science instruments very small so that they can be carried on remote-controlled aircraft.")

facts.push("On March 16, 1926, Dr. Robert H. Goddard successfully launched the first liquid fueled rocket. The launch took place at Auburn, Massachusetts, and is regarded by flight historians to be as significant as the Wright Brothers flight at Kitty Hawk.")

facts.push("It's pretty windy on Saturn. Winds around the planet's equator can reach 1,800 kilometers \(1,118 miles\) per hour. In comparison, \
the fastest winds on Earth reach only about 400 kilometers (about 250 miles) per hour.")

facts.push("It's a small world. More than 1,000 Earths would fit into Jupiter's vast sphere.")

facts.push("Did you know that the Cassini-Huygens Mission is an international collaboration between three space agencies and 17 nations contributed to building the spacecraft? More than 250 scientists worldwide will study the data collected.")

facts.push("Some days are cold, some days are hot. Wow!")

var rnd = Math.floor(Math.random()*facts.length)

function pickRandomFact(spanId)
{
  if(rnd==facts.length - 1)
    pickRandomFact(spanId)
  document.getElementById(spanId).innerHTML = facts[rnd]

}

function cycleThroughFacts(spanId, direction)
{ 
  var idx = null
  
  if(direction=="F") {
    idx = rnd + 1
    if(idx > facts.length - 1)
      idx = 0
  }
  
  if(direction=="B") {
    idx = rnd - 1
    if(idx < 0)
      idx = facts.length - 1
  }
  
  rnd = idx // the previously defined random index is now the calculated index
  document.getElementById(spanId).innerHTML = facts[idx]

}

function randomHomeImage(bannerId) {
    var dir="images/"
    var images = new Array()
    images.push(dir + "echoBanner1.jpg")
    images.push(dir + "echoBanner3.jpg")
    var rnd = Math.floor(Math.random()*images.length)
    document.getElementById(bannerId).src = images[rnd]
    
}


function initImage(id) {
  image = document.getElementById(id);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(id,0);
}


function setOpacity(obj, opacity) {
	//alert("in setOpacity..."); return;
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  // play with these numbers to adjust the smoothness and speed
  // at whih the images fades
  var opacityFactor = 5 // lower=smoother, higher='choppier'
  var timeoutFactor = 30 // lower=faster, higher=slower
  
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += opacityFactor;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", timeoutFactor);
    }
  }
}


function goToContent()
{
	point = window.location.href.lastIndexOf("=");
	
	if(point > 0)
	{
		gotoElem = window.location.href.substring(point+1, window.location.href.length);
		
		if(gotoElem)
		{
			linkDivElem = document.getElementById(gotoElem).parentNode.parentNode.parentNode.id;
			menuDivElem = document.getElementById(gotoElem).parentNode.parentNode.parentNode.parentNode.id;
			
			openMenu(linkDivElem,menuDivElem);
			selectThis(document.getElementById(gotoElem));
			document.getElementById('mainframe').src = document.getElementById(gotoElem).href;
		}
	}
}





