
/* - portlet_gast_switcher.js - */
function switchGuests() {
    // naechste zeile auskommentieren zum abschalten des switchers
    // return false;

    var el = document.getElementById("portlet_gast_anzahl");
    if (!el) return;

    var anzahl = el.getAttribute("anzahl");
    if (!anzahl || anzahl < 2) return;

    showOnlyThisGuest(1, anzahl);
    return false;    
}

function showOnlyThisGuest(nummer, insgesamt) {
    var timeout = 10000;
    for (var i=1; i<=insgesamt; i++)
    {
        el = document.getElementById("portlet_gast_aktuell_" + i);
        if (i==nummer) { 
            el.style.display = "block"; 
        } else {
            el.style.display = "none";
        }
    }
    nummer2 = parseInt(nummer) + 1;
    if (nummer2 > insgesamt) nummer2 = parseInt(1);
    
    selbstaufruf = "showOnlyThisGuest('"+nummer2+"', '" + insgesamt + "')";
    setTimeout(selbstaufruf, timeout);
    return false;
}

registerPloneFunction(switchGuests);
