/**
    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, either version 2 of the License, or
    (at your option) any later version.

    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.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

	--------------------------------------------------------------------
	
	Simple banner rotator. Version: 1.4.0
	Download and support: http://www.spyka.net 
	(c) Copyright 2008, 2009 spyka Web Group
	

	For full documentation:  http://www.spyka.net/docs/simple-banner-rotator
	For support:			 http://www.spyka.net/forums


**/

//								EDIT FROM HERE
///////////////////////////////////////////////////////////////////////////////////

/**
		Script settings
**/

var settings = {
	
	'force_size':			1,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
	'img_width':			135,			//	width to resize all banners to, only takes effect if above is 1
	'img_height':			150, 			// 	height to resize all banners to, only takes effect if above is 1
	
	'refresh_time':			60000,			//	the seconds between refreshs of the banners - use 0 to disable
	'refresh_max':			100,				//	maximum number of refreshs on each page load
	
	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
											//  all the slots else the browser may freeze or give a stack overflow error
	
	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
											
	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
	
	'window': 				'_blank',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
	
	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
											//  There is no real reason to need to change this
}


/**
		Banners
**/
// banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
// if you're not using adlocations just leave it empty like '' as in the last example here
// to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000

var banners = [
//	new banner('Archives Photo Book', 'http://anglican.nb.ca/admin/archives/photo_book/photo_book.html', 'http://anglican.nb.ca/front_graphics/promo/church_photo_book.jpg', '01/01/2019', ''),
//	new banner('Fresh Expressions Visioning Day', 'http://anglican.nb.ca/calendar/view_entry.php?id=3150&date=20111126', 'http://anglican.nb.ca/front_graphics/promo/111126_fe_vision_day.jpg', '01/01/2012', ''),
	new banner('Anglican Communion Covenant', 'http://www.anglican.ca/about/acwg/', 'http://anglican.nb.ca/front_graphics/promo/anglican_covenant.jpg', '01/01/2013', ''),
	new banner('Green Church', 'http://egliseverte-greenchurch.ca/green/', 'http://anglican.nb.ca/front_graphics/promo/green_church.jpg', '01/01/2013', ''),
//	new banner('Leap for Faith', 'http://www.leapforfaith.org/', 'http://anglican.nb.ca/front_graphics/promo/leap_for_faith.jpg', '01/01/2019', ''),
//	new banner('International Anglican Family Network', 'http://www.iafn.net/', 'http://anglican.nb.ca/front_graphics/promo/iafn.jpg', '01/01/2019', ''),
	new banner('ACW Launching Out News', 'http://anglican.nb.ca/news/acw/newsletters/index.html', 'http://anglican.nb.ca/front_graphics/promo/acw_launching_out.jpg', '01/01/2019', ''),
	new banner('Lent 2012 Study Anglican Communion', 'http://www.aco.org/ministry/theological/bible/lent.cfm', 'http://anglican.nb.ca/front_graphics/promo/2012_lent_study.jpg', '01/01/2013', ''),
//	new banner('e-offering', 'http://anglican.nb.ca/synod/finance/e_offering/index.html', 'http://anglican.nb.ca/front_graphics/promo/e-offering.jpg', '01/01/2019', ''),	
//	new banner('E News Subscribe', 'http://anglican.nb.ca/e_news/', 'http://anglican.nb.ca/front_graphics/promo/enews_subscribe.jpg',	'01/01/2019', ''),
//	new banner('The Lords Offering', 'http://anglican.nb.ca/programs/stewardship/publications/the_lords_offering.html', 'http://anglican.nb.ca/front_graphics/promo/the_lords_offering.jpg',	'01/01/2012', ''),
//	new banner('Why Should We Give?', 'http://anglican.nb.ca/programs/stewardship/publications/why_should_we_give.html', 'http://anglican.nb.ca/front_graphics/promo/why_should_we_give.jpg',	'01/01/2012', ''),
//	new banner('Legacy Gifts',	'http://archive.anglican.ca/fm/giftplanning/','http://anglican.nb.ca/front_graphics/promo/legacy_gifts1.jpg', '01/01/2012', ''),
//	new banner('Gift Guide',	'http://giftsformission.anglican.ca/','http://anglican.nb.ca/front_graphics/promo/gift_guide3.jpg', '01/01/2013', ''),
	new banner('Share Fresh Expressions of Church',	'https://www.sharetheguide.org/','http://anglican.nb.ca/front_graphics/promo/share_fresh_expressions.jpg', '01/01/2013', ''),
//	new banner('Ministry Matters',	'http://www.ministrymatters.ca/current-issue/the-church-and-social-media/','http://anglican.nb.ca/front_graphics/promo/1012_ministry_matters.jpg', '01/04/2012', ''),	
//	new banner('CEP Online',	'http://cep.anglican.ca/','http://anglican.nb.ca/front_graphics/promo/cep_online.jpg', '01/01/2012', ''),
//	new banner('Anglicans at AST',	'http://youtu.be/a4sZtxKEXCQ','http://anglican.nb.ca/front_graphics/promo/anglicans_at_ast.jpg', '01/01/2012', ''),
//	new banner('Healthy Parishes',	'http://www.anglican.ca/faith/ministry/hp/','http://anglican.nb.ca/front_graphics/promo/healthy_parishes.jpg', '01/01/2012', ''),
//	new banner('Virtual Church School',	'http://www.anglican.ca/cn/resources/virtual-church-school/','http://anglican.nb.ca/front_graphics/promo/virtual_church_school.jpg', '01/01/2012', ''),
//	new banner('The Magnetic Church',	'http://www.magnetic-church.com/','http://anglican.nb.ca/front_graphics/promo/magnetic_church.jpg', '01/01/2012', ''),
//	new banner('Citizens with the Saints',	'http://anglican.nb.ca/bishop/citizens_with_the_saints/contents.html','http://anglican.nb.ca/front_graphics/promo/citizens_with_the_saints.jpg', '01/01/2012', ''),
//	new banner('Back to Church Sunday',	'http://anglican.nb.ca/calendar/view_entry.php?id=3109&date=20111127','http://anglican.nb.ca/front_graphics/promo/11_back_to_church.jpg', '01/01/2012', ''),
//	new banner('Anglican Signposts',	'http://www.aco.org/ministry/theological/signposts/english.cfm','http://anglican.nb.ca/front_graphics/promo/anglican_signposts.jpg', '01/01/2012', ''),	
//	new banner('The Story of our Hymns',	'http://www.ccel.org/ccel/ryden/hymnstory.toc.html','http://anglican.nb.ca/front_graphics/promo/story_of_our_hymns.jpg', '01/01/2011', ''),	
//	new banner('Gift Planning',	'http://www.anglican.ca/gifts/planned-giving','http://anglican.nb.ca/front_graphics/promo/gift_planning.jpg', '01/06/2012', ''),
//	new banner('Liturgical Principles',	'http://archive.anglican.ca/gs2010/wp-content/uploads/009e-Appendix-D-FWM-Liturgical-Principles-and-Agenda.pdf','http://anglican.nb.ca/front_graphics/promo/liturgical_principles.jpg', '01/01/2012', ''),
	new banner('Resources for Mission',	'http://www.anglican.ca/gifts/','http://anglican.nb.ca/front_graphics/promo/resources_for_mission.jpg', '01/01/2013', ''),
//	new banner('Camp Brookwood Memories', 'http://www.facebook.com/video/video.php?v=10150168735301551&oid=163056950377953&comments','http://anglican.nb.ca/front_graphics/promo/2010_brookwood_memories.jpg', '31/08/2012', ''),
//	new banner('Camp Medley',	'http://campmedley.ca/','http://anglican.nb.ca/front_graphics/promo/camp_medley2.jpg', '31/08/2012', ''),
//	new banner('Enrich Canada',	'http://www.enrichcanada.ca/','http://anglican.nb.ca/front_graphics/promo/enrich_canada.jpg', '31/08/2012', ''),	
//		new banner('AST Diploma in Youth Ministry',	'http://www.astheology.ns.ca/youthministry/index.htm','http://anglican.nb.ca/front_graphics/promo/ast_diploma_youth_ministry.jpg', '01/01/2012', ''),
//		new banner('AST 40th Anniversary',	'http://www.astheology.ns.ca','http://anglican.nb.ca/front_graphics/promo/ast_40.jpg', '01/01/2012', ''),
//	new banner('The Nicodemus Project',	'http://anglican.nb.ca/synod/council/nicodemus_project/index.html','http://anglican.nb.ca/front_graphics/promo/nicodemus_project.jpg', '01/01/2012', ''),
//	new banner('The Alban Institute',	'http://www.alban.org/','http://anglican.nb.ca/front_graphics/promo/alban_institute.jpg', '01/01/2012', ''),
	new banner('A Foundation for Life',	'http://anglican.nb.ca/programs/foundation_life/','http://anglican.nb.ca/front_graphics/promo/foundation_for_life2.jpg', '01/12/2013', ''),
	new banner('Stewardship Resources',	'http://anglican.nb.ca/programs/stewardship/','http://anglican.nb.ca/front_graphics/promo/stewardship_resources.jpg', '01/12/2013', ''),	
//	new banner('NB Anglican Cursillo',	'http://www3.nb.sympatico.ca/b/bbrittai/ultreya.htm','http://anglican.nb.ca/front_graphics/promo/nb_cursillo.jpg', '01/01/2012', ''),
	new banner('First Fruits Video',	'http://anglican.nb.ca/synod/council/nicodemus_project/first_fruits_video_2011/first_fruits_video.html','http://anglican.nb.ca/front_graphics/promo/first_fruits_video.jpg', '01/01/2013', ''),
//	new banner('Mission Shaped Church',	'http://www.churchofengland.org/document-library.aspx','http://anglican.nb.ca/front_graphics/promo/mission_shaped_church.jpg', '01/01/2012', ''),
	new banner('Fresh Expressions',	'http://www.freshexpressions.ca/about-fxc/','http://anglican.nb.ca/front_graphics/promo/fresh_expressions.jpg', '01/01/2013', ''),	
//	new banner('Lift Up Your Hearts',	'http://www.worship.ca/','http://anglican.nb.ca/front_graphics/promo/lift_up_your_hearts.jpg', '01/01/2012', ''),
//	new banner('KJV Anniversary', 'http://biblicalscholarship.com/400th.htm','http://anglican.nb.ca/front_graphics/promo/kjv_anniversary.jpg',	'12/12/2011', ''),
//	new banner('Catch the Buzz',	'http://www.youtube.com/watch?v=JacrWZxAhgE','http://anglican.nb.ca/front_graphics/promo/catch_the_buzz.jpg', '01/01/2012', ''),
//	new banner('Vision 2019',	'http://www.anglican.ca/v2019/','http://anglican.nb.ca/front_graphics/promo/vision_2019.jpg', '01/01/2012', ''),
//	new banner('The Anglican Digest',	'http://www.anglicandigest.org/','http://anglican.nb.ca/front_graphics/promo/anglican_digest.jpg', '01/01/2012', ''),
//	new banner('Natural Church Development', 'http://www.ncdcanada.com/','http://anglican.nb.ca/front_graphics/promo/ncd.jpg', '12/10/2011', ''),
	new banner('The Anglican Foundation', 'http://www.anglicanfoundation.org/','http://anglican.nb.ca/front_graphics/promo/anglican_foundation.jpg', '01/01/2013', ''),
//	new banner('The Anglican Foundation for Kids', 'http://news.anglican.ca/news/stories/2407?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+acc-news+%28Anglican+Church+of+Canada+News+Stories%29','http://anglican.nb.ca/front_graphics/promo/anglican_foundation_kids.jpg', '01/01/2012', '')
	
]

