var demoReel = {
	animDuration : 400,
	animTransition : Fx.Transitions.Quad.easeOut,
	header : null,
	demoContainer : null,
	video : null,
	videoDummy : null,
	pageContent : null,
	
	init : function() {
		demoReel.header = new Fx.Tween($('page_header'), {
			duration: demoReel.animDuration,
			transition: demoReel.animTransition
		});
		demoReel.video = new Fx.Tween($('demo_reel_content_container'), {
			duration: demoReel.animDuration,
			transition: demoReel.animTransition
		});
		demoReel.videoDummy = new Fx.Tween($('demo_reel_dummy'), {
			duration: demoReel.animDuration,
			transition: demoReel.animTransition
		});
		demoReel.pageContent = new Fx.Tween($('work_thumbs'), {
			duration: demoReel.animDuration,
			transition: demoReel.animTransition
		});
		demoReel.demoContainer = new Fx.Tween($('demo_reel'), {
			duration: demoReel.animDuration,
			transition: demoReel.animTransition
		});		
	},
	
	// OPENING ANIMATIONS
	openReel : function() {
		demoReel.pageContent.start('margin-top', 310).chain(
			function() {demoReel.fadeOutHeader(); this.callChain();}
		);
	},		
	fadeOutHeader : function() {		
		demoReel.header.start('opacity', 0).chain(
			function() {$('page_header').setStyle('top', -1000000); demoReel.fadeInDummy(); this.callChain();}
		);
	},
	fadeInDummy : function() {
		$('demo_reel').setStyles({
			'top' : 0
		});
		$('demo_reel_dummy').setStyles({
			'top': 40,
			'opacity' : 0
		});		
		
		demoReel.videoDummy.start('opacity', 1).chain(
			function() {demoReel.showVideo(); this.callChain();}
		);
	},
	showVideo : function() {
		$('demo_reel').setStyle('opacity','');
		$('demo_reel_dummy').setStyle('top', -1000000);		
		$('demo_reel_content_container').setStyle('top', 40);
		playFlashVideo("demo_reel/TL_REEL2008.flv");
	},
	
	// CLOSING ANIMATONS
	closeReel : function() {
		demoReel.pageContent.start('margin-top', 0)
	},
	fadeOutDummy : function() {
		demoReel.videoDummy.start('opacity', 0).chain(
			function() {$('demo_reel_dummy').setStyle('top',-1000000); $('demo_reel').setStyle('top',-1000000); demoReel.fadeInHeader(); this.callChain();}
		);
	},
	fadeInHeader : function() {
		$('page_header').setStyle('top', 0);		
		
		demoReel.header.start('opacity', 1).chain(
			function() {demoReel.closeReel(); this.callChain();}
		);
	},			
	hideVideo : function() {
		closeVideo();
		$('demo_reel_content_container').setStyle('top', -1000000);
		$('demo_reel_dummy').setStyle('top', 40);
		demoReel.fadeOutDummy();			
	}
	
}
	
window.addEvent('domready', demoReel.init);