﻿function initShowcase() {
    var screens = [
                { src: 'images/showcase_6.png', alt: 'gMaths - Pie Charts', title: 'gMaths' },
                { src: 'images/showcase_2.png', alt: 'gPhysics - Atomic Structure', title: 'gPhysics' },
                { src: 'images/showcase_11.png', alt: 'MathENGINE - Calculation and Plotting', title: 'MathENGINE' },
                { src: 'images/showcase_12.png', alt: 'Logo - Basic Shapes', title: 'Logo' },
                { src: 'images/showcase_1.png', alt: 'gPhysics - Diffraction Simulation', title: 'gPhysics' },
                { src: 'images/showcase_15.png', alt: 'AMaths - Properties of Functions', title: 'AMaths' },
                { src: 'images/showcase_3.png', alt: 'gPhysics - Circuits', title: 'gPhysics' },
                { src: 'images/showcase_13.png', alt: 'Logo - Spiral', title: 'Logo' },
                { src: 'images/showcase_7.png', alt: 'gMaths - Bearings', title: 'gMaths' },
                { src: 'images/showcase_17.png', alt: 'gICT - User Interfaces', title: 'gICT' },
                { src: 'images/showcase_5.png', alt: 'gPhysics - Gravity Simulation', title: 'gPhysics' },
                { src: 'images/showcase_16.png', alt: 'AMaths - Solving Trigonometric Equations', title: 'AMaths' },
                { src: 'images/showcase_10.png', alt: 'PenDraw - AutoDraw', title: 'PenDraw' },
                { src: 'images/showcase_8.png', alt: 'gMaths - Rotation', title: 'gMaths' },
                { src: 'images/showcase_14.png', alt: 'Geometry In Action - Theorems', title: 'Geometry In Action' },
                { src: 'images/showcase_9.png', alt: 'gMaths - Histograms', title: 'gMaths' },
                { src: 'images/showcase_4.png', alt: 'gPhysics - Ions', title: 'gPhysics' },
                { src: 'images/showcase_18.png', alt: 'AMaths - Exponential Functions', title: 'AMaths' },
                { src: 'images/showcase_19.png', alt: 'AMaths - Simultaneous Quadratic Equations', title: 'AMaths' },
                { src: 'images/showcase_20.png', alt: 'AMaths - Solving Trigonometric Equations', title: 'AMaths' },
                { src: 'images/showcase_21.png', alt: 'AMaths - Finding Stationary Points', title: 'AMaths' },
                { src: 'images/showcase_22.png', alt: 'AMaths - Cosine Graphs', title: 'AMaths' },
                { src: 'images/showcase_23.png', alt: 'gMaths - Enlargement', title: 'gMaths' },
                { src: 'images/showcase_24.png', alt: 'gMaths - Translation', title: 'gMaths' },
                { src: 'images/showcase_25.png', alt: 'gMaths - Hexagonal Prism', title: 'gMaths' },
                { src: 'images/showcase_26.png', alt: 'MathENGINE - Calculations', title: 'MathENGINE' },
                { src: 'images/showcase_27.png', alt: 'MathENGINE - Geometry', title: 'MathENGINE' },
                { src: 'images/showcase_28.png', alt: 'MathENGINE - Polynomial Function', title: 'MathENGINE' },
                { src: 'images/showcase_29.png', alt: 'MathENGINE - Graphs', title: 'MathENGINE' },
                { src: 'images/showcase_30.png', alt: 'MathENGINE - Graphs', title: 'MathENGINE' },
                { src: 'images/showcase_31.png', alt: 'gPhysics - Momentum and Impulse', title: 'gPhysics' },
                { src: 'images/showcase_32.png', alt: 'gPhysics - Tensile and Compressive Forces', title: 'gPhysics' },
                { src: 'images/showcase_33.png', alt: 'gPhysics - Series Circuits', title: 'gPhysics' },
                { src: 'images/showcase_34.png', alt: 'gPhysics - Electromagnets', title: 'gPhysics' },
                { src: 'images/showcase_35.png', alt: 'gPhysics - The Magnetic Force', title: 'gPhysics' },
                { src: 'images/showcase_36.png', alt: 'Logo - Random Tree Pattern', title: 'Logo' },
                { src: 'images/showcase_37.png', alt: 'MathENGINE - Calculations and Graphs', title: 'MathENGINE' },
                { src: 'images/showcase_38.png', alt: 'DesignPoint - Air Conditioner Design', title: 'DesignPoint' },
                { src: 'images/showcase_39.png', alt: 'DesignPoint - Workbench Design', title: 'DesignPoint' },
                { src: 'images/showcase_40.png', alt: 'PenDraw - Flowers', title: 'PenDraw' },
                { src: 'images/showcase_41.png', alt: 'PenDraw - Science Illustrations', title: 'PenDraw' },
                { src: 'images/showcase_42.png', alt: 'gMaths - Linear Inequalities', title: 'gMaths' },
                { src: 'images/showcase_43.png', alt: 'gMaths - Interquartile Range', title: 'gMaths' },
                { src: 'images/showcase_44.png', alt: 'gMaths - Frequency Tables', title: 'gMaths' }
            ];

    for (var i = 0; i < screens.length - 1; i++) {
        var index2 = Math.floor(Math.random() * (screens.length - 1));
        var screenTmp = screens[i];
        screens[i] = screens[index2];
        screens[index2] = screenTmp;
    }

    for (var i = 0; i < 10; i++) {
        var screen = screens[i];
        $('#showcaseContainer').append(
                        "<div style='display:none'>" +
                        "<img src='" + screen.src + "' alt='" + screen.alt + "' title='" + screen.title + "' class='thumbnail' />" +
                        "</div>");
    }

    $('#showcaseContainer').cycle({
        delay: 1000,
        speed: 500,
        before: onBefore,
        next: '#next',
        prev: '#prev'
    });

    function onBefore() {
        $('#title').html($('img', this).get()[0].alt);
    };

    enl_preloadit('images/button_prev_over.png');
    enl_preloadit('images/button_next_over.png');

    $('#prev').mouseover(function() {
        this.src = 'images/button_prev_over.png';
    });
    $('#prev').mouseout(function() {
        this.src = 'images/button_prev.png';
    });
    $('#next').mouseover(function() {
        this.src = 'images/button_next_over.png';
    });
    $('#next').mouseout(function() {
        this.src = 'images/button_next.png';
    });
}
