/*****************************************************************************************/
/** 																					**/
/** mcready.js																			**/
/** 										    										**/
/** Javascript functions used by McReady website.										**/
/** 																					**/
/** Function			Description														**/
/** -----------------	---------------------------------------------------------------	**/
/** rotateImage		Driver function that sets the timer interval for the hazard			**/
/** 				page slide show.													**/
/** slideShow		Sets up an array of images, then displays a different image			**/
/**					each time it's called.												**/
/** linkFooter		Determines which links to include on the footer of each page.	 	**/
/**																						**/
/*****************************************************************************************/

var captionFont = '<font style="text-align: center; font-size: 12px; color: floralwhite;">';
var creditFont = '<font style="text-align: center; font-size: 10px; color: floralwhite;">';

var tornadoImages = new Array();
tornadoImages[0] = 'images/Amber Tornado 5-3-99.jpg';
tornadoImages[1] = 'images/El Reno tornado.jpg';
tornadoImages[2] = 'images/Cordell Tornado 5-22-81.jpg';
tornadoImages[3] = 'images/Roff Tornado 5-2-84.jpg';
tornadoImages[4] = 'images/Union City Tornado 5-24-73 (2).jpg';
tornadoImages[5] = 'images/Enid Tornado 6-5-66.jpg';
tornadoImages[6] = 'images/Cordell Tornado (2) 5-22-81.jpg';
tornadoImages[7] = 'images/Union City Tornado 5-24-73.jpg';

var tornadoCaptions = new Array();
tornadoCaptions[0] = 'SE of Amber 5/3/99<br>';
tornadoCaptions[1] = 'El Reno 4/24/06<br>';
tornadoCaptions[2] = 'Cordell 5/22/81<br>';
tornadoCaptions[3] = 'Roff 5/2/84<br>';
tornadoCaptions[4] = 'Union City 5/24/73<br>';
tornadoCaptions[5] = 'Enid 6/5/66<br>';
tornadoCaptions[6] = 'Cordell 5/22/81<br>';
tornadoCaptions[7] = 'Union City 5/24/73<br>';

var tornadoCredits = new Array();
tornadoCredits[0] = 'Photo courtesy of the National Weather Service';
tornadoCredits[1] = 'Photo courtesy of Aaron Kennedy at <a class=e href="http://www.ontheplains.com/">On the Plains</a>';
tornadoCredits[2] = 'Photo courtesy of NOAA Photo Library';
tornadoCredits[3] = 'Photo courtesy of NOAA Photo Library';
tornadoCredits[4] = 'Photo courtesy of NOAA Photo Library';
tornadoCredits[5] = 'Photo courtesy of NOAA Photo Library';
tornadoCredits[6] = 'Photo courtesy of NOAA Photo Library';
tornadoCredits[7] = 'Photo courtesy of NOAA Photo Library';

var lightningImages = new Array();
lightningImages[0] = 'images/Snyder Lightning.jpg';
lightningImages[1] = 'images/Broken Arrow Lightning 6-24-02.jpg';
lightningImages[2] = 'images/I-35 and Ladd Rd.jpg';
lightningImages[3] = 'images/Norman Lightning 6-19-80.jpg';
lightningImages[4] = 'images/east Frederick 6-5-05.jpg';
lightningImages[5] = 'images/Yukon Lightning 5-31-99.jpg';
lightningImages[6] = 'images/HWY 69 and HWY 51 Lightning.jpg';
lightningImages[7] = 'images/Norman Lightning 3-78.jpg';
lightningImages[8] = 'images/tulsa lightning 4-11-05.jpg';

var lightningCaptions = new Array();
lightningCaptions[0] = 'Near Snyder 6/5/05<br>';
lightningCaptions[1] = 'Broken Arrow 6/24/02<br>';
lightningCaptions[2] = 'I-35 and Ladd Rd 6/4/05<br>';
lightningCaptions[3] = 'Norman 6/19/80<br>';
lightningCaptions[4] = 'East of Frederick 6/5/05<br>';
lightningCaptions[5] = 'Near Yukon 5/31/99<br>';
lightningCaptions[6] = 'Near HWY 69 & HWY 51 5/31/03<br>';
lightningCaptions[7] = 'Norman 3/78<br>';
lightningCaptions[8] = 'Tulsa 4/11/05<br>';

var lightningCredits = new Array();
lightningCredits[0] = 'Photo courtesy of Aaron Kennedy at <a class=e href="http://www.ontheplains.com/">On the Plains</a>';
lightningCredits[1] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';
lightningCredits[2] = 'Photo courtesy of J.R. Hehnly at <a class=e href="http://www2.okstorms.com:8080/">OK Storms</a>';
lightningCredits[3] = 'Photo courtesy of NOAA Photo Library';
lightningCredits[4] = 'Photo courtesy of J.R. Hehnly at <a class=e href="http://www2.okstorms.com:8080/">OK Storms</a>';
lightningCredits[5] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';
lightningCredits[6] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';
lightningCredits[7] = 'Photo courtesy of NOAA Photo Library';
lightningCredits[8] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';

