DD_belatedPNG.fix( 'body.splash ul.actions li.contribute-to-the-xi a, body.splash ul.actions li.email-signup, .icon' );


$( document ).ready( function() {
	
	
	jQuery( 'li.action.connect-via').hover( 
		
		function() { $('li.action.connect-via').addClass('focus') }, 
		
		function() { $('li.action.connect-via').removeClass('focus') } 
	
	);
	
	
	jQuery( 'li.action.email-signup input.email' ).focus( 
	
		function() { $('li.action.email-signup').addClass('focus') } 
		
	);
	
	
	jQuery( 'li.action.email-signup input.email' ).blur( 
	
		function() { $('li.action.email-signup').removeClass('focus') } 
		
	);
	

	if ( jQuery( 'ul.carousel-nav' ).length )
		{
	
		var selectedFeature = 0;
		
		var totalFeatures = jQuery( 'ul.carousel-nav li' ).length;
		
		var duration = 600;
		
		var wait = 8000;
		
		
		jQuery( 'div.carousel a.item' ).css( 'display', 'none' );
		
		
		jQuery( 'ul.carousel-nav li' ).click( function( ev ) {
			
			selectFeature( parseInt( jQuery( this ).text() ) );
			
			clearInterval( featureInterval );
			
			ev.preventDefault();
			
		});
		
		
		function selectFeature( featureIndex )
			{
			
			if ( featureIndex == selectedFeature ) return;
			
			if ( featureIndex == 0 ) featureIndex = selectedFeature + 1;
			
			featureIndex = featureIndex < 1 ? selectedFeature + 1 : featureIndex > totalFeatures ? 1 : featureIndex;
			
			if ( selectedFeature )
				{
				
				jQuery( 'div.carousel a.item:nth-child(' + selectedFeature + ')' ).fadeOut( duration );
				
				jQuery( 'div.carousel li:nth-child(' + selectedFeature + ') a' ).removeClass( 'selected' );
					
				}
				
			jQuery( 'div.carousel a.item:nth-child(' + featureIndex + ')' ).fadeIn( duration );
			
			jQuery( 'div.carousel li:nth-child(' + featureIndex + ') a' ).addClass( 'selected' );
			
			selectedFeature = featureIndex;
				
			}
	
	
		selectFeature( Math.floor( Math.random() * totalFeatures ) + 1 );
	
		var featureInterval = setInterval( function() { selectFeature( 0 ) }, wait );
	
		}


}); 
