 
 var mytimeWelcome=new Array();
 var mytimeWhatIsTES=new Array();
 var mytimeDetectingAltitudes=new Array();
 var mytimeChemicalClues=new Array();
 var mytimeOzone=new Array();
 var mytimeGlobalWarming=new Array();
 var mytimeGlobalWaterCycle=new Array();
 var mytimeBiomassBurning=new Array();
 var mytimeLocalAndRegional=new Array();
 var mytimeLimbAndNadir=new Array();
 var mytimeBalloon=new Array();
 
 var mytimeLeaveHotspot=new Array();
 
 var rotateTimes=10;  //how many times slideshow rotates
   
   function newImage(arg) {
   	if (document.images) {
   		rslt = new Image();
   		rslt.src = arg;
   		return rslt;
   	}
   }
  
   var preloadFlag = false;
   function preloadHomeImages() {
   	if (document.images) {
   		
		//homeWelcome = newImage("./images/homeWelcome.jpg");
		document.getElementById('welcomeGraph').style.display = "inline";
		document.getElementById('welcomeText').style.display = "inline";
		
		//homeChemicalClues = newImage("./images/homeChemicalClues.jpg");		
		document.getElementById('ChemicalCluesGraph').style.display = "none";	
		document.getElementById('ChemicalCluesText').style.display = "none";	
		
		//homeOzone = newImage("./images/homeOzone.jpg");		
		document.getElementById('OzoneGraph').style.display = "none";	
		document.getElementById('OzoneText').style.display = "none";	
		
		//homeGlobalWarming = newImage("./images/homeGlobalWarming.jpg");	
		document.getElementById('GlobalWarmingGraph').style.display = "none";	
		document.getElementById('GlobalWarmingText').style.display = "none";
			
		//homeGlobalWaterCycle = newImage("./images/homeGlobalWaterCycle.jpg");		
		document.getElementById('GlobalWaterCycleGraph').style.display = "none";	
		document.getElementById('GlobalWaterCycleText').style.display = "none";
		
		//homeBiomassBurning = newImage("./images/homeBiomassBurning.jpg");		
		document.getElementById('BiomassBurningGraph').style.display = "none";	
		document.getElementById('BiomassBurningText').style.display = "none";
		
		//homeLocalAndRegional = newImage("./images/homeLocalAndRegional.jpg");		
		document.getElementById('LocalAndRegionalGraph').style.display = "none";	
		document.getElementById('LocalAndRegionalText').style.display = "none";
		
		//homeWhatIsTES = newImage("./images/homeWhatIsTES.jpg");		
		document.getElementById('WhatIsTESGraph').style.display = "none";	
		document.getElementById('WhatIsTESText').style.display = "none";
		
		//homeDetectingAltitudes = newImage("./images/homeDetectingAltitudes.jpg");		
		document.getElementById('DetectingAltitudesGraph').style.display = "none";	
		document.getElementById('DetectingAltitudesText').style.display = "none";
		
		//homeSunSync = newImage("./images/homeSunSync.jpg");		
		//document.getElementById('SunSyncGraph').style.display = "none";	
		//document.getElementById('SunSyncText').style.display = "none";
		
		//homeLimbAndNadir = newImage("./images/homeLimbAndNadir.jpg");		
		document.getElementById('LimbAndNadirGraph').style.display = "none";	
		document.getElementById('LimbAndNadirText').style.display = "none";
				
		//homeBalloon = newImage("./images/homeBalloon.jpg");
		document.getElementById('BalloonGraph').style.display = "none";	
		document.getElementById('BalloonText').style.display = "none";
		
		homeSlideshow(0);
   	}
   }
      
   function turnOffHomeImages() {
   		//MM_swapImage('homeRollovers','','./images/homeWelcome.jpg',1);
		//MM_swapImage('homeWelcome','','./images/homeWelcome.jpg',1);
  		//MM_swapImage('homeChemicalClues','','./images/homeWelcome.jpg',1);   
		
		document.getElementById('welcomeGraph').style.display = "none";
		document.getElementById('welcomeText').style.display = "none";
		document.getElementById('ChemicalCluesGraph').style.display = "none";	
		document.getElementById('ChemicalCluesText').style.display = "none";	
		document.getElementById('OzoneGraph').style.display = "none";	
		document.getElementById('OzoneText').style.display = "none";	
		document.getElementById('GlobalWarmingGraph').style.display = "none";	
		document.getElementById('GlobalWarmingText').style.display = "none";	
		document.getElementById('GlobalWaterCycleGraph').style.display = "none";	
		document.getElementById('GlobalWaterCycleText').style.display = "none";
		document.getElementById('BiomassBurningGraph').style.display = "none";	
		document.getElementById('BiomassBurningText').style.display = "none";
		document.getElementById('LocalAndRegionalGraph').style.display = "none";	
		document.getElementById('LocalAndRegionalText').style.display = "none";
		document.getElementById('WhatIsTESGraph').style.display = "none";	
		document.getElementById('WhatIsTESText').style.display = "none";
		document.getElementById('DetectingAltitudesGraph').style.display = "none";	
		document.getElementById('DetectingAltitudesText').style.display = "none";
		//document.getElementById('SunSyncGraph').style.display = "none";	
		//document.getElementById('SunSyncText').style.display = "none";
		document.getElementById('LimbAndNadirGraph').style.display = "none";	
		document.getElementById('LimbAndNadirText').style.display = "none";
		document.getElementById('BalloonGraph').style.display = "none";	
		document.getElementById('BalloonText').style.display = "none";
		
   }