var floodImages = new Array();
floodImages[0] = 'images/Bartlesville Flood 10-4-86 Maries.jpg';
floodImages[1] = 'images/Webbers Falls Flood 10-86.jpg';
floodImages[2] = 'images/Miami Flood 7-51.jpg';
floodImages[3] = 'images/Arkansas River (2) 5-22-43.jpg';
floodImages[4] = 'images/Bartlesville Flood 10-4-86 Hensley Blvd.jpg';
floodImages[5] = 'images/WDMayo Flood 10-86.jpg';

var floodCaptions = new Array();
floodCaptions[0] = 'Marie\'s on Adams Blvd, Bartlesville 10/4/86<br>';
floodCaptions[1] = 'Webbers Falls, Arkansas River Flood 10/86<br>';
floodCaptions[2] = 'Miami, Neosho River Flood 7/51<br>';
floodCaptions[3] = 'Arkansas River Flood 5/22/43<br>';
floodCaptions[4] = 'Hensley Blvd, Bartlesville 10/4/86<br>';
floodCaptions[5] = 'Mayo Lock & Dam # 14 near Spiro Mounds, Arkansas River 10/86<br>';

var floodCredits = new Array();
floodCredits[0] = 'Photo courtesy Bartlesville Area History Museum';
floodCredits[1] = 'Photo courtesy Arkansas River Historical Society';
floodCredits[2] = 'Photo courtesy of John Schehrer at <a class=e href="http://www.homestead.com/schehrer2/">Ottawa County</a>';
floodCredits[3] = 'Photo courtesy Arkansas River Historical Society';
floodCredits[4] = 'Photo courtesy Bartlesville Area History Museum';
floodCredits[5] = 'Photo courtesy Arkansas River Historical Society';

var thunderstormImages = new Array();
thunderstormImages[0] = 'images/Broken Arrow Thunderstorm 5-16-02.jpg';
thunderstormImages[1] = 'images/Fredrick Thunderstorm 6-9-93.jpg';
thunderstormImages[2] = 'images/Western Oklahoma Thunderstorm 6-11-03.jpg';
thunderstormImages[3] = 'images/Muskogee Mammatus Clouds 6-13-98.jpg';
thunderstormImages[4] = 'images/Near Woodward Thunderstorm 6-5-01.jpg';
thunderstormImages[5] = 'images/West OKC Thunderstorm 6-8-98.jpg';
thunderstormImages[6] = 'images/near enid 5-14-05.jpg';
thunderstormImages[7] = 'images/laverne thunderstorm 6-20-05.jpg';

var thunderstormCaptions = new Array();
thunderstormCaptions[0] = 'Broken Arrow 5/16/02<br>';
thunderstormCaptions[1] = 'Fredrick 6/9/98<br>';
thunderstormCaptions[2] = 'Western Oklahoma 6/11/03<br>';
thunderstormCaptions[3] = 'Muskogee 6/13/98<br>';
thunderstormCaptions[4] = 'Near Woodward 6/5/01<br>';
thunderstormCaptions[5] = 'West of Oklahoma City 6/8/98<br>';
thunderstormCaptions[6] = 'Near Enid 5/14/05<br>';
thunderstormCaptions[7] = 'Laverne 6/20/05<br>';

var thunderstormCredits = new Array();
thunderstormCredits[0] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';
thunderstormCredits[1] = 'Photo courtesy of J.R. Hehnly at <a class=e href="http://www2.okstorms.com:8080/">OK Storms</a>';
thunderstormCredits[2] = 'Photo courtesy of J.R. Hehnly at <a class=e href="http://www2.okstorms.com:8080/">OK Storms</a>';
thunderstormCredits[3] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';
thunderstormCredits[4] = 'Photo courtesy of J.R. Hehnly at <a class=e href="http://www2.okstorms.com:8080/">OK Storms</a>';
thunderstormCredits[5] = 'Photo courtesy of J.R. Hehnly at <a class=e href="http://www2.okstorms.com:8080/">OK Storms</a>';
thunderstormCredits[6] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';
thunderstormCredits[7] = 'Photo courtesy of Charles Allison at <a class=e href="http://www.oklahomalightning.com/">Oklahoma Lightning</a>';

var whichImage = 0;
var imageDir = 1;

/*****************************************************************************************/
/**	Set the time the image and caption will be displayed and call the slideShow 		**/
/** function.																			**/
/*****************************************************************************************/
function rotateImage(whichHazard)
{
	if (whichHazard == "tornado")
	{
		setInterval("tornadoSlideShow()", 5000);
	}
	else if (whichHazard == "floods")
	{
		setInterval("floodSlideShow()", 5000);
	}
	else if (whichHazard == "lightning")
	{
		setInterval("lightningSlideShow()", 5000);
	}
	else if (whichHazard == "thunderstorm")
	{
		setInterval("thunderstormSlideShow()", 5000);
	}
}

