var section__active;
var section__max;
var section__url;
var section__base;
var positions = new Array("bottom","top");

// LET OP: Eerst moet sIFR geladen zijn voordat setSection aangesproken kan worden.
function setSection(_max)
{
    section__max = _max;
    var aLocation = document.location.toString().split("#");
    section__base = aLocation.length>1?aLocation[0]:aLocation;
    if(document.getElementById("section1")){
        showSection(aLocation.length>1?aLocation[1]:1);
    }
}

function prev()
{
    if(section__active>1)
    {
        document.location = section__base+"#"+(parseInt(section__active)-1);
        showSection(parseInt(section__active)-1);
    }
}
function next()
{
    if(section__active<section__max)
    {
        document.location = section__base+"#"+(parseInt(section__active)+1);
        showSection(parseInt(section__active)+1);
    }
}
function showSection(section)
{
    hiddenOldSection();
    document.getElementById("section"+section).style.display = "block";
    document.getElementById("bottom__count"+section).className  = "count active";
    document.getElementById("countActive").innerHTML = section;
    section__active = section;

    for(var i=0;i<positions.length;i++){
        if(section__active<=1){
            document.getElementById(positions[i]+"__imgPrev").style.visibility = "hidden";
        }
        else{
            document.getElementById(positions[i]+"__imgPrev").style.visibility = "visible";
        }
        if(section__active>=section__max){
            document.getElementById(positions[i]+"__imgNext").style.visibility = "hidden";
        }
        else{
            document.getElementById(positions[i]+"__imgNext").style.visibility = "visible";
        }
    }
    window.scrollTo(0);
    sIFRInit();
}
function getNextIndex(){
    return section__active+1;
}
function hiddenOldSection()
{
    var _active = section__active==undefined?1:section__active;
    document.getElementById("section"+_active).style.display    = "none";
    document.getElementById("bottom__count"+_active).className  = "count";
}