function homeSlideshow(p){
	var pauseWelcome=20000; //SET PAUSE FOR WELCOME (1000= 1 seconds)	
	var pauseTopic=25000; //SET PAUSE FOR TOPICS 	
	// are we coming from the home page (mode=0) or from other hotspot(mode=1)
	var mode=p;
	
	//if we are coming from the other hotspot-- delay slideshow by 7 seconds	
	if (mode==0){
		//
		var pause=0;
	}else{
		var pause=7000;
	}
	
	//for (p=0;p<p+1;p++){		
	for (p=0;p<rotateTimes;p++){
		mytimeWelcome[p]=setTimeout("rotateimage('welcome')",pause);
		pause=pause+pauseWelcome; 
		mytimeWhatIsTES[p]=setTimeout("rotateimage('WhatIsTES')",pause);
		pause=pause+pauseTopic; 
		mytimeDetectingAltitudes[p]=setTimeout("rotateimage('DetectingAltitudes')",pause);
		pause=pause+pauseTopic; 
		mytimeChemicalClues[p]=setTimeout("rotateimage('ChemicalClues')",pause);
		pause=pause+pauseTopic; 
		mytimeOzone[p]=setTimeout("rotateimage('Ozone')",pause);
		pause=pause+pauseTopic; 
		mytimeGlobalWarming[p]=setTimeout("rotateimage('GlobalWarming')",pause);
		pause=pause+pauseTopic; 
		mytimeGlobalWaterCycle[p]=setTimeout("rotateimage('GlobalWaterCycle')",pause);
		pause=pause+pauseTopic; 
		mytimeBiomassBurning[p]=setTimeout("rotateimage('BiomassBurning')",pause);
		pause=pause+pauseTopic; 
		mytimeLocalAndRegional[p]=setTimeout("rotateimage('LocalAndRegional')",pause);	
		pause=pause+pauseTopic; 
		mytimeLimbAndNadir[p]=setTimeout("rotateimage('LimbAndNadir')",pause);
		pause=pause+pauseTopic; 
		mytimeBalloon[p]=setTimeout("rotateimage('Balloon')",pause);
		pause=pause+pauseTopic; 
	}
}   

function rotateimage(e){
	var elementID=e;
	
	turnOffHomeImages();
	document.getElementById(elementID+'Graph').style.display = "inline";
	document.getElementById(elementID+'Text').style.display = "inline";
	
}

function leaveTopicHotspot(){
	var pauseLeave=7000;
	
	//clearTimeout(mytime);
	//for (p=0;p<11;p++){
		//clearTimeout(mytime[p]);
	//}
	
	clearAllTimeouts();
	//mytimeLeaveHotspot[0]=setTimeout(homeSlideshow(),pauseLeave);
	homeSlideshow(1)
}

function showTopicHotspot(){
	
	//clearTimeout(mytime);
	//for (p=0;p<11;p++){
		//clearTimeout(mytime[p]);
	//}
	clearAllTimeouts()
	turnOffHomeImages();
}

function clearAllTimeouts(){
	
	for (p=0;p<rotateTimes;p++){
		clearTimeout(mytimeWelcome[p]);
		clearTimeout(mytimeWhatIsTES[p]);
		clearTimeout(mytimeDetectingAltitudes[p]);
		clearTimeout(mytimeChemicalClues[p]);
		clearTimeout(mytimeOzone[p]);
		clearTimeout(mytimeGlobalWarming[p]);
		clearTimeout(mytimeGlobalWaterCycle[p]);
		clearTimeout(mytimeBiomassBurning[p]);
		clearTimeout(mytimeLocalAndRegional[p]);
		clearTimeout(mytimeLimbAndNadir[p]);
		clearTimeout(mytimeBalloon[p]);
	}
}