WebFont . load ( {
	google: {
		families: [ 'Yanone Kaffeesatz:200,300,400,700' ]
	}
} );

jQuery( document ) . ready( function( $ ) {
	/** Stage & Showcase */
	$( 'aside.showcase' ) . css( 'top','-400px' );
	$( '#track1, #track2' ) . delay( 1500 ) . animate( { 'top': '+=448px' }, 1000, 'easeOutBack' );
	$( 'body.home a.showcase' ) . toggle(
		function() {
			$( this ) . addClass( 'active' );
			$( '#track1, #track2' ) . animate( { 'top': '-=448px' }, 1000, 'easeInBack' );
			$( '#track3, #track4' ) . delay( 1100 ) . animate( { 'top': '+=448px' }, 1000, 'easeOutBack' );
			$( '#stage #video' ) . fadeOut( 1000, function(){ $( '#stage #showcase' ) . fadeIn( 1000 ); } );
		},
		function() {
			$( this ) . removeClass( 'active' );
			if ( $( '#stage #showcase' ) . is( ':visible' ) ) $( '#track3, #track4' ) . animate( { 'top': '-=448px' }, 1000, 'easeInBack' );
			$( '#track1, #track2' ) . delay( 1100 ) . animate( { 'top': '+=448px' }, 1000, 'easeOutBack' );
			if ( $( '#stage #showcase' ) . is( ':visible' ) )
				$( '#stage #showcase' ) . fadeOut( 1000, function() { $( '#stage #video' ) . fadeIn( 1000 ); } );
			else
				$( '#stage #join' ) . fadeOut( 1000, function() { $( '#stage #video' ) . fadeIn( 1000 ); } );
		}
	);
	
	$( 'a[href=#join]' ) . click (
		function(){
			$( '#track3, #track4' ) . animate( { 'top': '-=448px' }, 1000, 'easeInBack' );
			$( '#stage #showcase' ) . fadeOut( 1000, function() { $( '#stage #join' ) . fadeIn( 1000 ); } );
		}
	)
	
	$( '#stage #join a[href=#showcase]' ) . click (
		function() {
			$( '#track3, #track4' ) . delay( 1100 ) . animate( { 'top': '+=448px' }, 1000, 'easeOutBack' );
			$( '#stage #join' ) . fadeOut( 1000, function(){ $( '#stage #showcase' ) . fadeIn( 1000 ); } );
		}
	);
	
	$( '#join input[name=webcomicms_ajax]' ) . attr( 'value', '1' );
	$( '#join form' ) . ajaxForm( { target: '#join div' } );
	
	$( '#stage #showcase' ) . cycle( {
		'fx'     : 'fade',
		'timeout': 0,
		'prev'   : '#track3 a',
		'next'   : '#track4 a',
		'easing' : 'easeInOutBack'
	} );
	
	/** Manual Page Print */
	$( '.manual_page .print' ) . click( function() {
		window.print();
	} )
	
	/** Manual Page Discussion */
	$( '.single-manualpage a[href=#comments]' ) . toggle(
		function() {
			$( '.content' ) . fadeOut( 'fast', function(){ $( '#comments' ) . fadeIn( 'fast' ); } );
			$( this ) . html( 'Read' );
		},
		function() {
			$( '#comments' ) . fadeOut( 'fast', function(){ $( '.content' ) . fadeIn( 'fast' ); } );
			$( this ) . html( 'Discuss' );
		}
	);
} );