img=1;
imagSet = 7;

picCaption1 = new Array("This model of a blended wing body aircraft is being prepared for a wind tunnel test. Credit: NASA",
	 "About 900 people live on Nukuoro Atoll, a ring-shaped island located just north of the equator in the western Pacific Ocean. Credit: NASA",
	 "The Lunar Reconnaissance Orbiter will launch by late 2008 and will orbit the moon for at least one year to collect data to support returning people to the moon. Credit: NASA",
     "The Space Shuttle Discovery poses for inspection photos before docking with the space station. Credit: NASA",
	  "A total of 126 images taken by the Cassini spacecraft were combined to create this close-up image of Saturn and its rings. Credit: NASA");
picCaption2 = new Array("NASA's F-15 ACTIVE jet can fly up to two times the speed of sound. Credit: NASA",
      "A satellite image shows a tropical storm that formed in the western Pacific Ocean on May 8, 2006. Credit: NASA",
	  "Astronauts exercise while in space to slow bone and muscle loss. This will be very important on trips to Mars. Credit: NASA",
      "Astronaut Leroy Chiao watches a ball of water float on the International Space Station. Credit: NASA",
      "A dying star sends out dust in circles to form a nebula that looks like a cat's eye. Credit: NASA");
picCaption3 = new Array("The NASA SR-71, also called the Blackbird, is the world's fastest and highest-flying airplane flown by a pilot. Credit: NASA",
       "An astronaut on the space station took this picture of the Mississippi River winding through Greenville, Arkansas. Credit: NASA",
       "These plants were grown by astronauts on the International Space Station. Credit: NASA",
	    "The Space Shuttle Discovery moves toward the International Space Station. Credit: NASA",
		 "A fast-moving comet passes in front of the Ring Nebula. Credit: NASA");
picCaption4 = new Array("The Space Shuttle Endeavour rides piggyback on the top of a 747 Shuttle Carrier Aircraft. Credit: NASA", "The Cleveland Volcano in Alaska sends ash into the air. Credit: NASA",
      "On future moon missions, astronauts may drill into the moon's surface. They will collect rock samples to bring back to Earth. Credit: NASA",
      "Commander Steven Lindsey holds a tortilla as he gets ready to eat a meal on the space shuttle. Credit: NASA",
	   "The Great Red Spot on Jupiter is a huge storm, like the hurricanes that are found on Earth. Credit: NASA/JPL");  
picCaption5 = new Array("NASA's Super Guppy airplane takes off from Edwards Air Force Base in California to return to the Johnson Space Center in Texas. Credit: NASA",
       "From space, Earth looks like a big blue, white and green marble. Credit: NASA", "Parachutes will help astronauts on future missions land safely on Earth. Credit: NASA",
	   "Astronaut Bill McArthur (left) and cosmonaut Valery I. Tokarev (right) pose with both a U.S. space suit (left) and a Russian space suit (right). Credit: NASA",
	   "The black circle in this picture is the planet Venus as it moves in front of the sun. Credit: NASA"); 
picCaption6 = new Array("NASA's Weightless Wonder follows an up-and-down path, as if it is riding an invisible roller coaster. As the plane crosses over its highest point and flies down, the riders feel weightless for about 40 seconds. Credit: NASA",
        "Millions of tiny plants called phytoplankton grow near the surface of the ocean. From space, the plants look like an aqua blue swirl. Credit: NASA",
		"The Orion crew vehicle will sit atop the Ares I rocket and will carry astronauts into orbit. Credit: NASA",
		"A Progress spacecraft from Russia brings food, water, fuel, oxygen, spare parts and other supplies to the International Space Station. Credit: NASA",
		"The Mars rover Spirit took this picture of rocks on the Red Planet. Credit: NASA/JPL");    
picCaption7 = new Array("On July 20, 2007, the X-48B completed its first flight. Credit: NASA",
        "The crew of space shuttle mission STS-118 took this image of the eye of Hurricane Dean. Credit: NASA",
		"One day, astronauts will travel to Mars and collect rock samples to learn more about the planet's history. Credit: NASA",
		"Astronaut Jeff Williams works outside the International Space Station during a spacewalk. Credit: NASA",
		"This crater on Mars, which many people think looks like a happy face, is about 215 kilometers (134 miles) across. Credit: NASA");     
 

