///////////////////////////////////////////////////////////
/// Magic Image Rotation v 1.0.1						///
/// Copyright 2007, Loyce Bradley Petrey				///
///	All Rights Reserved. www.EchoChrist.com/MagicImage	///
/// webmaster@EchoChrist.com							///
///														///
///	This script is free to use as long as this notice remains unchanged and intact.					 	///
///														///
/// This program is free software: you can redistribute it and/or modify it under the terms of the GNU 		///
///	General Public License as published by the Free Software Foundation. 								///
///														///
/// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 	///
///	even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  					///
/// 													///
/// Be Imitators of God as dear children and walk in love as Christ also loved us.					///
///	Ephesians 5:1-2										///
///////////////////////////////////////////////////////////

var ImageLoad = 
[
['http://www.atlanticmotorcar.com', 'banner_pics/rotating/atlanticmotor.jpg', 'Rotating.Atlantic_Motor'],
['http://www.moretolifecampground.com', 'banner_pics/rotating/balat.jpg', 'Rotating.Balat'], 
['http://www.theberean.org', 'banner_pics/rotating/berean.jpg', 'Rotating.Berean'],
['mailto:camp@berea4u.org', 'banner_pics/rotating/campberea.jpg', 'Rotating.Camp_Berea'],
['mailto:davidmurray@wbci.fm', 'banner_pics/rotating/davidmurray.jpg', 'Rotating.David_Murray'], 
['mailto:wendypelletier@gmail.com', 'banner_pics/rotating/eagle.jpg', 'Rotating.Eagle'],
['mailto:JustRight@tds.net', 'banner_pics/rotating/justright.jpg', 'Rotating.Just_Right'],
['http://www.lazboyfurnituregalleries.com', 'banner_pics/rotating/lazboy.jpg', 'Rotating.La-Z-Boy'], 
['mailto:lighthouse_bookstore@hotmail.com', 'banner_pics/rotating/lighthousebible.jpg', 'Rotating.Lighthouse_Bible'],
['http://midcoastyp.com/profile.do?listingId=2264926&city=Lincolnville', 'banner_pics/rotating/chimney.jpg', 'Rotating.Maine_Chimney'],
['http://www.monroefinancial.com', 'banner_pics/rotating/kevinmonroe.jpg', 'Rotating.Kevin_Monroe'], 
['http://www.www.moretolifecampground.com', 'banner_pics/rotating/morelife.jpg', 'Rotating.More_To_Life'],
['http://www.nebc.edu', 'banner_pics/rotating/nebc.jpg', 'Rotating.NEBC'],
['http://www.tbctopsham.com', 'banner_pics/rotating/reformers.jpg', 'Rotating.Reformers'],
['http://www.seasidepavilion.org', 'banner_pics/rotating/oobpavilion.jpg', 'Rotating.Seaside_Pavilion'], 
['http://www.stillwaterboarding.com', 'banner_pics/rotating/stillwater.jpg', 'Rotating.Stillwater'], 
['http://www.thegreatimpasta.com', 'banner_pics/rotating/impasta.jpg', 'Rotating.Impasta'],
['', 'banner_pics/rotating/opendoor.jpg', 'Rotating.Open_Door'],
['http://therootcellar.stinpen.com', 'banner_pics/rotating/rootcellar.jpg', 'Rotating.Root_Cellar'],
['mailto:dawn.shirttales@gmail.com', 'banner_pics/rotating/shirttales.jpg', 'Rotating.Shirt_Tales'],
['', 'banner_pics/rotating/wiltonprinted.jpg', 'Rotating.Wilton_Printed'],
['mailto:jwtransformationcounseling@gmail.com', 'banner_pics/rotating/transformation.jpg', 'Rotating.TransCouns'],
['http://www.insphereis.com', 'banner_pics/rotating/insphere.jpg', 'Rotating.InSphere'],
['http://www.christianmaineguideservice.org', 'banner_pics/rotating/christianguide.jpg', 'Rotating.Christian_Guides'] 
];

var ImageCount		= 24;			//  Change this to the total number of images loaded above  	//	
var ImageDelay		= 6500;		//  Set this to the delay interval desired.  5000 = 5 seconds.	// 
var LinkTarget		= "_blank"		//  Defines where you want linked page to open. _self, _blank, _top, etc	//
var ImageIndex		= 0;			//  DO NOT ALTER	//
var FirstLoad 		= 0;			//  DO NOT ALTER	//
var QuickStartID 	= 0;  			//  DO NOT ALTER	//
var htmlString 		= ""			//  DO NOT ALTER 	//
var randomnumber	= 0;			//  DO NOT ALTER	//

ImageIndex = Math.floor(Math.random()*ImageCount);																				

function ImageChange()

{
	htmlString = '<center>';
	htmlString = htmlString +'<a target="';
	htmlString = htmlString + LinkTarget;
	htmlString = htmlString + '" href="';
	htmlString = htmlString + ImageLoad[ImageIndex][0];
	htmlString = htmlString + '" onClick="javascript: page_tracker._trackPageview (\'/bannerads/rotating/';
	htmlString = htmlString + ImageLoad[ImageIndex][2];
	htmlString = htmlString + '\');"><img border="0" src="';
	htmlString = htmlString + ImageLoad[ImageIndex][1];
	htmlString = htmlString + '"></a><br>';
	htmlString = htmlString + '</center>';

	document.getElementById('MagicImage').innerHTML = htmlString;

	if(ImageIndex == ImageCount - 1)
	{
		ImageIndex= 0;
	} else {
		ImageIndex++;
	}

	if(FirstLoad == 0) 
	{
		SlowFinish();
	}

}

//  This function ensures first banner is displayted without a delay  //
function  QuickStart()
{
	QuickStartID=setInterval("ImageChange()", 1000);
}

//  This function sets display rate to user defined speed  //
function SlowFinish()
{
	clearInterval(QuickStartID);
	FirstLoad = 1;
	setInterval("ImageChange()", ImageDelay);
}

QuickStart()
