// remap jQuery to $
(function($){})(window.jQuery);

var t3,
	t2,
	t1,
	s1,
	s2,
	s3,
	w1,
	w2,
	w3;

var type_delay = 130;

/* trigger when page is ready */
$(document).ready(function (){

	// your functions go here
	//$t3a = $('.t3a');
	$('nav').hide();
	$t3b = $('.t3b');
	$t2 = $('.t2');
	$t1 = $('.t1');

	$s1 = $('.s1');
	$s2 = $('.s2');
	$s3 = $('.s3');

	$w1 = $('.w1');
	$w2 = $('.w2');
	$w3 = $('.w3');


});



/* optional triggers */

$(window).load(function() {
	
	// drop t3
	$t3b.animate({ top: '93px', leaveTransforms:true }, 300 , function() { 
		// drop t2
		$t2.animate({ top: '86px', leaveTransforms:true }, 300 , function(){
			// drop t1
			$t1.animate({ top: '72px', leaveTransforms:true }, 300 , function(){
				//Set pause (400ms)
				var wait = setTimeout(function(){
					$s3.animate({ height: '10px', leaveTransforms:true}, 150, function(){
						//Set pause (400ms)
						var waitForStacks = setTimeout(function(){
						// build s1
						$s1.animate({ height: '52px', leaveTransforms:true}, 150, function(){
							// build s2
							$s2.animate({ height: '46px', leaveTransforms:true}, 150, function(){
								// build s3
								
									// Type w1
									$w1
										.animate({ width : '+=44px' },0)
										.delay(type_delay)
										.animate({ width : '+=57px' },0)
										.delay(type_delay)
										.animate({ width : '+=60px' },0)
										.delay(type_delay)
										.animate({ width : '+=51px' },0)
										.delay(type_delay)
										.animate({ width : '+=68px' },0)
										.delay(type_delay)
										.animate({ width : '+=58px' },0)
										.delay(type_delay)
										.animate({ width : '+=63px' },0, function(){
											// Type w2
											$w2
												.animate({ width : '+=81px' },0)
												.delay(type_delay)
												.animate({ width : '+=64px' },0)
												.delay(type_delay)
												.animate({ width : '+=61px' },0)
												.delay(type_delay)
												.animate({ width : '+=53px' },0,function(){
													$w3.animate({ top: '183px', leaveTransforms:true}, 700, function(){
														$('.noAnim').show(); 
													} ); // and w1 build
												});						
										});
								}); // and s3 build
							
							}); // and s1 build
								}, 800);  // end set Timeout
					}); // and s2 build
				}, 400);  // end set Timeout
			}); // end t2 drop	
		}); // end t2 drop
	}); // end t3 drop


});  // end window.load