//         				There is no need to edit below here
///////////////////////////////////////////////////////////////////////////////////
var used=0;var location_counter=0;var refresh_counter=1;var map=new Array();function banner(a,b,c,d,e){this.name=a;this.url=b;this.image=c;this.date=d;this.active=1;this.oid=0;if(e!=''){this.loc=e}else{this.loc=settings.default_ad_loc}}function show_banners(a){location_counter=location_counter+1;if(a!=''&&a!=undefined){map[location_counter]=a}else{map[location_counter]=settings.default_ad_loc}var b='<div id="'+settings.location_prefix+location_counter+'" class="'+settings.location_class+'"></div>';document.write(b);display_banners(location_counter)}function display_banners(a){var b=new Array();if(a==''||!a||a<0){return}var c=banners.length;if((c==used)&&settings.duplicate_banners==0){return}for(i=0;i<(banners.length);i++){banners[i].oid=i;if((banners[i].loc==map[a])&&(banners[i].active==1)){b.push(banners[i])}}var d=Math.floor(Math.random()*b.length);var e=b[d];var f=(settings.force_size==1)?' width="'+settings.img_width+'" height="'+settings.img_height+'"':'';var g='<a href="'+e.url+'" title="'+e.name+'" target="'+settings.window+'"><img border="0" src="'+e.image+'"'+f+' alt="'+e.name+'" /></a>';var h=new Date();var j=e.date;j=j.split('/',3);var k=new Date();k.setFullYear(parseInt(j[2]),parseInt(j[1])-1,parseInt(j[0]));if((h<k)&&e.active==1){var l=document.getElementById(settings.location_prefix+a);if(l==null){alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!')}else{l.innerHTML=g;if(settings.duplicate_banners==0){banners[e.oid].active=0;used++}return}}else{display_banners(a)}return}function refresh_banners(){if((refresh_counter==settings.refresh_max)||settings.refresh_time<1){clearInterval(banner_refresh)}used=0;for(j=0;j<(banners.length);j++){banners[j].active=1}for(j=1;j<(location_counter+1);j++){display_banners(j)}refresh_counter++}var banner_refresh=window.setInterval(refresh_banners,settings.refresh_time);
