/**
 * The 'launch' script contains the animation associated with morphing the site from
 * the landing page, to the active informational layout.
 */

// Appends 'click()' to the launch buton. Launch button is lengthy. Fires off 'postLaunchSetup()'
// upon completion (defined further down).
$(document).ready(function(){

	// appends click functionality.
	$('#launch').click(function(){

		// fades out 'launch' button.
		$('#launch').fadeOut(300, function(){

			// fades out logo and lander content.
			$('img.logo').fadeOut(300);
			$('#lander_content').fadeOut(300, function(){

				// adjusts container height (prevents footer from acting weird), loaded class to lander_content,
				// and fades lander_content back in.
				$('#lander_content').find('p').remove();
				$('#site_container').css('height', 'auto');
				$('#footer').css('position', 'relative');
				$('#lander_content').addClass('loaded');
				$('#lander_content').fadeIn(500, function(){

					// slides down the header bar.
					$('#header_bar').slideDown(300, function(){

						// prepends the new logo, fades it in, fires off 'postLaunchSetup()'.
						$('#header_bar').prepend('<img class="logo" src="images/logo_medium.png"/>');
						$('#header_bar').find('.logo').fadeIn(500, postLaunchSetup());
					});
				});
			});
		});
	});
});




// Handles setting up the content for the Twitter and blog feed.
function postLaunchSetup() {

	// Twitter feed
	$(function(){
		$("#twitter_feed").find('#feed').tweet({
			avatar_size: 32,
			count: 10,
			query: "BMW",
			loading_text: "Loading Twitter Feeds...",
			refresh_interval: 15
		});
    });

	$('#twitter_feed').fadeIn(500);

	// Blog feed

}
