/* BEGIN: Editable content */

// d=day, m=month, y=year, t=title, l=location, v=venue, h=hour, n=minute, e=description, p=photo, mi=contact details and more info
// events can be in any order, the list is automatically sorted in ascending order
var events = [
	{ d: 1, m: 4, y: 2009, t: 'Swing into Cape Town, First Class on the Fun Train for the Cape Town International Jazz Festival', l: 'Cape Town', v: '', h: 12, n:0, e: '1 to 6 April from R3 085 per person sharing (minimum 4 people sharing)<br/><br/>You\'re package includes:<ul><li>Return Train Fare from Johannesburg to Cape Town</li><li>x2 Dinners and x2 Breakfasts on train (JHB-CPT and CPT-JHB)</li><li>Transfers to and from Cape Town station by luxury coach</li><li>Half Day City Tour with local guide</li><li>Three nights bed and breakfast at the Garden Court De Waal.</li></ul><a href="http://www.thompsons.co.za" target="_blank">Find out more</a>', p: 'img/deals/jazzTrain.jpg', showDate: false, showVenue: false },
	{ d: 2, m: 4, y: 2009, t: 'Swing into Cape Town, First Class on the Fun Train for the Cape Town International Jazz Festival', l: 'Cape Town', v: '', h: 12, n:0, e: '1 to 6 April from R3 085 per person sharing (minimum 4 people sharing)<br/><br/>You\'re package includes:<ul><li>Return Train Fare from Johannesburg to Cape Town</li><li>x2 Dinners and x2 Breakfasts on train (JHB-CPT and CPT-JHB)</li><li>Transfers to and from Cape Town station by luxury coach</li><li>Half Day City Tour with local guide</li><li>Three nights bed and breakfast at the Garden Court De Waal.</li></ul><a href="http://www.thompsons.co.za" target="_blank">Find out more</a>', p: 'img/deals/jazzTrain.jpg', showDate: false, showVenue: false },
	{ d: 3, m: 4, y: 2009, t: 'Swing into Cape Town, First Class on the Fun Train for the Cape Town International Jazz Festival', l: 'Cape Town', v: '', h: 12, n:0, e: '1 to 6 April from R3 085 per person sharing (minimum 4 people sharing)<br/><br/>You\'re package includes:<ul><li>Return Train Fare from Johannesburg to Cape Town</li><li>x2 Dinners and x2 Breakfasts on train (JHB-CPT and CPT-JHB)</li><li>Transfers to and from Cape Town station by luxury coach</li><li>Half Day City Tour with local guide</li><li>Three nights bed and breakfast at the Garden Court De Waal.</li></ul><a href="http://www.thompsons.co.za" target="_blank">Find out more</a>', p: 'img/deals/jazzTrain.jpg', showDate: false, showVenue: false },
	{ d: 4, m: 4, y: 2009, t: 'Swing into Cape Town, First Class on the Fun Train for the Cape Town International Jazz Festival', l: 'Cape Town', v: '', h: 12, n:0, e: '1 to 6 April from R3 085 per person sharing (minimum 4 people sharing)<br/><br/>You\'re package includes:<ul><li>Return Train Fare from Johannesburg to Cape Town</li><li>x2 Dinners and x2 Breakfasts on train (JHB-CPT and CPT-JHB)</li><li>Transfers to and from Cape Town station by luxury coach</li><li>Half Day City Tour with local guide</li><li>Three nights bed and breakfast at the Garden Court De Waal.</li></ul><a href="http://www.thompsons.co.za" target="_blank">Find out more</a>', p: 'img/deals/jazzTrain.jpg', showDate: false, showVenue: false },
	{ d: 5, m: 4, y: 2009, t: 'Swing into Cape Town, First Class on the Fun Train for the Cape Town International Jazz Festival', l: 'Cape Town', v: '', h: 12, n:0, e: '1 to 6 April from R3 085 per person sharing (minimum 4 people sharing)<br/><br/>You\'re package includes:<ul><li>Return Train Fare from Johannesburg to Cape Town</li><li>x2 Dinners and x2 Breakfasts on train (JHB-CPT and CPT-JHB)</li><li>Transfers to and from Cape Town station by luxury coach</li><li>Half Day City Tour with local guide</li><li>Three nights bed and breakfast at the Garden Court De Waal.</li></ul><a href="http://www.thompsons.co.za" target="_blank">Find out more</a>', p: 'img/deals/jazzTrain.jpg', showDate: false, showVenue: false },
	{ d: 6, m: 4, y: 2009, t: 'Swing into Cape Town, First Class on the Fun Train for the Cape Town International Jazz Festival', l: 'Cape Town', v: '', h: 12, n:0, e: '1 to 6 April from R3 085 per person sharing (minimum 4 people sharing)<br/><br/>You\'re package includes:<ul><li>Return Train Fare from Johannesburg to Cape Town</li><li>x2 Dinners and x2 Breakfasts on train (JHB-CPT and CPT-JHB)</li><li>Transfers to and from Cape Town station by luxury coach</li><li>Half Day City Tour with local guide</li><li>Three nights bed and breakfast at the Garden Court De Waal.</li></ul><a href="http://www.thompsons.co.za" target="_blank">Find out more</a>', p: 'img/deals/jazzTrain.jpg', showDate: false, showVenue: false },
	{ d: 20, m: 3, y: 2009, t: 'Kwazulu-Natal Fun Bus', l: 'KZN', v: '', h: 12, n:0, e: '20 to 22 March from R1 930<br/><br/>You\'re package includes:<ul><li>Return transport from Johannesburg to Durban in a luxury coach.</li><li>Viewing of movies / playing of music during journey.</li><li>Two nights accommodation at Tropicana Hotel.</li><li>2 x Full English Breakfasts at the hotel.</li><li>2 x Buffet Dinner at the hotel.</li><li>Half-day city tour with an English guide</li></ul><a href="mailto:cameron.charlie@thompsons.co.za">cameron.charlie@thompsons.co.za</a>', p: 'img/deals/funbus2.gif', showDate: false, showVenue: false },
	{ d: 21, m: 3, y: 2009, t: 'Kwazulu-Natal Fun Bus', l: 'KZN', v: '', h: 12, n:0, e: '20 to 22 March from R1 930<br/><br/>You\'re package includes:<ul><li>Return transport from Johannesburg to Durban in a luxury coach.</li><li>Viewing of movies / playing of music during journey.</li><li>Two nights accommodation at Tropicana Hotel.</li><li>2 x Full English Breakfasts at the hotel.</li><li>2 x Buffet Dinner at the hotel.</li><li>Half-day city tour with an English guide</li></ul><a href="mailto:cameron.charlie@thompsons.co.za">cameron.charlie@thompsons.co.za</a>', p: 'img/deals/funbus2.gif', showDate: false, showVenue: false },
	{ d: 22, m: 3, y: 2009, t: 'Kwazulu-Natal Fun Bus', l: 'KZN', v: '', h: 12, n:0, e: '20 to 22 March from R1 930<br/><br/>You\'re package includes:<ul><li>Return transport from Johannesburg to Durban in a luxury coach.</li><li>Viewing of movies / playing of music during journey.</li><li>Two nights accommodation at Tropicana Hotel.</li><li>2 x Full English Breakfasts at the hotel.</li><li>2 x Buffet Dinner at the hotel.</li><li>Half-day city tour with an English guide</li></ul><a href="mailto:cameron.charlie@thompsons.co.za">cameron.charlie@thompsons.co.za</a>', p: 'img/deals/funbus2.gif', showDate: false, showVenue: false },
	{ d: 24, m: 4, y: 2009, t: 'Kwazulu-Natal Fun Bus', l: 'KZN', v: '', h: 12, n:0, e: '20 to 22 April from R1 930<br/><br/>You\'re package includes:<ul><li>Return transport from Johannesburg to Durban in a luxury coach.</li><li>Viewing of movies / playing of music during journey.</li><li>Two nights accommodation at Tropicana Hotel.</li><li>2 x Full English Breakfasts at the hotel.</li><li>2 x Buffet Dinner at the hotel.</li><li>Half-day city tour with an English guide</li></ul><a href="mailto:cameron.charlie@thompsons.co.za">cameron.charlie@thompsons.co.za</a>', p: 'img/deals/funbus2.gif', showDate: false, showVenue: false },
	{ d: 25, m: 4, y: 2009, t: 'Kwazulu-Natal Fun Bus', l: 'KZN', v: '', h: 12, n:0, e: '20 to 22 April from R1 930<br/><br/>You\'re package includes:<ul><li>Return transport from Johannesburg to Durban in a luxury coach.</li><li>Viewing of movies / playing of music during journey.</li><li>Two nights accommodation at Tropicana Hotel.</li><li>2 x Full English Breakfasts at the hotel.</li><li>2 x Buffet Dinner at the hotel.</li><li>Half-day city tour with an English guide</li></ul><a href="mailto:cameron.charlie@thompsons.co.za">cameron.charlie@thompsons.co.za</a>', p: 'img/deals/funbus2.gif', showDate: false, showVenue: false },
	{ d: 26, m: 4, y: 2009, t: 'Kwazulu-Natal Fun Bus', l: 'KZN', v: '', h: 12, n:0, e: '20 to 22 April from R1 930<br/><br/>You\'re package includes:<ul><li>Return transport from Johannesburg to Durban in a luxury coach.</li><li>Viewing of movies / playing of music during journey.</li><li>Two nights accommodation at Tropicana Hotel.</li><li>2 x Full English Breakfasts at the hotel.</li><li>2 x Buffet Dinner at the hotel.</li><li>Half-day city tour with an English guide</li></ul><a href="mailto:cameron.charlie@thompsons.co.za">cameron.charlie@thompsons.co.za</a>', p: 'img/deals/funbus2.gif', showDate: false, showVenue: false },
	{ d: 27, m: 9, y: 2009, t: 'Khoroni Splish Splash 4X4 Challenge', l: 'Thohoyandou, Limpopo', v: 'Khoroni Hotel Casino and Convention Resort', e: 'Entry into the fantastically fun Khoroni Splish Splash 4X4 challenge in the heart of Venda, 2 nights accommodation for 2, Friday night snacks, Saturday night braai, Sunday Breakfast.', p: 'img/deals/funbus2.gif', showDate: true, showVenue: true, c: 'Contact Zena Lambrechts on 015 962 4600/10 or email <a href="mailto:zlambrechts@khoroni.co.za">zlambrechts@khoroni.co.za</a>', cost: 'R 2500' },
	{ d: 28, m: 9, y: 2009, t: 'Khoroni Splish Splash 4X4 Challenge', l: 'Thohoyandou, Limpopo', v: 'Khoroni Hotel Casino and Convention Resort', e: 'Entry into the fantastically fun Khoroni Splish Splash 4X4 challenge in the heart of Venda, 2 nights accommodation for 2, Friday night snacks, Saturday night braai, Sunday Breakfast.', p: 'img/deals/funbus2.gif', showDate: true, showVenue: true, c: 'Contact Zena Lambrechts on 015 962 4600/10 or email <a href="mailto:zlambrechts@khoroni.co.za">zlambrechts@khoroni.co.za</a>', cost: 'R 2500' },
	{ d: 29, m: 9, y: 2009, t: 'Khoroni Splish Splash 4X4 Challenge', l: 'Thohoyandou, Limpopo', v: 'Khoroni Hotel Casino and Convention Resort', e: 'Entry into the fantastically fun Khoroni Splish Splash 4X4 challenge in the heart of Venda, 2 nights accommodation for 2, Friday night snacks, Saturday night braai, Sunday Breakfast.', p: 'img/deals/funbus2.gif', showDate: true, showVenue: true, c: 'Contact Zena Lambrechts on 015 962 4600/10 or email <a href="mailto:zlambrechts@khoroni.co.za">zlambrechts@khoroni.co.za</a>', cost: 'R 2500' },
	{ d: 27, m: 3, y: 2009, t: 'Dr Victor and the Rasta Rebels Live in Concert', l: 'Klerksdorp', v: 'Escapades Theatre, Rio Hotel Casino and Convention Resort', e: '', p: 'img/deals/logoRio.gif', showDate: true, showVenue: true, mi: '018 496 9100 - ask about accommodation / show packages.<br/>Visit <a href="http://www.riocasino.co.za" target="_blank">http://www.riocasino.co.za</a>', cost: 'R 80' }//,
	
	//{ d: 27, m: 3, y: 2009, t: '#', l: '#', v: '#', e: '', p: 'img/deals/spacer.gif', showDate: true, showVenue: true, mi: '#', cost: 'R #' }
]
/* END: Editable content */


/* DO NOT ADJUST ANYTHING BELOW THIS LINE */
function eventsSort(a, b) {
	var da = new Date(a.y, a.m-1, a.d);
	var db = new Date(b.y, b.m-1, b.d);
	if ( navigator.appName.indexOf('Microsoft') > -1 ) {
		return da < db;
	} else {
		return da > db;
	}
}

events.sort(eventsSort);
var nextEvent;

function getNextEvent() {
	var now = new Date();
	now = new Date(now.getFullYear(), now.getMonth(), now.getDate());
	
	var de;
	
	for ( var i = 0; i < events.length; i++ ) {
		e = events[i];
		de = new Date(e.y, e.m-1, e.d);
		if ( de >= now ) {
			nextEvent = i;
			break;
		}
	} 
}
getNextEvent();