// Java Document
///////////////////////////////////////////////////////////
/// Magic Image Rotation ///
/// v 1.0.1 ///
/// Copyright 2007, Loyce Bradley Petrey ///
/// All Rights Reserved. ///
/// http://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.mauriprosailing.com/','http://www.mauriprosailing.com/images/Advertising/Sailing-Anarchy/Home-Banner.jpg',''],
	['http://www.nznonskid.com/','/ADs/kiwigrip/index_center.jpg',''],
	['http://www.farrdesign.com/FYS/listings_grandprix.html','/ADs/farr/index_center_farr.jpg',''],
	['http://www.pureyachting.com/','/ADs/pure_yachting/index_center.jpg',''],
	['http://www.aquilasailingyachts.com/','/ADs/aquila_sailing/index_center.jpg',''],
	['http://evolutionsails.com/sa-oct-09-join-the-revolution.php','/ADs/evolution_sails/index_center.jpg',''],
	['http://www.mauriprosailing.com/','http://www.mauriprosailing.com/images/Advertising/Sailing-Anarchy/Home-Banner.jpg',''],
	['http://www.doylestratis.com','/ADs/doyle/index_center.gif',''],
	['http://www.mcconaghyweb.com/m38/','/ADs/mcconaghy/index_center.jpg',''],
	['http://vxonedesignracing.com/vxodr/','/ADs/vx_onedesign/index_center.jpg',''],
	['http://goetzboats.com//','/ADs/goetz/index_center.jpg','']
	/*
	['http://www.liveskipper.com/perth2011/?origin=SailingAnarchy','/ADs/liveskipper/index_center_liveskipper.jpg',''],
	['http://www.velasailingsupply.com/','/ADs/vela/index_center_vela.jpg',''],	
	['http://www.corsairmarine.com/article/press-release/great-boat-year-sale','/ADs/corsair/index_center.jpg',''],
	['http://www.adrena.fr/en/HOME.html','/ADs/adrena/index_center.jpg',''],
	['http://www.thoroughbredyachtsales.com','/ADs/thoroughbred _ys/index_center.jpg',''],
	['http://www.mauriprosailing.com/?gad=CJ-9pI4CEgi0_U8E8POhnhj79dL-AyCf1a8R','/ADs/mauri pro/index_center.jpg',''],
	['http://www.medcup.org/','/ADs/audi_medcup/index_center.gif',''],
['http://catalogs.westmarine.com/WebProject.asp?CodeId=7.4.4.6&BookCode=sai11flx&PageLabel=0#','/ADs/west_marine/index_center.jpg',''],
	['http://www.beneteaucountdown.com/','/ADs/beneteau/index_center_beneteau.jpg',''],
	['http://www.columbiayachts.com/columbia32LP.php','/ADs/columbia/index_center_columbia.jpg',''],
	['http://www.sydneyyachts.com/','/ADs/sydney_yachts/index_center.jpg',''],
	['http://www.beneteaucountdown.com/','/ADs/beneteau/index_center_beneteau.jpg','']
	['http://www.heinekenregatta.com/','/ADs/heineken/index_center.jpg','']
	['http://glowfast.com/home.php?cat=274','/ADs/glowfast/index_center_glowfast.jpg',''],*/
];
/*
['URL to linked page', 'URL to image', 'Caption under picture']
['http://www.vplp.fr/news/','/ADs/vplp/index_center.jpg',''],
The caption is not required and may be left blank like this: ['URL to linked page', 'URL to image', '']
Add as many images as you like seperated by commmas
Almost ALL errors are caused by the url or path being wrong
The LAST image declaration does NOT have a comma after it
*/


var ImageCount = 11; // ***** Change this to the total number of images loaded above ***** //
var ImageDelay = 6000; // ***** 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 //


// This function rotates the banner //
function ImageChange()
{

if (FirstLoad == 0) // Determins if this is the first time function has run. //
{
PickFirstRun();
}

htmlString = '<center>';
htmlString = htmlString + '<font face = "Verdana" size="2">'; // Font and Font Size for caption may be changed here //
htmlString = htmlString +'<a target="';
htmlString = htmlString + LinkTarget;
htmlString = htmlString + '" href="';
htmlString = htmlString + ImageLoad[ImageIndex][0];
htmlString = htmlString + '"><img border="0" src="'; // Image border size may be changed here //
htmlString = htmlString + ImageLoad[ImageIndex][1];
htmlString = htmlString + '"></a><br>';
htmlString = htmlString + ImageLoad[ImageIndex][2];
htmlString = htmlString + '</font>';
htmlString = htmlString + '</center>';

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

if (ImageIndex == ImageCount - 1) // This statement increments image displayed and resets if displaying last image //
{
ImageIndex= 0;
}
else
{
ImageIndex++;
}

if (FirstLoad == 0) // Determins if this is the first time function has run. //
{
SlowFinish();
}

}
// End Funtion //


// On first display select a random image of above array, then proceed in
// the order defined in above array

function PickFirstRun()
{
var first = Math.random() * ImageCount;
first = Math.floor(first);
// alert (first); // Uncomment for testing (displays random ID)
ImageIndex = first;
}

// End function


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

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

QuickStart();
