


/**
 * Fades the speakers in and out
 */
function fadeInAndOut() {

	$( '#speaker_left' ).animate( { opacity:0 }, 500 );
	$( '#speaker_right' ).animate( { opacity:0 }, 500 );
	
	$( '#speaker_left' ).animate( { opacity:1 }, 500 );
	$( '#speaker_right' ).animate( { opacity:1 }, 500 );
	
	return false;
}



var intervalHandler = null;


function foo() { return false; }


/**
 * When the document is loaded all the way
 */
$( document ).ready( function() {

	// Animation right from the start
	intervalHandler = self.setInterval( "fadeInAndOut()", 1000 );	

	// Start movie at the beginning
	//flashembed( "movie_wrapper", "wp-content/themes/shooters/flash/play_mp3.swf" );

	// Start the animation and play the music
	$( '.headphones span' ).click( function() {
		
		if ( intervalHandler == null ) {
			
			// Changes the headphone LEDs
			$( this ).css( 'backgroundPosition', 'top center' );
			
			// Start Animation
			//intervalHandler = self.setInterval( "fadeInAndOut", 1000 );
			intervalHandler = self.setInterval( "foo()", 1000 );
	
			// Remove flash movie
			$( '#movie_wrapper' ).html( '' );	

		} else {
		
			// Changes the headphone LEDs
			$( this ).css( 'backgroundPosition', 'bottom center' );
			
			// Start movie
			flashembed( "movie_wrapper", "wp-content/themes/shooters/flash/play_mp3.swf" );

			// Stops animation
			//window.clearInterval( intervalHandler );
			intervalHandler = null;

		}
			
		return false;
	});
	
});



 
