var ga_pictures = new Array();
var ga_pictures_current = 0;

function ga_gallery_next() {
    if(ga_pictures.length>ga_pictures_current+1) {
        ga_pictures_current+= 1;
        ga_gallery_setImg();
        return true;
    }
    return false;
}

function ga_gallery_prev() {
    if(0<ga_pictures_current) {
        ga_pictures_current-= 1;
        ga_gallery_setImg();
        return true;
    }
    return false;
}

function ga_gallery_setImg() {
    document.getElementById('ga_gallery_mainpic').src   = ga_pictures[ga_pictures_current][2];
    
        var img_anim    = new YAHOO.util.Anim("ga_gallery_mainpic", { width: { to: ga_pictures[ga_pictures_current][3]}, height: { to: ga_pictures[ga_pictures_current][4]} }, 0.2, YAHOO.util.Easing.easeOut);
        img_anim.animate();
        
    var g_top   = document.getElementById('ga_gallery_name_top');
    if(g_top) {
        g_top.innerHTML = 'Bild '+(ga_pictures_current+1)+' / '+ga_pictures.length;
    }
    var g_sub   = document.getElementById('ga_gallery_subtitle');
    if(g_sub) {
        g_sub.innerHTML = ga_pictures[ga_pictures_current][1];
        g_sub.style.visibility  = (""==ga_pictures[ga_pictures_current][1].replace(" ", "")) ? 'hidden' : 'visible';
    }
    
    return true;
}

function ga_gallery_slideshow() {
    if(ga_gallery_next()) window.setTimeout('ga_gallery_slideshow()', 3000);
}
