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':			300,			//	width to resize all banners to, only takes effect if above is 1
	'img_height':			205, 			// 	height to resize all banners to, only takes effect if above is 1
	
	'refresh_time':			10000,			//	the seconds between refreshs of the banners - use 0 to disable
	'refresh_max':			90000,				//	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 slot 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': 				'_self',		//	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
}


var banners = [
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=316','banners/scan0001.jpg','30/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=1638','banners/Paris_B_07(2).jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=39','banners/13.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=29','banners/3.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=27','banners/1.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=1359','banners/Boston_B_16_46.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=1594','banners/Chicago_C_02_58.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=1583','banners/Chicago_B_19_47.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=380','banners/india0024.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=377','banners/india0021.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=6','banners/travelphotography_1804_569293.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=178','banners/cinqua.jpg','10/04/2019','slot'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=171','banners/10(7).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=294','banners/1(22).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=92','banners/15(1).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=86','banners/9(3).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=1753','banners/New_Cuba_B_22_52.jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=49','banners/1(1).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=382','banners/spain0001.jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=223','banners/2(16).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=2169','banners/London_51.jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=253','banners/1(20).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=65','banners/2(2).jpg','10/04/2019','slot2'),
	new banner('Travel','http://www.travelphotography.net/photo.asp?ID=145','banners/7(8).jpg','10/04/2019','slot2')
]

function Preload(urls, onCompleteCallback) {
        var numLeft = this.numLeft = urls.length;
    
        function remove() {
            this.onload = this.onerror = this.onabort = null;
            numLeft--;
            if (numLeft === 0 && onCompleteCallback) {
                onCompleteCallback();
            }
        }
        for (var i=0, l=urls.length; i < l; i++) {
            var img = new Image;
            img.onload = img.onerror = img.onabort = remove;
            img.src = urls[i];
        }
}

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('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);


