/**
 * @author temaanga.kupa
 */
first = 1;
last = 5;
current = 1;
var obj;

function nextPicture(){
    // Hide current picture
    object = document.getElementById('slide' + current);
    object.style.display = 'none';
    
    // Show next picture, if last, loop back to front
    if (current == last) {
        current = 1;
    }
    else {
        current++
    }
    object = document.getElementById('slide' + current);
    object.style.display = 'block';
}

function previousPicture(){
    // Hide current picture
    object = document.getElementById('slide' + current);
    object.style.display = 'none';
    
    if (current == first) {
        current = last;
    }
    else {
        current--;
    }
    object = document.getElementById('slide' + current);
    object.style.display = 'block';
}

function nextPicture(){
    // Hide current picture
    object = document.getElementById('slide' + current);
    object.style.display = 'none';
    
    // Show next picture, if last, loop back to front
    if (current == last) {
        current = 1;
    }
    else {
        current++
    }
    object = document.getElementById('slide' + current);
    object.style.display = 'block';
    
    if (obj)
    {
        clearTimeout(obj);
    }
    obj = setTimeout(nextPicture, 2500); //NEW LINE in the end of nextPicture function
}

obj = setTimeout(nextPicture, 2500); //NEW LINE in the end of nextPicture function


