/**
 * Data set
 */
var items = new Array();
items.push({ 
    'name': 'Accretus Consulting', 
    'descr': 'Graphic profile to a smaller consulting company in Sweden.',
    'image': './images/projects/panda.png'
});
items.push({ 
    'name': 'T RECKS', 
    'descr': 'Logo for DJ',
    'image': './images/projects/reinvigorate.png'
});
items.push({
    'name': 'Hip Hop & Show',
    'descr': 'Logo for hip Hop club in Barcelona.',
    'image': './images/projects/pulse.png'
});
items.push({
    'name': 'Venom Tiger',
    'descr': 'Promotional poster for Venom Design.',
    'image': './images/projects/mobify.png'
});
items.push({
    'name': 'Hisingen Zombies',
    'descr': 'Logo for Basketball club.',
    'image': './images/projects/ct.png'
});
items.push({
    'name': 'Buenadictos 16',
    'descr': 'Logo for internet soccer club.',
    'image': './images/projects/buenadictos.png'
});
items.push({
    'name': 'Designdekaler.se',
    'descr': 'Site for decoration vinyls.',
    'image': './images/projects/dd.png'
});
items.push({
    'name': 'Cervite',
    'descr': 'Logo for physiotherapy company.',
    'image': './images/projects/cervite.png'
});
/**
 * Action code
 */
$(document).ready(function() {
    // this is the current item, by array key
    var curIndex = 0;
    // how many items are in the list
    var max = items.length;

    // "previous" action
    $('.prev').click(function() {
        // decrement the curIndex
        curIndex--;
        if (curIndex < 0) {
            curIndex = max-1;
        }
        
        updateProject();
    });
        
    $('.next').click(function() {
        curIndex++;
        if (curIndex >= max) {
            curIndex = 0;
        }

        updateProject();
    });

    // update the latest project
    function updateProject() {
        $('#latest-project .preview .image').attr('src', items[curIndex]['image']);
        $('#latest-project .descr .title').html(items[curIndex]['name']);
        $('#latest-project .descr .description').html(items[curIndex]['descr']);
    }
});

