imgContainer = false;
img = -1;
imgCnt = 0;
imgInfoArray = new Array();

function changeImg(arg){
	if (arg){	
		if (++img==imgCnt)
		img=0;		
	}else{
		if (img==0)
		img=imgCnt;
		img--;
	}
	Update();
}

function getobject(obj){
	if (document.getElementById)
		return document.getElementById(obj)
		else if (document.all)
		return document.all[obj]
}

function Update(){
	getobject("imgContainer").src = imgInfoArray[img][0];
	getobject("txtContainer").innerHTML = imgInfoArray[img][1];
	getobject("imgContainer").alt = imgInfoArray[img][2];
	getobject("imgContainer").title = imgInfoArray[img][2];
}


function loadImg(){
	if (imgContainer)
		window.setTimeout("Tick()", timeOutInSec*1000);
}
		
function Tick(){
	if (imgContainer)
		Next();
}


function Prev(){
	if(img==0){
		img++;
		document.prevBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_back_button_2.gif';
		document.prevBtn.title='Back button disabled';
		document.prevBtn.alt='Back button disabled';
		document.nextBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_next_button.gif';
		document.nextBtn.title='Next';
		document.nextBtn.alt='Next';
		
	}
	else{
	document.nextBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_next_button.gif';
	document.nextBtn.title='Next';
		document.nextBtn.alt='Next';
	document.prevBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_back_button.gif';
	document.prevBtn.title='Back';
	document.prevBtn.alt='Back';
	}
changeImg(false);
}
function Next(){
	if(img==imgCnt-1){
		img--;
		document.prevBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_back_button.gif';
		document.prevBtn.title='Back';
	    document.prevBtn.alt='Back';
		document.nextBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_next_button_2.gif';
		document.nextBtn.title='Next button disabled';
	    document.nextBtn.alt='Next button disabled';
	}
	else {
	document.prevBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_back_button.gif';
	document.prevBtn.title='Back';
	document.prevBtn.alt='Back';
	document.nextBtn.src='../../../externalflash/STS-118_Shuttle_Crew/images/NIS_next_button.gif';
	document.nextBtn.title='Next';
	document.nextBtn.alt='Next';
	}
changeImg(true);

}

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_1.jpg", "Seven astronauts made up the STS-118 crew. Pictured from the left are mission specialists Rick Mastracchio and Barbara Morgan, who is also NASA's first Educator Astronaut; pilot Charlie Hobaugh; commander Scott Kelly; and mission specialists Tracy Caldwell, Dave Williams, of the Canadian Space Agency, and Alvin Drew.", "The seven members of the STS-118 space shuttle crew pose in orange shuttle launch and entry suits");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_2.jpg", "The STS-118 mission patch has a gray shape of the International Space Station. The star at the top of the gold astronaut symbol sits on the part of the ISS that was added during the mission. The space shuttle on the patch has flown around the symbol, leaving a trail that looks like an American flag.", "A rectangular patch with drawings of the shuttle, ISS and the astronaut symbol");
imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_3.jpg", "NASA's first Educator Astronaut flew on this mission. The flame of knowledge shows the importance of education and honors all teachers and students. A red maple leaf sits next to Williams' name. The red maple leaf is part of Canada's flag.", "A rectangular patch with drawings of the shuttle, ISS and the astronaut symbol");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_4.jpg", "Pilot Charlie Hobaugh tried on the training version of his shuttle launch and entry suit. NASA astronauts use this suit because the bright orange is easy to see if the shuttle has to make a water landing.", "Pilot Charlie Hobaugh tries on the glove of his orange launch and entry suit" );

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_5.jpg", "Commander Scott Kelly trained in the motion-based simulator at NASA's Johnson Space Center in Houston, Texas. This simulator helps astronauts practice flying the shuttle. It moves and makes noises to help the astronauts know what flying on the shuttle is like.", "Scott Kelly sits in the commander's seat in a shuttle simulator");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_6.jpg", "Astronaut Tracy Caldwell listened as a crew trainer told her how to use her parachute gear. She wore a training version of her shuttle launch and entry suit.", "Mission specialist Tracy Caldwell looks out from between her parachute straps");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_7.jpg", "Astronaut Rick Mastracchio made his drink choices for the STS-118 mission. NASA astronauts plan their food menus months before going into space.", "Small cups of colorful liquids sit in the foreground, as mission specialist Rick Mastracchio writes on a pad of paper");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_8.jpg", "Canadian astronaut Dave Williams worked in a shuttle mission simulator at NASA's Johnson Space Center. He was dressed in an orange training shuttle launch and entry suit.", "Mission specialist Dave Williams, dressed in his training version of the shuttle launch and entry suit, practices for his shuttle mission");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_9.jpg", "Astronaut Barbara Morgan inflated her one-person life raft during training at the Neutral Buoyancy Laboratory near NASA's Johnson Space Center. This kind of raft would only be used in case of a water-landing emergency.", "Mission specialist Barbara Morgan pulls the sides of her bright orange life raft together while floating in a pool of water");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_10.jpg", "Astronaut Kay Hire helped STS-118 mission specialist Alvin Drew get into his seat. Drew was training with his crewmates for the shuttle landing.", "Alvin Drew in his bright orange training suit, gets into a chair while another astronaut helps him strap in");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_11.jpg", "The STS-118 mission was a special one for teachers and students. Mission specialist Barbara Morgan is a teacher and a fully trained astronaut. Educator Astronauts share the excitement of space exploration with students.", "Plastic containers filled with growing plants surrounded by items that are part of the education payload on STS-118");

imgInfoArray[imgCnt++] = new Array ("../../../externalflash/STS-118_Shuttle_Crew/images/pic_12.jpg", "As part of this mission, students can design and build plant growth chambers that could be used on the moon. Morgan and her crewmates took two plant growth chambers and 10 million basil seeds on STS-118. Teachers can use the plant growth chambers built by their students to grow these seeds.", "Plastic containers filled with growing plants surrounded by items that are part of the education payload on STS-118");

if (document.getElementById||document.all)
	window.onload=Next;
