		var database = { 
			"tariffs" : [
					{"id": "Price Group A", "days1": "60", "days2": "110", "days3": "150", "days4": "180", "days5": "200", "days6": "210", "days7": "220"},
					{"id": "Price Group B", "days1": "90", "days2": "170", "days3": "250", "days4": "315", "days5": "365", "days6": "405", "days7": "435"},
					{"id": "Price Group C", "days1": "100", "days2": "190", "days3": "280", "days4": "355", "days5": "415", "days6": "465", "days7": "505"},
					{"id": "Price Group D", "days1": "120", "days2": "220", "days3": "320", "days4": "410", "days5": "490", "days6": "560", "days7": "620"},
					{"id": "Price Group E", "days1": "140", "days2": "270", "days3": "390", "days4": "500", "days5": "600", "days6": "690", "days7": "780"}
			],
		  "bikes": 	[
{"id": "Bike001","tariff": "Price Group A", "manufacturer": "Suzuki", "category": "125's", "name":"GN125 ","size": "125", "neworused": "", "hire": "Y", "image": "", "smallImage": "", "price": "", "longDescription": "Available for training school pupils"},
{"id": "Bike002","tariff": "Price Group C", "manufacturer": "Suzuki", "category": "Sportsbikes", "name":"GSXR750 ","size": "750", "neworused": "", "hire": "Y", "image": "", "smallImage": "", "price": "", "longDescription": "Due in to TT Bike Centre in April 2009 - 2009 GSXR750 in traditional blue and white."},
{"id": "Bike003","tariff": "Price Group B", "manufacturer": "BMW", "category": "All Rounders", "name":"F650GS ","size": "650", "neworused": "", "hire": "Y", "image": "H_F650GS.jpg", "smallImage": "", "price": "", "longDescription": "BMW's all rounder does exactly what it says on the tin.  Motorways to tight country lanes, this bike will handle it all.  Our F650 is factory lowered which makes the riding position even easier!  This beemer offers relaxed, steady, quality assured riding."},
{"id": "Bike004","tariff": "Price Group B", "manufacturer": "Kawasaki", "category": "All Rounders", "name":"ER6F ","size": "650", "neworused": "", "hire": "Y", "image": "H_kawa_small.jpg", "smallImage": "", "price": "", "longDescription": "A real hybrid sports/town bike.  Arguably the black sheep of our hire fleet, but once ridden, it has guaranteed grin factor.  The 650cc 4stroke parallel twin provides plenty of torque in all gears, whilst only carring its 178kg means great handling, especially around the real twisty stuff.  The ER6 is a great fun ride."},
{"id": "Bike005","tariff": "Price Group B", "manufacturer": "Kawasaki", "category": "All Rounders", "name":"ER5 ","size": "500", "neworused": "", "hire": "Y", "image": "", "smallImage": "", "price": "", "longDescription": "Not just a training bike, but a great everyday commuter/town ride as well.  The ER5 provides a very easy riding style and low seating position making this an accessible and enjoyable ride."},
{"id": "Bike006","tariff": "Price Group C", "manufacturer": "Suzuki", "category": "All Rounders", "name":"Bandit ","size": "1250", "neworused": "", "hire": "Y", "image": "H_bandit.jpg", "smallImage": "", "price": "", "longDescription": "Relaxed and easy.  Effortless day-long riding in a comfortable position.  Great smooth power, even two up with luggage.  Be it a day, weekend or a longer tour on a bike without foibles, then this is the machine.  Available with any combination of panniers and top box."},
{"id": "Bike007","tariff": "Price Group C", "manufacturer": "Honda", "category": "Sportsbikes", "name":"Fireblade ","size": "1000", "neworused": "", "hire": "Y", "image": "H_blade08.jpg", "smallImage": "", "price": "", "longDescription": "Honda have done it again!  Difficult to fault this bike in any category.  Maybe not gut wrenching until halfway through the powerband, but clearly a superbike to enjoy everyday, anywhere, whatever the weather, whatever the road conditions, this is a superbike that will be better than your riding!"},
{"id": "Bike008","tariff": "Price Group C", "manufacturer": "Yamaha", "category": "Sportsbikes", "name":"R1 ","size": "1000", "neworused": "", "hire": "Y", "image": "H_R1_very_small.jpg", "smallImage": "", "price": "", "longDescription": "The bike that took Nick Sanders on his record-breaking round the world trip.  Well, not this actual machine!  But the R1 does most things with consumate ease, and quickly!  More focused than a Blade, less ballistic than a GSX-R1000, but altogether a great bike for outright fun in the litre superbike class. "},
{"id": "Bike009","tariff": "Price Group C", "manufacturer": "Suzuki", "category": "Sportsbikes", "name":"GSXR1000 ","size": "1000", "neworused": "", "hire": "Y", "image": "H_gsxr1000.jpg", "smallImage": "", "price": "", "longDescription": "The bike that arguably started the new breed of litre superbikes. Balance, power, awesome handling.  The K6, at an incredible 166kg remains one of the lightest bikes in its class.  An easy, balanced bike to ride, incredibly smooth, but with ballistic power."},
{"id": "Bike010","tariff": "Price Group C", "manufacturer": "Aprilia", "category": "Sportsbikes", "name":"RSV1000R ","size": "1000", "neworused": "", "hire": "Y", "image": "H_aprilia_small.jpg", "smallImage": "", "price": "", "longDescription": "A big V-twin exotic piece of Italian engineering that demands just that little extra respect.  This is a tall bike that needs to be physically ridden to enjoy the best it offers.  A great choice away from a Japanese four, the Aprilia guarantees excitement, with a kick like a mule out of any corner and engine breaking that will stop you in your tracks!"},
{"id": "Bike011","tariff": "Price Group D", "manufacturer": "KTM", "category": "Sportsbikes", "name":"RC8 ","size": "1150", "neworused": "", "hire": "Y", "image": "H_RC8.jpg", "smallImage": "", "price": "H_RC8_small.jpg", "longDescription": "This AMAZING bike is available for hire!  You might be able to test ride one somewhere, but we are the ONLY people to have this incredible machine for hire!  As near to a prototype track bike you can get for under silly money!  Similar to the SP2 but feels like riding a rocketship with electronics and gizmos to match anything out there! Loud, in your face, harsh and very focused.  Perhaps not to live with every day though!"},
{"id": "Bike013","tariff": "Price Group E", "manufacturer": "Harley Davidson", "category": "Cruiser", "name":"Road King Classic - ABS ","size": "1584", "neworused": "", "hire": "Y", "image": "H_D_RoadKing_sm.jpg", "smallImage": "", "price": "", "longDescription": "The latest version of this iconic cruiser legend.  Big, visual, imposing, but very easy to ride.  This bike will handle anything you want from it with poise and sophisticated charm.  So comfortable, people have (honestly) fallen asleep as pillion.  OK, so maybe not track focused, but what a wonderful way to glide through the Welsh countryside."},
{"id": "Bike014","tariff": "Price Group E", "manufacturer": "Harley Davidson", "category": "Cruiser", "name":"Dyna Fat Bob - Custom ","size": "1584", "neworused": "", "hire": "Y", "image": "H_D_FatBob.jpg", "smallImage": "", "price": "", "longDescription": "This incredible machine is the chosen mount of one of the owners of TT Bike Centre.  It started life as a humble Dyna, but many thousands of pounds later, this Fat Bob is heavily customised, leaving the rider feeling both proud to be seen with the one-off paint job and grinning throughout from the startling performance upgrades and scintillating noise that emanates from Reinhart Racing pipes.  This is not a ride you will easily forget."},
{"id": "Bike015","tariff": "", "manufacturer": "Yamaha", "category": "All Rounders", "name":"Fazer ","size": "600", "neworused": "U", "hire": "", "image": "", "smallImage": "", "price": "0", "longDescription": "Need words"},
{"id": "Bike016","tariff": "", "manufacturer": "Yamaha", "category": "Sportsbikes", "name":"R1 ","size": "1000", "neworused": "U", "hire": "", "image": "", "smallImage": "", "price": "2850", "longDescription": "Need words"},
{"id": "Bike017","tariff": "", "manufacturer": "Honda", "category": "Commuters", "name":"2007 CB600 Hornet ABS ","size": "600", "neworused": "U", "hire": "", "image": "U_hornet2.jpg", "smallImage": "", "price": "0", "longDescription": "7 miles only, customer cancelled order. Brand new bike with full Honda warranty."}

			],
			"featuredBikes": [
				"Bike007", "Bike011"
			],
		  "getBike": function(bikeId) {
		  	for (var i = 0; i < this.bikes.length; i++) {
		  		if (this.bikes[i].id == bikeId) {
		  			return this.bikes[i];
		  		}
		  	}
		  },
		  "getFeaturedBike": function() {
		  	var selected = Math.round(Math.random() * (this.featuredBikes.length - 1));
		  	return this.getBike(this.featuredBikes[selected]);
		  },
		  "createBikeSummary": function(bikeId) {
		  	var newDiv = document.createElement('div');
		  	newDiv.className = 'content-extras';
		  	var bike = this.getBike(bikeId);
		  	newDiv.innerHTML = bike.longDescription;
		  	return newDiv;
		  },
		  "createBikeTariff": function(bikeId) {
		  	var bike = this.getBike(bikeId);
		  	return this.createTariffSummary(bike.tariff);
		  },
		  "getTariff": function(tariffId) {
		  	for (var i = 0; i < this.tariffs.length; i++) {
		  		if (this.tariffs[i].id == tariffId) {
		  			return this.tariffs[i];
		  		}
		  	}
		  },
		  "createTariffSummary": function(tariffId) {
		  	var newDiv = document.createElement('div');
		  	newDiv.className = 'content-extras';
		  	var tariff = this.getTariff(tariffId);
		  	newDiv.innerHTML = '<strong>Hire Tariff:</strong>&nbsp;' + tariffId + '<br/><br/>';
		  	newDiv.innerHTML += '<strong>1 Day:</strong>&nbsp;&nbsp;&nbsp;&nbsp;&pound;' + tariff.days1 + '<br/>';
		  	newDiv.innerHTML += '<strong>2 Days:</strong>&nbsp;&nbsp;&nbsp;&pound;' + tariff.days2 + '<br/>';
		  	newDiv.innerHTML += '<strong>3 Days:</strong>&nbsp;&nbsp;&nbsp;&pound;' + tariff.days3 + '<br/>';
		  	newDiv.innerHTML += '<strong>4 Days:</strong>&nbsp;&nbsp;&nbsp;&pound;' + tariff.days4 + '<br/>';
		  	newDiv.innerHTML += '<strong>5 Days:</strong>&nbsp;&nbsp;&nbsp;&pound;' + tariff.days5 + '<br/>';
		  	newDiv.innerHTML += '<strong>6 Days:</strong>&nbsp;&nbsp;&nbsp;&pound;' + tariff.days6 + '<br/>';
		  	newDiv.innerHTML += '<strong>7 Days:</strong>&nbsp;&nbsp;&nbsp;&pound;' + tariff.days7 + '<br/>';
		  	return newDiv;
		  }

		};

