var path = 'http://www.mitchsebastian.co.uk/';
	
	function playShowreel(file){
		var m = file;
		new Swiff(path+'flash/player.swf', {
			id: 'flashPlayer',
			container : $('home-flash'),
			width: 807,
			height: 372,
			params: {
				wmode: 'opaque',
				bgcolor: '#000000'
			},
			vars: {
				video : m,
				skin : path+'flash/SkinOverPlaySeekMute.swf'
			}

		});
	}
	
	function playNext(){
		var n = 0;
		$$('.strap-nav a').each( function(el, i, arr){
			if( el.getStyle('color') == '#000000' ){
				if( i != (arr.length - 1) ) n = i;
			}
		});
		linkClick( $$('.strap-nav a')[n] )
	}
	
	function linkClick(el){
		playShowreel(el.href);
		el.getParent().getChildren('a').setStyle('color', '#FFFFFF');
		el.setStyle('color', '#000000');
		Cufon.refresh();
	}
	
	function showEndCard(){
		var img = new Element('img', {'src':path + 'themes/site_themes/images/end-card.png'} );
		img.setStyles({'opacity':0});
		$('home-flash').empty().grab(img);
		img.tween('opacity', 1);
	}
	
	function stopPlaying(){
	var n = 0;
	$$('.strap-nav a').each( function(el, i, arr){
		if( el.getStyle('color') == '#000000' ){
			n = i + 1;
			if( n > (arr.length - 1) ) n = 0;
		}
	});
	var e = $$('.strap-nav a')[n];
	showEndCard();
	linkClick.delay( 10000, this, e)
}


$(window).addEvent('domready', function(){
	
	
	
	
	$$('.strap-nav a').addEvent('click', function(e){
		new Event(e).stop();
		e.preventDefault();
		playShowreel(this.href);
		this.getParent().getChildren('a').setStyle('color', '#FFFFFF');
		this.setStyle('color', '#000000');
		Cufon.refresh();
	});
	
	var el = $$('.strap-nav a')[0];
	linkClick(el);
	new Image().src = path + 'themes/site_themes/images/end-card.png';
	
	

});

$(window).addEvent('load', function(){
	$$('.twitter-text').setStyle('opacity', 0);
	$$('.twitter-text').set('tween', {duration:1000});
	$$('.twitter-text').tween('opacity', 1);
});
