/* randomImage - image rotation code for UIUC entomology website
 * 
 * GLOBAL VARIABLES
 * 
 * var is a random number that will determine pictures, captions, and credits for
 * the rotating image.  Chosen through function makeRandom().
 * 
 * myCaptions holds all the captions.  The index in the array matches the filename
 * of the image it describes.  If anyone knows how to make this array data load
 * from a file, be my guest.  It's a pain right now.
 * 
 * myCredits holds all the photo credits.  As with myCaptions, the index of the
 * credit must match the filename of the image.
 *
 */
var ran;

var myCaptions = new Array(
		   /*0*/   'A cucumber beetle (<i>Acalymma vittatum</i>) regards a squash plot.', 
                   /*1*/   'Late instar nymph of the family Miridae.', 
                   /*2*/   'Tiger beetle on the road in Union County, IL.', 
                   /*3*/   'Postcopulatory mate guarding behavior in craneflies.',
                   /*4*/   '<i>Erythroneura comes</i>, the grape leafhopper.',
                   /*5*/   '<i>Aphelonema simplex</i>, a piglet bug feeding on cordgrass.',
		   /*6*/   '<i>Bombus griseocollis</i>, a local bumble bee, foraging on echinacea.', 
                   /*7*/   '<i>Bombus haemorrhoidalis</i>, a bumble bee from eastern Myanmar.',
                   /*8*/   '<i>Uroleucon nigrotuberculatum</i>, a goldenrod-feeding aphid.',
                   /*9*/   'A Ghanan mantis species in profile.',
                   /*10*/  '<i>Libellula vibrans</i>, the great blue skimmer, at a pond in NC.',
                   /*11*/  'The red milkweed beetle, <i>Tetraopes tetrophthalmus</i>.',
                   /*12*/  '<i>Magicicada septendecim</i>, a 17-year cicada from Brood X.',
		   /*13*/  'Mating pair of bee-mimic asilid flies, possibly <i>Laphria</i> sp.',
		   /*14*/  'Coreid bug on melastome, in the Ecuadorian cloud forest.',
		   /*15*/  'A skipper (Hesperiidae) from the Ecuadorian cloud forest.',
		   /*16*/  'The "oil beetle" <i>Meloe proscarabaeus</i>, near Cornwall, UK.',
		   /*17*/  'Ichneumonid wasp attacked by an assassin bug (Reduviidae).',
		   /*18*/  'Stingless bees (<i>Parapartamona tungarahua</i>) interacting.',
		   /*19*/  'Tenthredinid sawflies mate on a leaf surface in Ecuador.',
		   /*20*/  '<i>Pelidnota punctata</i>, a local grape-feeding scarab.',
		   /*21*/  'A carolina mantis (<i>Stagmomantis carolina</i>) stalks its prey.',
		   /*22*/  'A Chinese mantis (<i>Tenodera aridifolia</i>) cocks its head.',
		   /*23*/  'Eurpoean earwig (<i>Forficula auricularia</i>) on an Anemone.',
		   /*24*/  'Female tiphiid, <i>Myzinum</i> sp., on goldenrod in Southern IL.',
		   /*25*/  'Tachinid fly, <i>Trichopoda</i> sp., on goldenrod in Southern IL.',
		   /*26*/  'A local horntail species (<i>Tremex columba</i>) rests on a tree.',
		   /*27*/  'Mating cecropia moths (<i>Hyalophora cecropia</i>).',
		   /*28*/  'Invasive gypsy moth larva (<i>Lymantria dispar</i>) on oak leaf.',
		   /*29*/  'A bombyliid fly (a bee mimic) delicately sips nectar.',
		   /*30*/  'The introduced bee species <i>Anthidium manicatum</i>.',
		   /*31*/  'Aggregation of marine springtails, <i>Anurida maritima</i>.',
		   /*32*/  'A Halloween pennant, <i>Celithemis eponina</i>.',
		   /*33*/  'Paper wasps (<i>Polistes dominulus</i>) watch the photographer.',
		   /*34*/  '<i>Vanessa cardui</i>, the painted lady, enjoying oregano blooms',
		   /*35*/  '<i>Megacyllene caryae</i>, the painted hickory borer.',
		   /*36*/  'A lichen moth (Arctiidae) in Shades State Park, IN.',
		   /*37*/  'A burying beetle (<i>Nicrophorus</i> sp.) with phoretic mites.',
		   /*38*/  'The drain fly (Psychodidae), a common pest of bathrooms.',
		   /*39*/  '<i>Hemaris thisbe</i>, the hummingbird clearwing sphinx moth.',
		   /*40*/  'An alderfly (<i>Sialis</i> sp). rests on a leaf.',
		   /*41*/  'Mating cluster of scarab beetles.',
		   /*42*/  'Squash vine borer (<i>Melittia cucurbitae</i>) feeding on milkweed.')

var myCredits = new Array(
		   /*0*/  'R. Mitchell',
		   /*1*/  'S. Taylor', 
		   /*2*/  'S. Taylor', 
		   /*3*/  'S. Taylor', 
		   /*4*/  'C. Dietrich',
		   /*5*/  'C. Dietrich',
		   /*6*/  'H. Hines',
		   /*7*/  'H. Hines',
		   /*8*/  'M. Richardson',
		   /*9*/  'M. Richardson',
		   /*10*/ 'R. Mitchell',
		   /*11*/ 'R. Mitchell',
		   /*12*/ 'J. Whitfield',
		   /*13*/ 'J. Whitfield',
		   /*14*/ 'J. Whitfield',
		   /*15*/ 'J. Whitfield',
		   /*16*/ 'J. Whitfield',
		   /*17*/ 'J. Whitfield',
		   /*18*/ 'J. Whitfield',
		   /*19*/ 'J. Whitfield',
		   /*20*/ 'F. Delcomyn',
		   /*21*/ 'F. Delcomyn',
		   /*22*/ 'J. Whitfield',
		   /*23*/ 'J. Whitfield',
		   /*24*/ 'J. Whitfield',
		   /*25*/ 'J. Whitfield',
		   /*26*/ 'J. Whitfield',
		   /*27*/ 'L. Solter',
		   /*28*/ 'L. Solter',
		   /*29*/ 'L. Solter',
		   /*30*/  'J. Whitfield',
		   /*31*/  'J. Whitfield',
		   /*32*/  'J. Whitfield',
		   /*33*/  'J. Whitfield',
		   /*34*/  'J. Whitfield',
		   /*35*/  'R. Mitchell',
		   /*36*/  'J. Whitfield',
		   /*37*/  'J. Whitfield',
		   /*38*/  'J. Whitfield',
		   /*39*/  'J. Whitfield',
		   /*40*/  'J. Whitfield',
		   /*41*/  'S. Dold',
		   /*42*/  'S. Dold')

function makeRandom()
{
 //imageNumber is total images in the images/rotation folder.  Make sure all
 //images in the folder are consecutively numbered, from 0 to imageNumber-1.

 //ALSO make sure the size of myCredits and myCaptions equals the number of images.

 var imageNumber = 43;
 ran=Math.floor(Math.random()*imageNumber);
}

function randomImage()
{

 document.write('<img alt="Random Image" src=\"images/rotation/' + ran + '.jpg\">');

}

function randomCaption()
{

 document.write(myCaptions[ran]);

}

function randomCredit()
{

 document.write(myCredits[ran]);

}