/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var mod_boa_magasiner = {};

mod_boa_magasiner.getNewest = function() {
    var len = mod_boa_magasiner.imgObj.length;
    return mod_boa_magasiner.imgObj[len-1];
}

mod_boa_magasiner.setupMagasiner = function() {
    $('magasiner').empty();
    $('magasiner').adopt(mod_boa_magasiner.getNewest());
}

mod_boa_magasiner.nextImage = function() {

    currentIndex++;
    $('magasinNavLeft').style.display = "";
    if(currentIndex == images.length-1) {
        $('magasinNavRight').style.display = "none";
    } else {
        $('magasinNavRight').style.display = "";
    }

    if(currentIndex <= (mod_boa_magasiner.imgObj.length - 1)  && currentIndex >= 0) {
        var link = 'index.php?option=com_flippingbook&view=book&id='+images[currentIndex].id;
//        var link = images[currentIndex].link;
        $('magasiner').empty();
        $('magasiner').adopt(mod_boa_magasiner.imgObj[currentIndex]);
        $("magasinLink").href = base+link;
    }
}

mod_boa_magasiner.prevImage = function() {
    
    currentIndex--;
    $('magasinNavRight').style.display = "";
    if(currentIndex == 0) {
        $('magasinNavLeft').style.display = "none";
    } else {
        $('magasinNavLeft').style.display = "";
    }
    if(currentIndex <= (mod_boa_magasiner.imgObj.length - 1)  && currentIndex >= 0) {
        var link = 'index.php?option=com_flippingbook&view=book&id='+images[currentIndex].id;
//        var link = images[currentIndex].link;
        $('magasiner').empty();
        $('magasiner').adopt(mod_boa_magasiner.imgObj[currentIndex]);
        $("magasinLink").href = base+link;
    }
}
