// -------------------------------------------------------------
// start of Loader.js
// author: Pallavi Kuntamalla modifed by Peterjohn 12/21/04
// -------------------------------------------------------------
		
var i=0;				
var timerId;
var nextimage;  
var CONST_IMAGE_NO = 10;
var strSrc="./gallery/"
var cycimage;var imageArr = new Array(CONST_IMAGE_NO );

for (i = 0; i < imageArr.length; i++) {
	imageArr[i] = new Image();
	imageArr[i].src = strSrc + (i) + ".jpg";
}

var descarr = new Array(CONST_IMAGE_NO );
var altarr = new Array(CONST_IMAGE_NO );

//list of descriptions
i=0;
descarr[i++] = "Subcompartments in the developing mushroom bodies of the " +
              "fruit chafer beetle <i>Pachnoda marginata</i> are revealed by selective markers. " + 
              "The mushroom bodies are higher brain centers that display a diverse array of " +
              "morphologies across the insects.";

descarr[i++] = "Natural re-vegetation islands on an abandoned coal mine are " +
                  " facilitated by symbiotic arbuscular mycorrhizal fungi that  " +
                  " increase plant resistance to phytotoxic Al in residual soils. ";

descarr[i++] = "The new Life Sciences Building, completed in 2003, is home to the Department of Biology";

descarr[i++] = "American Ginseng is one of the wild harvested plants being studied in Dr. McGraw's laboratory. " +
				" The National Science Foundation is currently supporting a 4 year study of the population viability in this species. ";
				
descarr[i++] = "Silversword, a spectacular endangered native plant of Hawaii, is being used as a model for remote sensing and conservation studies. "+
				" The National Park Service is cooperating with Dr. McGraw (Biology) and Dr. Tim Warner (Geography) on these studies.";

descarr[i++] = "<i>Arabidopsis thaliana</i> is a small flowering plant that is widely used as a model organism in plant biology. " +
				" Arabidopsis is a member of the mustard (Brassicaceae) family, which includes cultivated species like cabbage and radish. Arabidopsis " +
				" is not of major agronomic significance, but it offers important advantages for basic research in genetics and molecular biology.";

descarr[i++] = "The Arabidopsis flower develops sixteen organs in four concentric rings, or whorls. In the outermost whorl, whorl 1, four green sepals develop." +
				" Interior and alternate to the sepals are four white petals which occupy  whorl 2. Whorl 3 contains six stamens." +
				" The center of the flower, whorl 4, consists of two fused carpels that comprise the gynoecium.";

descarr[i++] = "Greenhouse facilities in the Life Sciences Building provide opportunities to conduct research under varying " +
				"conditions of light, temperature, and CO<sub>2</sub>";

descarr[i++] = "The <i>Drosophila</i> eye is a precisely patterned tissue with ~750 subunits called ommatidia. " +
				" The molecular factors and their regulation during development appear to have striking similarities " +
				" to those in mammals. Protein Kinase <i>Casein Kinase 2(CK2)</i> is one of the many regulatory molecules that "+
				" play a critical role in controlling the number and the pattern formation of photoreceptor cells which dictates "+
				" the ultimate pattern of the fly eye.";

descarr[i++] = "In cooperation with the U.S. Forest Service, faculty and students at WVU are examining the " +
				" links between acid deposition and the sustainable productivity of forests in central Appalachia. " +
				" Long-term stream-water chemistry records from the Fernow Experimental Watershed suggest that high amounts of "+
				" nitrogen depostion may alter nutrient dynamics in ways that deplete soils of essential base cations.  The "+
				" National Science Foundation is currently supporting this work.";

//list of alt texts
i=0;
altarr[i++]="Pachnoda marginata";
altarr[i++]="Natural re-vegetation";
altarr[i++]="Life Sciences Building";
altarr[i++]="American Ginseng";
altarr[i++]="Silversword";
altarr[i++] = "Arabidopsis Plant";
altarr[i++] = "Arabidopsis Flower";
altarr[i++] = "Greenhouse";
altarr[i++] = "Drosophila Eye";
altarr[i++] = "Fernow Weir";

function loadimg () {
	
	//a random number between 0 and CONST_IMAGE_NO will be generated
	var randomnumber=Math.floor(Math.random()*(CONST_IMAGE_NO));
	if (randomnumber>CONST_IMAGE_NO) randomnumber=0;
	document.getElementById('h2text').innerHTML=descarr[randomnumber];
	document.getElementById("Img_Center").src =imageArr[randomnumber].src ;	
	document.getElementById("Img_Center").alt =altarr[randomnumber];	
	//timerset ();
}

function timerset () {
	//if (document.all.cycle.checked) {
		timerid = setInterval("docycle()",500);
		cycimge = nextimage;
	//}	
	//else
	//	clearInterval(timerid);
}function docycle () {
	
	if (cycimage < (imageArr.length - 1)) 
		cycimage += 1;
	else
		cycimage = 1;
	document.all.Img_Center.src = imageArr[cycimage].src;
	document.all.Img_Center.alt = altarr[cycimage];
	document.all.h2text.innerHTML = descarr[cycimage];
	
	//document.all.position.selectedIndex = cycimage;
}

// -------------------------------------------------------------
// end of Loader.js
// -------------------------------------------------------------
