﻿var banDelay = 6000; // display for 6.000 seconds each
var banners = {
bannerAd : [
		'<a href=""><img src="/home/images/banners/2010Generic01nw.png" alt=""></a>',
		'<a href="/home/events.html"><img src="/home/images/banners/2011_BibleConf01.png" alt=""></a>',
		'<a href="/home/events.html"><img src="/home/images/banners/2011_BibleConf02.png" alt=""></a>',
		'<a href="/home/events.html"><img src="/home/images/banners/2011_BibleConf03.png" alt=""></a>',
		'<a href="/home/events.html"><img src="/home/images/banners/2011_BibleConf04.png" alt=""></a>',
],
bannerTop : [
		'<a href="http://heart4jesus.com/"><img src="/home/images/main/SermonSeries04-30-11c.png" title="Sermon Series: God has an App for That" alt="Sermon Series: God has an App for That"></a>',
],
bannerMid : [
		'<a href="/home/downloads/HelpJoplinMO_rev2.pdf" target="_blank"><img src="/home/images/main/JoplinDisaster05-25-11.png" title="Disaster Relief: Want to Help Joplin, MO? Click to download flyer" alt="Disaster Relief: Want to Help Joplin, MO? Click to download flyer"></a>',
],
bannerBot : [
		'<a href="/home/events.html"><img src="/home/images/main/VBS_06-13-11.png" title="VBSC: June 13th - 16th, 9am - 12 noon, 4yrs. old to 6th grade" alt="VBSC: June 13th - 16th, 9am - 12 noon, 4yrs. old to 6th grade"></a>',
]
};

// Banner Rotator
// copyright 12th October 2009 by Stephen Chapman
// http://javascript.about.com
// permission to use this Javascript on your web page is granted
// provided that all of the code below in this script (including these
// comments) is used without any alteration
var banimg = []; for (x in banners) {for (var i=banners[x].length-1; i >= 0; i--) {var b = banners[x][i].match(/<img.+?src=['"](.*?)['"]/);if (b) banimg.push(b[1]);}} for (var i = banimg.length - 1; i >= 0; i--) {var h = new Image(); h.src = banimg[i];}
function randOrd(){return (Math.round(Math.random())-0.5); }
var banlist = [];function Ban(b) {this.loc = document.getElementById(b);this.ary = banners[b];this.ary.sort(randOrd);this.cnt = -1;banlist.push(this);}function rotateBan() {for (var j = banlist.length - 1; j >= 0; j--) {var max = banlist[j].ary.length;banlist[j].cnt++;if (banlist[j].cnt >= max) banlist[j].cnt = 0;banlist[j].loc.innerHTML = banlist[j].ary[banlist[j].cnt];}setTimeout(rotateBan,banDelay);} function startBanner() {for (x in banners) {if (document.getElementById(x)) new Ban(x);} rotateBan();} 

window.onload = startBanner;

