var currentpic=0;

function slideto(fotonr) {
    if (maxpics == 0) return;

    $("#ball"+currentpic).attr({src: "/assets/img/dot-off.png"});
    
    if (fotonr < 0) fotonr = 0;
    if (fotonr > (maxpics -1)) fotonr = (maxpics - 1);
    
    if (currentpic != fotonr) {
        if (currentpic == 0) {
            $("#leftbutton").fadeIn();
        }
        if (currentpic == (maxpics - 1)) {
            $("#rightbutton").fadeIn();
        }
        if (fotonr == 0) {
            $("#leftbutton").fadeOut();            
        }
        if (fotonr == (maxpics - 1)) {
            $("#rightbutton").fadeOut();            
        }
        
        currentpic = fotonr;
        $("#slidestrip").animate({left: (-860 * currentpic) + "px"}, 750, "easeInOutExpo");
        $("#ball"+currentpic).attr({src: "/assets/img/dot-on.png"});        
        
        $("#photo_title").fadeOut("normal", function() { jQuery(this).html(phototitles[currentpic]).fadeIn() });
        $("#photo_description").fadeOut("normal", function() { jQuery(this).html(photodescriptions[currentpic]).fadeIn() });
        
    }
    
}

function minibrowseto(mbnr) {
    if (maxmb == 0) return;
    
    if (mbnr < 0) mbnr = 0;
    if (mbnr > (maxmb - 1)) mbnr = (maxmb - 1);
    
    if (mbnr != currentmb) {
        $("#minibrowse" + currentmb).fadeOut("fast", function() { 
        $("#minibrowse" + mbnr).fadeIn("fast");
        });
    }
    
    currentmb = mbnr;
}