var current_problem = 1;

var horizontal_slides = [
    '#go_to_problems',
    '#go_to_industries'
];

$( document ).ready(
    function() {
        
        $.each( horizontal_slides, 
            function( i ) {
                var multiplier = i + 1;
                var margin = multiplier * -320;

                $( horizontal_slides[i] ).click(
                    function() {
                        $( '#intro' ).animate( { marginTop : margin } );
                    }
                );
            } 
        )
            
        $( 'a.backLink' ).click(
            function() {
                $( '#intro' ).animate( { marginTop : '0px' } );
            }
        );        

        $( '.next' ).click(
            function() {
                if( current_problem == $("ul#inner > li").size() ) {
                    return false;
                }

                $( '#inner' ).animate( { marginLeft:'-=950px' } );
                current_problem++;
                return false;
            }
        );

        $( '.prev' ).click(
            function() {
                if( current_problem == 1 ) {
                    return false;
                }

                $( '#inner' ).animate( { marginLeft:'+=950px' } );
                current_problem--;
                return false;
            }
        );

    }
    
);
