var banners=new Array();
var bannerObj=null;
var rotate=new Array();
var rotateKey=0;
var timeOutInterval=8000; // about 4 seconds
var timeOut=null;
var preLoader = new Image();
banners[60] = {
	ID: 60,
	title: 'AR 5000',
	description: '',
	url: '/img/banners/60_ID_27_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[29] = {
	ID: 29,
	title: 'HOUSEHAM',
	description: '4000 Litre trailed',
	url: '/img/banners/29_banner_4000_side_1.jpg',
	position: {
		x: 300,
		y: 10	},
	link: ''
};
banners[84] = {
	ID: 84,
	title: 'Househam Sprint (ID65)',
	description: '',
	url: '/img/banners/84_ID65BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[108] = {
	ID: 108,
	title: 'Sprint (ID38)',
	description: '',
	url: '/img/banners/108_ID38-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[1] = {
	ID: 1,
	title: 'AR 6000 ',
	description: '',
	url: '/img/banners/1_air_ride_6000.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[57] = {
	ID: 57,
	title: 'AR 3000 spraying',
	description: '',
	url: '/img/banners/57_Banner_3000_spray_new_cab.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[16] = {
	ID: 16,
	title: 'Amenity',
	description: 'Caddy with Shroud',
	url: '/img/banners/16_Banner_Caddy_with_shroud_(2).jpg',
	position: {
		x: 20,
		y: 200	},
	link: '/en/product-range/amenity-sprayers/'
};
banners[92] = {
	ID: 92,
	title: 'AR3600 Spraying',
	description: '',
	url: '/img/banners/92_3600_spraying_(31)_ban.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[40] = {
	ID: 40,
	title: 'NEW CAB',
	description: '360 deg vision',
	url: '/img/banners/40_BAN_new_cab_spacious.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[51] = {
	ID: 51,
	title: '',
	description: '2500 Super Sprint',
	url: '/img/banners/51_BAN_S_Sprint_ID_10_.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[82] = {
	ID: 82,
	title: '',
	description: '',
	url: '/img/banners/82_ID_64_banner.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[70] = {
	ID: 70,
	title: 'Cotton Boss',
	description: '',
	url: '/img/banners/70_Cotton_Boss_BANNER_pic_with_car.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[67] = {
	ID: 67,
	title: 'Bateman (ID41)',
	description: '',
	url: '/img/banners/67_ID41_Ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[68] = {
	ID: 68,
	title: 'Housseham Sprint (ID42)',
	description: '',
	url: '/img/banners/68_ID42-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[85] = {
	ID: 85,
	title: '',
	description: '',
	url: '/img/banners/85_ID_66_side_banner.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[56] = {
	ID: 56,
	title: 'Pre owned 5000 lt',
	description: '',
	url: '/img/banners/56_BAN_5000_ID_5.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[120] = {
	ID: 120,
	title: 'Househam spraycare (ID98)',
	description: '',
	url: '/img/banners/120_ID98-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[103] = {
	ID: 103,
	title: 'AR3000 ID70',
	description: '',
	url: '/img/banners/103_ID70-ban2.jpg',
	position: {
		x: 407,
		y: 300	},
	link: ''
};
banners[110] = {
	ID: 110,
	title: 'AR3000(ID89)',
	description: '',
	url: '/img/banners/110_ID89-BAN3.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[101] = {
	ID: 101,
	title: 'ID74 Sprint',
	description: '',
	url: '/img/banners/101_ID74-ban-2.jpg',
	position: {
		x: 407,
		y: 300	},
	link: ''
};
banners[119] = {
	ID: 119,
	title: 'Househam Sprint ID97',
	description: '',
	url: '/img/banners/119_ID97-ban1.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[106] = {
	ID: 106,
	title: 'AR3600 ID86',
	description: '',
	url: '/img/banners/106_ID86-ban1.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[7] = {
	ID: 7,
	title: '',
	description: '',
	url: '/img/banners/7_IMG_9256.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[112] = {
	ID: 112,
	title: 'IMP(ID91)',
	description: '',
	url: '/img/banners/112_ID91-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[8] = {
	ID: 8,
	title: '',
	description: '',
	url: '/img/banners/8_2500cereals3.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[113] = {
	ID: 113,
	title: 'Househam Sprint  (ID93)',
	description: '',
	url: '/img/banners/113_ID93-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[90] = {
	ID: 90,
	title: 'ID70 AR3000',
	description: '',
	url: '/img/banners/90_ID70-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[97] = {
	ID: 97,
	title: 'ID63 AR300',
	description: '',
	url: '/img/banners/97_ID63-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[55] = {
	ID: 55,
	title: '3000 Trailed',
	description: '',
	url: '/img/banners/55_BAN_Trailed_ID23.jpg',
	position: {
		x: 20,
		y: 20	},
	link: ''
};
banners[2] = {
	ID: 2,
	title: 'Househam Quality',
	description: '',
	url: '/img/banners/2_sprayer.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[121] = {
	ID: 121,
	title: 'ID64 Super sprint',
	description: '',
	url: '/img/banners/121_ID64-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[3] = {
	ID: 3,
	title: '',
	description: '',
	url: '/img/banners/3_ar5000.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[5] = {
	ID: 5,
	title: 'AR 4000',
	description: '',
	url: '/img/banners/5_banner_4000_side.jpg',
	position: {
		x: 20,
		y: 20	},
	link: ''
};
banners[69] = {
	ID: 69,
	title: 'AR3000 (ID40)',
	description: '',
	url: '/img/banners/69_ID40ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[44] = {
	ID: 44,
	title: 'Team Sprayer 600L',
	description: '',
	url: '/img/banners/44_team_sprayer_600l.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[87] = {
	ID: 87,
	title: 'ID 68 Super Sprint',
	description: '',
	url: '/img/banners/87_ID_68_near_side_BANNER.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[73] = {
	ID: 73,
	title: 'AR2500',
	description: '',
	url: '/img/banners/73_ID_49_2500_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[94] = {
	ID: 94,
	title: 'AR 4000 New Cab',
	description: '',
	url: '/img/banners/94_4000_painted_BAN.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[100] = {
	ID: 100,
	title: 'ID73 Sprint',
	description: '',
	url: '/img/banners/100_ID73-ban.jpg',
	position: {
		x: 407,
		y: 300	},
	link: ''
};
banners[9] = {
	ID: 9,
	title: 'Head and shoulders above the rest',
	description: '',
	url: '/img/banners/9_IMG_9440.jpg',
	position: {
		x: 20,
		y: 180	},
	link: ''
};
banners[23] = {
	ID: 23,
	title: '',
	description: 'Versatility. AR5000 sprayer to spreader.',
	url: '/img/banners/23_Banner_bredal_spreader.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[78] = {
	ID: 78,
	title: 'ID53 AR3000',
	description: '',
	url: '/img/banners/78_ID_53_BANNER.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[61] = {
	ID: 61,
	title: 'Super Sprint',
	description: '',
	url: '/img/banners/61_ID_35_BAN_boom.jpg',
	position: {
		x: 20,
		y: 20	},
	link: ''
};
banners[114] = {
	ID: 114,
	title: 'Househam AR3000 ID95',
	description: '',
	url: '/img/banners/114_ID95-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[63] = {
	ID: 63,
	title: 'SERVICE',
	description: 'Nationwide engineers',
	url: '/img/banners/63_service_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[88] = {
	ID: 88,
	title: '',
	description: '',
	url: '/img/banners/88_',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[107] = {
	ID: 107,
	title: 'AR3000 ID85',
	description: '',
	url: '/img/banners/107_ID85-BAN-1.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[126] = {
	ID: 126,
	title: 'Househam Sprint ID102 ',
	description: '',
	url: '/img/banners/126_ID102-ban-1.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[49] = {
	ID: 49,
	title: 'Sprint',
	description: 'Popular 3000 lt',
	url: '/img/banners/49_Banner_Sprint_18.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[91] = {
	ID: 91,
	title: 'AR3600',
	description: '',
	url: '/img/banners/91_3600_spraying_(34)_ban.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[89] = {
	ID: 89,
	title: 'ID69 AR3000',
	description: '',
	url: '/img/banners/89_ID69_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[15] = {
	ID: 15,
	title: 'HOUSEHAM SPRAYERS',
	description: 'No 1 for self propelled sprayers',
	url: '/img/banners/15_2500cerealscropped.jpg',
	position: {
		x: 470,
		y: 300	},
	link: 'www.tjs.co.uk'
};
banners[18] = {
	ID: 18,
	title: 'Fastrac Multi-Drive Sprayers',
	description: 'Versatile Fastrac on JCB',
	url: '/img/banners/18_banner_fastrac.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[10] = {
	ID: 10,
	title: 'Industry Leading Expertise   ',
	description: '',
	url: '/img/banners/10_team.jpg',
	position: {
		x: 470,
		y: 300	},
	link: '/en//about-us.htm'
};
banners[6] = {
	ID: 6,
	title: '',
	description: '',
	url: '/img/banners/6_3000chassis.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[32] = {
	ID: 32,
	title: 'AR3000 Super Sprint',
	description: 'AR3000 Super Sprint',
	url: '/img/banners/32_ar3000_supersprint.jpg',
	position: {
		x: 470,
		y: 300	},
	link: 'http://househam.tjs.co.uk/en/product-range/self-propelled-sprayers/ar3000.htm'
};
banners[76] = {
	ID: 76,
	title: '',
	description: '',
	url: '/img/banners/76_ID_51_side_BANNER.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[4] = {
	ID: 4,
	title: 'Househam Trailed Sprayers',
	description: '',
	url: '/img/banners/4_banner_4000_side_1.jpg',
	position: {
		x: 479,
		y: 300	},
	link: ''
};
banners[99] = {
	ID: 99,
	title: 'ID61 AR3000',
	description: '',
	url: '/img/banners/99_ID61-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[26] = {
	ID: 26,
	title: 'ME Range',
	description: '',
	url: '/img/banners/26_banner_ME_boom_out_2.jpg',
	position: {
		x: 470,
		y: 260	},
	link: ''
};
banners[83] = {
	ID: 83,
	title: '',
	description: '',
	url: '/img/banners/83_',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[109] = {
	ID: 109,
	title: 'AR3000 (ID79)',
	description: '',
	url: '/img/banners/109_ID79-BAN-1.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[104] = {
	ID: 104,
	title: '1200 Mounted',
	description: '',
	url: '/img/banners/104_Mounted_120020_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[38] = {
	ID: 38,
	title: 'HOUSEHAM TRAILED',
	description: '',
	url: '/img/banners/38_Banner_4000_trailed_side.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[93] = {
	ID: 93,
	title: 'High Clearance',
	description: '',
	url: '/img/banners/93_high_clear_banner.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[53] = {
	ID: 53,
	title: 'Pre-owned AR 2500',
	description: '',
	url: '/img/banners/53_BAN_AR_2500_ID_1_main.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[31] = {
	ID: 31,
	title: 'AR 4000',
	description: '',
	url: '/img/banners/31_banner_4000_booms_out.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[102] = {
	ID: 102,
	title: 'AR3000 ID75',
	description: '',
	url: '/img/banners/102_ID75-ban.jpg',
	position: {
		x: 407,
		y: 300	},
	link: ''
};
banners[72] = {
	ID: 72,
	title: 'Househam Super Sprint',
	description: '',
	url: '/img/banners/72_ID35-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[11] = {
	ID: 11,
	title: '',
	description: '',
	url: '/img/banners/11_strawb1_1.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[74] = {
	ID: 74,
	title: 'ID 40 AR3000',
	description: '',
	url: '/img/banners/74_ID_40_SAIDE_main_shot_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[86] = {
	ID: 86,
	title: 'L reg Chafer',
	description: '',
	url: '/img/banners/86_ID_66_side_banner.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[27] = {
	ID: 27,
	title: 'MOUNTED SPRAYERS',
	description: 'SE Independant',
	url: '/img/banners/27_banner_SE_i_X_fold_rear.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[52] = {
	ID: 52,
	title: '',
	description: '',
	url: '/img/banners/52_BAN_S_sprint_ID_3.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[25] = {
	ID: 25,
	title: '',
	description: '',
	url: '/img/banners/25_banner_midget.jpg',
	position: {
		x: 400,
		y: 40	},
	link: ''
};
banners[59] = {
	ID: 59,
	title: 'AR 3000',
	description: '',
	url: '/img/banners/59_ID_31_3000_ex_Bagent_BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[39] = {
	ID: 39,
	title: 'HOUSEHAM &quot;M&quot; TRAILED',
	description: '',
	url: '/img/banners/39_Banner_M_Euro_sprayer.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[105] = {
	ID: 105,
	title: 'AR3600 ID72',
	description: '',
	url: '/img/banners/105_ID72-os-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[22] = {
	ID: 22,
	title: 'Mounted Sprayers',
	description: '',
	url: '/img/banners/22_club_belton2.jpg',
	position: {
		x: 470,
		y: 300	},
	link: '/en/product-range/mounted-sprayers/'
};
banners[124] = {
	ID: 124,
	title: '',
	description: '',
	url: '/img/banners/124_',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[77] = {
	ID: 77,
	title: 'ID52 2000lt',
	description: '',
	url: '/img/banners/77_ID_52_BANNER_picnik.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[80] = {
	ID: 80,
	title: '',
	description: '',
	url: '/img/banners/80_',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[96] = {
	ID: 96,
	title: 'Quality Used Machines',
	description: '',
	url: '/img/banners/96_Quality_used_Banner.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[47] = {
	ID: 47,
	title: 'Pre-owned',
	description: '2500 Self Propelled',
	url: '/img/banners/47_BAN_25_x_RNT.jpg',
	position: {
		x: 20,
		y: 240	},
	link: ''
};
banners[34] = {
	ID: 34,
	title: 'Pre-owned sprayers',
	description: '',
	url: '/img/banners/34_2500cerealscropped.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[42] = {
	ID: 42,
	title: 'PRE-OWNED',
	description: 'After refurbishment',
	url: '/img/banners/42_Ban_befor_after_2.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[122] = {
	ID: 122,
	title: 'Househam TR3000(ID100)',
	description: '',
	url: '/img/banners/122_ID100-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[81] = {
	ID: 81,
	title: 'AR3000ID(62)',
	description: '',
	url: '/img/banners/81_ID-62-Ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[111] = {
	ID: 111,
	title: 'AR3000(ID84)',
	description: '',
	url: '/img/banners/111_ID84-BAN.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[116] = {
	ID: 116,
	title: 'Househam AR3000 ID96',
	description: '',
	url: '/img/banners/116_ID96-ban.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};
banners[33] = {
	ID: 33,
	title: 'Pre-owned',
	description: 'Well presented pre-owned sprayers',
	url: '/img/banners/33_banner_used_3000.jpg',
	position: {
		x: 40,
		y: 40	},
	link: ''
};
banners[12] = {
	ID: 12,
	title: 'SELF PROPELLED',
	description: 'Versatility',
	url: '/img/banners/12_Spreader-on-3.jpg',
	position: {
		x: 470,
		y: 300	},
	link: ''
};


function bannerInit()
{
	if(bannerConfig['rotate']==false) return;
	
	bannerCount=0;
	for(key in banners) {
		if (bannerConfig['start']==key) {
			var startingBanner = banners[key];
		}
		else if( (bannerConfig['chosen_banners'].length==0 || key in oc(bannerConfig['chosen_banners']))
		){
			rotate[bannerCount] = banners[key];
			bannerCount ++;
		}
	}
	
	// Add the starting banner to the end of the rotate array
	rotate[bannerCount] = startingBanner;
	
	// Fetch the div#banner object
	bannerObj = document.getElementById('banner');
	
	// Preload the next image
	preLoader.src=rotate[rotateKey].url;
	
	// Initalise the banner rotation
	if(rotate.length>1) {
		timeOut = setTimeout('bannerRotate()', timeOutInterval);
	}
}


/**
 * Object Converter
 * Converts an Array into an Object
 */
function oc(a) {
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}


/**
 * Rotates the banner image
 */
function bannerRotate() {
	var banner=rotate[rotateKey];
	
	var html = '<div style="top:'+banner.position.y+'px;left:'+banner.position.x+'px">';
	
	if(banner.link != '') {
		html += '<span><a href="'+banner.link+'">'+banner.title+'</a></span>';
		html += '<p><a href="'+banner.link+'">'+banner.description+'</a></p>';
	}
	else {
		html += '<span>'+banner.title+'</span>';
		html += '<p>'+banner.description+'</p>';
	}
	
	bannerObj.innerHTML = html + '</div>';
	
	bannerObj.style.backgroundImage='url(\''+banner.url+'\')';
	
	rotateKey++;	
	if(rotateKey>=rotate.length) { rotateKey=0; }
	
	// Preload the next image
	preLoader.src=rotate[rotateKey].url;
	
	clearTimeout(timeOut);
	timeOut=setTimeout('bannerRotate()', timeOutInterval);
} // end func bannerRotate