picTag1 = new Array("Workers on two ladders work with a large triangle-shaped model in a wind tunnel", "A ring-shaped sandy island with green patches of vegetation along the left side",
         "An artist's drawing of a satellite orbiting the moon", "The orbiter is seen pointed nose up as it orbits above Earth", "Many images put together to create a close-up image of Saturn and its rings");
picTag2 = new Array("A red, white and blue F-15 jet in flight", "A large swirling storm over the Pacific Ocean", 
          "Astronaut Jeff Williams gives a thumbs-up as he jogs on a treadmill on the International Space Station", "A ball of water floats in front of astronaut Leroy Chiao's face",
		   "Bright rings of bluish light surrounding a star");
picTag3 = new Array("An SR-71 airplane flies over snow-covered mountains", "A winding river as seen from space", "Green leafy plants in an enclosed container", "The space shuttle in orbit near the International Space Station", "A comet passes in front of a ring-shaped nebula");
picTag4 = new Array("A large airplane takes off with the space shuttle attached to the top of it", "A view from above of a large plume-shaped volcano sending ash into the air",
                "An artist's drawing of two astronauts with a lunar rover on the moon", "Steven Lindsey holds a tortilla as he floats on the middeck of the space shuttle",
				 "An up-close image of Jupiter's Great Red Spot");
picTag5 = new Array("A large, fish-shaped airplane in flight", "Swirling white clouds and green land areas are seen on this satellite image of Earth", 
            "An artist's drawing of three red and white parachutes attached to a capsule as it lands", "Two astronauts float with two space suits inside the International Space Station",
			"The solid black circle is the planet Venus in front of the face of the sun as seen from Earth");
picTag6 = new Array("An airplane flies up at a steep angle", "Swirling turquoise and green phytoplankton are floating off the coast of South Africa",
            "An artist's drawing of a rocket launching", "A spacecraft is seen against a background of Earth's horizon", "Many dark rocks scattered on the rust-colored surface of Mars");
picTag7 = new Array("The X-48B airplane, shaped like a large wing without a tail, flies over a desert landscape", "The swirling center of a hurricane",
            "An artist's drawing of an astronaut collecting rocks on Mars", "Astronaut Jeff Williams is tethered to the outside of the space station", "A satellite image of a crater on Mars that looks like a smiley face");
			

tnTag1 = new Array("Blended Wing Body Aircraft", "Nukuoro Atoll", "NASA is Returning to the Moon", "Space Shuttle Discovery", "Saturn");
tnTag2 = new Array("NASA F-15 ACTIVE", "Typhoon Chanchu", "Exercise in Space", "Water Bubble", "Cat's Eye Nebula");
tnTag3 = new Array("World's Fastest Airplane", "Mississippi River From Space", "Plants in Space", "Shuttle Docking","Comet and Nebula");
tnTag4 = new Array("Piggyback Shuttle", "Alaska Volcano Eruption", "Drilling on the Moon", "Good Enough to Eat",
				 "Jupiter's Great Red Spot");
tnTag5 = new Array("Super Guppy in Flight", "The Blue Marble", "Parachutes Deployed", "Dressing for Space", "Venus Transit");
tnTag6 = new Array("Weightless Wonder", "Bloom Off of South Africa", "Ares I Launch", "Special Delivery", "Boulders on Mars");
tnTag7 = new Array("First Flight of the X-48B", "Hurricane Dean", "At Work on Mars", "Space Station Spacewalk", "Happy Face Crater");