/*****************************************************************************************/
/** Change the image and caption on the tornado page.									**/
/*****************************************************************************************/
function tornadoSlideShow()
{
	whichImage++;
	if (whichImage >= tornadoImages.length)
	{
		whichImage = 0;
	}

	if (document.all)
	{
		rotatingImage.filters.revealTrans.Transition = 7;
		rotatingImage.filters.revealTrans.stop();
		rotatingImage.filters.revealTrans.apply();
		document.images.rotatingImage.src = tornadoImages[whichImage];
		rotatingImage.filters.revealTrans.play()

		document.getElementById("tornadoes").innerHTML = captionFont + tornadoCaptions[whichImage] +
								 creditFont + tornadoCredits[whichImage];
	}
}

/*****************************************************************************************/
/** Change the image and caption on the flood page.										**/
/*****************************************************************************************/
function floodSlideShow()
{
	whichImage++;
	if (whichImage >= floodImages.length)
	{
		whichImage = 0;
	}

	if (document.all)
	{
		rotatingImage.filters.revealTrans.Transition = 7;
		rotatingImage.filters.revealTrans.stop();
		rotatingImage.filters.revealTrans.apply();
		document.images.rotatingImage.src = floodImages[whichImage];
		rotatingImage.filters.revealTrans.play()

		document.getElementById("floods").innerHTML = captionFont + floodCaptions[whichImage] +
		  					      creditFont + floodCredits[whichImage];
	}
}

/*****************************************************************************************/
/** Change the image and caption on the lightning page.									**/
/*****************************************************************************************/
function lightningSlideShow()
{
	whichImage++;
	if (whichImage >= lightningImages.length)
	{
		whichImage = 0;
	}

	if (document.all)
	{
		rotatingImage.filters.revealTrans.Transition = 7;
		rotatingImage.filters.revealTrans.stop();
		rotatingImage.filters.revealTrans.apply();
		document.images.rotatingImage.src = lightningImages[whichImage];
		rotatingImage.filters.revealTrans.play()

		document.getElementById("lightning").innerHTML = captionFont + lightningCaptions[whichImage] +
								 creditFont + lightningCredits[whichImage];
	}
}

/*****************************************************************************************/
/** Change the image and caption on the thunderstorm page.										**/
/*****************************************************************************************/
function thunderstormSlideShow()
{
	whichImage++;
	if (whichImage >= thunderstormImages.length)
	{
		whichImage = 0;
	}

	if (document.all)
	{
		rotatingImage.filters.revealTrans.Transition = 7;
		rotatingImage.filters.revealTrans.stop();
		rotatingImage.filters.revealTrans.apply();
		document.images.rotatingImage.src = thunderstormImages[whichImage];
		rotatingImage.filters.revealTrans.play()

		document.getElementById("thunderstorm").innerHTML = captionFont + thunderstormCaptions[whichImage] +
													  creditFont + thunderstormCredits[whichImage];
	}
}

/*****************************************************************************************/
/** Determine which links to include at the footer of each page and display them.		**/
/*****************************************************************************************/
function linkFooter(pageNumber, linkClass)
{
	// Page number refers to the page not to include in the links.
	var links = '';

	links += '<div style="text-align: center; font-weight: bold; font-size:14px; ' +
						 'font-family: Times New Roman, Arial;">'
	links += '[ ';

	if (pageNumber != 0) links += '<a class=' + linkClass + ' href="index.html">Home</a> || ';
	if (pageNumber != 1) links += '<a class=' + linkClass + ' href="govmsg.html">Governors Msg</a> || ';
	if (pageNumber != 2) links += '<a class=' + linkClass + ' href="info.html">Safety Info</a> || ';
	if (pageNumber != 3) links += '<a class=' + linkClass + ' href="tornadoes.html">Tornadoes</a> || ';
	if (pageNumber != 4) links += '<a class=' + linkClass + ' href="lightning.html">Lightning</a> || ';
	if (pageNumber != 5) links += '<a class=' + linkClass + ' href="floods.html">Flooding</a> || ';
	if (pageNumber != 6) links += '<a class=' + linkClass + ' href="thunderstorms.html">Severe Thunderstorms</a> || ';
	if (pageNumber != 7) links += '<a class=' + linkClass + ' href="sponsors.html">McReady Partners</a> || ';

	if (pageNumber != 9)
	{
		if (pageNumber == 8)
		{
			links += '<a class=' + linkClass + ' href="mcreadygallery.html">McReady Gallery</a>';
		}
		else
		{
			links += '<a class=' + linkClass + ' href="mcreadygallery.html">McReady Gallery</a> || ';
		}
	}
	if (pageNumber != 8) links += '<a class=' + linkClass + ' href="findmcdonalds.html">Find a McDonald\'s</a>';

	links += ' ]';
	links += '<p>';
	//links += '<font style="font-size: 12px;">Webhosting provided by <a class=' + linkClass + ' href="http://www.inetmax.net">INETmax.net</a></font>';
	links += '</div>';
	document.write(links);
}

function showDescription(category)
{
	document.all.descriptionArea.innerHTML = descriptions[category];
}