imgCnt = 0
function setSets(setNum) {
	imagSet = setNum;
	img = 1;
	//alert(setNum);
	getImage('../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + img +'.jpg');
	swapThumbs();
	document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button.gif';
		document.prevBtn.title='Back';
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button.gif';
		document.nextBtn.title='Next';
}
function loadImage() {
	getImage('../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + img +'.jpg');
	swapThumbs();
	loadTag();
	document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button.gif';
		document.prevBtn.title='Back';
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button.gif';
		document.nextBtn.title='Next';	
}


function loadTag() {
	if(imagSet==1){
		tagURL = picTag1[img-1];
		imgInfo = picCaption1[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}
	if(imagSet==2){
		tagURL= picTag2[img-1];
		imgInfo = picCaption2[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}
	 // alert(tagURL); 
	 if(imagSet==3){
		tagURL= picTag3[img-1];
		imgInfo = picCaption3[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}
	
	 if(imagSet==4){
		tagURL= picTag4[img-1];
		imgInfo = picCaption4[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}
	 if(imagSet==5){
		tagURL= picTag5[img-1];
		imgInfo = picCaption5[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}
	 if(imagSet==6){
		tagURL= picTag6[img-1];
		imgInfo = picCaption6[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}
	 if(imagSet==7){
		tagURL= picTag7[img-1];
		imgInfo = picCaption7[img-1];
		document.getElementById('txtHlder').innerHTML=imgInfo;
	}

  } 
  
  
 
function getImage(pImageURL) {
    loadTag();
    var image=new Image();
    image.src=pImageURL;	
    document.getElementById('imgHolder').innerHTML='<img border="0" src="'+pImageURL+'" title="'+tagURL+'">';
 document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button.gif';
		document.prevBtn.title='Back';
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button.gif';
		document.nextBtn.title='Next';}

function swapThumbs(){
	//loadTag();
	if(imagSet==1){
		for (var x = 1; x <= 6; x++){
		tagURLtn = tnTag1[x-1];
		imgN = 'thumb'+ x;
		imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
		document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
		}
	}
	if(imagSet==2){
		for (var x = 1; x <= 6; x++){
		tagURLtn = tnTag2[x-1];
		imgN = 'thumb'+ x;
		imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
		document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
		}
	}
		if(imagSet==3){
		for (var x = 1; x <= 6; x++){
		tagURLtn = tnTag3[x-1];
		imgN = 'thumb'+ x;
		imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
		document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
		}
	}
	
	if(imagSet==4){
		for (var x = 1; x <= 6; x++){
		tagURLtn = tnTag4[x-1];
		imgN = 'thumb'+ x;
		imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
		document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
		}
	}
	if(imagSet==5){
			for (var x = 1; x <= 6; x++){
			tagURLtn = tnTag5[x-1];
			imgN = 'thumb'+ x;
			imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
			document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
			}
		}
	if(imagSet==6){
			for (var x = 1; x <= 6; x++){
			tagURLtn = tnTag6[x-1];
			imgN = 'thumb'+ x;
			imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
			document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
			}
		}
		if(imagSet==7){
			for (var x = 1; x <= 6; x++){
			tagURLtn = tnTag7[x-1];
			imgN = 'thumb'+ x;
			imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + x + '_tn.jpg';
			document.getElementById(imgN).innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURLtn+'" TITLE="'+tagURLtn+'">';	
			}
		}
}

function thumbClick(thumbNbr){
	img=thumbNbr;
	loadTag();
    //alert(thumbNbr);
	imgN = 'thumb'+ thumbNbr;
	imgU = '../../../externalflash/Image_Gallery_Update/images/set_' + imagSet + '_pic_' + thumbNbr + '.jpg'
	document.getElementById('imgHolder').innerHTML='<img border="0" src="'+imgU+'" alt="'+tagURL+'" TITLE="'+tagURL+'">';
} 

function Prev(){
	if(img==1){
		document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button_2.gif';
		document.prevBtn.title='Back button disabled';
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button.gif';
		document.nextBtn.title='Next';
	}else{
		img--
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button.gif';
		document.nextBtn.title='Next';
		document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button.gif';
		document.prevBtn.title='Back';
		loadImage();
	}
}

function Next(){
	if(img==5){
		//img--;
		document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button.gif';
		document.prevBtn.title='Back';
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button_2.gif';
		document.nextBtn.title='Next button disabled';
	}else{
		img++
		document.prevBtn.src='../../../externalflash/Image_Gallery_Update/images/back_button.gif';
		document.prevBtn.title='Back';
		document.nextBtn.src='../../../externalflash/Image_Gallery_Update/images/next_button.gif';
		document.nextBtn.title='Next';
		loadImage();
		//alert(img + imgCnt);
	}
}

