/**
 * Klasse für die Skipfunktionalität in einer Ergebnisliste
 * 
 * @author Daniel Lembicz
 */

/**
 * Konstruktor
 * 
 * @param String targetId (ID des Elementes für die Navigation)
 */
function TTListSkip (targetId) {
    this.targetId = targetId;
    this.oSkip = pStrecke.oSkip;
}

/**
 * Möglichkeit, andere Skip-Ausgangswerte zu übergeben
 * 
 * @param Object oSkip (Überschreibt das Standard-Objekt der TTStrecke)
 */

TTListSkip.prototype.setInitialValues = function(oSkip) {
    this.oSkip = oSkip;
}

/**
 * Standard Skip-Leiste
 */

TTListSkip.prototype.showSkipStandard = function() {
    var obj = this.oSkip;
    var newSkip = document.createElement('div');
    jQuery(newSkip).attr('class', 'terminFooterSkipInner');
    
    var numToShow   = pStrecke.config.numToShow.offers;
    var numSites    = Math.ceil(parseInt(obj.numResults) / numToShow);
    var currentSite = (parseInt(obj.curSite) / numToShow ) + 1;
    var prevSite    = currentSite - 1;
    var nextSite    = currentSite + 1;

    if(numSites < 2) {
        return;
    }

    // *** linker Pfeil ***
    if (currentSite > 1) {
        jQuery(newSkip).append('<img class="terminSkipButtonLeftImg" src="' + imgPfad + '/termine/arrowBlueLeft.gif" alt="" border="0" width="9" height="15" />');
        jQuery(newSkip).find('.terminSkipButtonLeftImg').attr('title', 'Angebote der Seite ' + prevSite + ' abrufen');
        jQuery(newSkip).find('.terminSkipButtonLeftImg').click(
            function() { 
                sendPostRequest(pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + '&startposition=' + ((prevSite - 1) * numToShow), pStrecke.config.idForm, null, 'pTermine.showList()', null, null, true);
                scroll(0, jQuery('#idListContent').position().top);
            }
        );
    } else {
        jQuery(newSkip).append('<img class="terminSkipButtonLeftImg" src="/images/spacer.gif" alt="" border="0" width="9" height="15" />');    
        jQuery(newSkip).find('.terminSkipButtonLeftImg').css('cursor', 'default');
    }
    
    for (var p = 1; p <= numSites; p++) {
        
        var skipId = 'skipId_' + obj.position + '_' + p;
        jQuery(newSkip).append('<span id="' + skipId + '" skipId="' + p + '" class="terminSkipElement" title="Angebote der Seite ' + p + ' abrufen">' + p + '</span>');
        // *** aktive Seite ***        
        if (p == currentSite) {
            jQuery(newSkip).find('#' + skipId).addClass('terminSkipElementActive');
        }
        // *** klick Events ***
        if (p != currentSite) { 
            jQuery(newSkip).find('#' + skipId).click(
                function() { 
                    sendPostRequest(pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + '&startposition=' + ((parseInt(jQuery(this).attr('skipId')) - 1) * numToShow), pStrecke.config.idForm, null, "pTermine.showList()", null, null, true);
                    scroll(0, jQuery('#idListContent').position().top);
                }
            );
        }
    }
    
    // *** rechter Pfeil ***
    if (currentSite == numSites) {
        jQuery(newSkip).append('<img class="terminSkipButtonRightImg" src="/images/spacer.gif" alt="" border="0" width="9" height="15" />');    
        jQuery(newSkip).find('.terminSkipButtonRightImg').css('cursor', 'default');
    } else {
        jQuery(newSkip).append('<img class="terminSkipButtonRightImg" src="' + imgPfad + '/termine/arrowBlueRight.gif" alt="" border="0" width="9" height="15" />');    
        jQuery(newSkip).find('.terminSkipButtonRightImg').attr('title', 'Angebote der Seite ' + nextSite + ' abrufen');
        jQuery(newSkip).find('.terminSkipButtonRightImg').click(
            function() { 
                sendPostRequest(pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + '&startposition=' + ((nextSite - 1) * numToShow), pStrecke.config.idForm, null, 'pTermine.showList()', null, null, true);
                scroll(0, jQuery('#idListContent').position().top);
            }
        );
    }
    
    jQuery(newSkip).appendTo(jQuery('#' + this.targetId));
}

/**
 * rotierende Skip-Leiste wie im Showroom (nur 4 Seiten gleichzeitig)
 * 
 * @deprecated extended version should be used
 * @param boolean showNumSites (zeigt Gesamtanzahl der Seiten an)
 * @param boolean showInactiveArrows (zeigt inaktive Pfeile an statt sie auszublenden)
 */

TTListSkip.prototype.showSkipRotation = function(showNumSites, showInactiveArrows) {
    var numResults = this.oSkip.numResults;
    if (pStrecke.step == 'hotel') {
        var numToShow = (pStrecke.config.numToShow.hotels) ? pStrecke.config.numToShow.hotels : 10;
    } else if (pStrecke.step == 'termine') {
        var numToShow = (pStrecke.config.numToShow.offers) ? pStrecke.config.numToShow.offers : 10;    
    } else {
        var numToShow = 10;
    }
    var numSites = Math.ceil(numResults / numToShow);
    var html = '';
    var link = '';
    var skipNode = document.createElement('div');
    var elemNaviLeft = document.createElement('div');
    var elemNaviRight = document.createElement('div');
    var elemNaviCenter = document.createElement('div');  
    var currentSite, isActive, className, nextSite, startSite;
    var curSite = this.oSkip.curSite / numToShow;
    var elemNavi = document.getElementById(this.targetId);
    
    if (!elemNavi) {
        return;
    }
    
    if (numSites <= 1) {
        jQuery(elemNavi).hide();
        return null;
    } else {
        if (jQuery(elemNavi)) {
            jQuery(elemNavi).show();
        }
    }
    
    elemNavi.innerHTML = '';
    
    elemNaviLeft.className = 'skipLeft';
    elemNaviRight.className = 'skipRight';
    elemNaviCenter.className = 'skipCenter';
    currentSite = curSite + 1;
    nextSite = currentSite + 1;
    startSite = currentSite - 1;
    
    if (startSite == 0) {
        startSite = 1;
    }
    
    if ((startSite + 3) > numSites) {
        startSite = numSites - 3;
    }
    
    if (startSite < 1) {
        startSite = 1;
    }
    
    var sort = '';
    if (getParams.hotelsortierung) {
        sort = 'hotelsortierung=' + getParams.hotelsortierung + '&';
    }
    
    for (var i = startSite; i < startSite + 4; i++) {
        if (i >= (numSites + 1)) {
            break;
        }
        
        link = pStrecke.step == 'hotel' ? 
            'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getHotelData.script.php?' + sort + 'topRegion=' + pStrecke.topReg + '&startposition=' + ((i - 1) * numToShow) + '\', pStrecke.config.idForm, null, \'pHotels.showList()\', null, null, true)' : 
            'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + '&startposition=' + ((i - 1) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        className = currentSite == i ? 'skipSiteActive' : 'skipSiteInActive';
        if (i == startSite + 3 || i == numSites) {
            className += ' skipSiteLast';
        }
        isActive = currentSite == i ? '1' : '0';
        html +=
            '<div class=\'' + className + '\' active="' + isActive + '" onclick="' + link + '">' + i + '</div>';
    }
    
    if (showNumSites) {
        html += '<div class=\'skipNumSites\'> van ' + numSites + '</div>'; // TODO i18n
    }
    
    if (currentSite > 1) {
        link = pStrecke.step == 'hotel' ? 
            'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getHotelData.script.php?' + sort + 'topRegion=' + pStrecke.topReg + '&startposition=' + ((curSite - 1) * numToShow) + '\', pStrecke.config.idForm, null, \'pHotels.showList()\', null, null, true)' : 
            'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + '&startposition=' + ((curSite - 1) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        elemNaviLeft.setAttribute('onclick', link);
    }
    if (nextSite <= numSites) {
        link = pStrecke.step == 'hotel' ? 
            'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getHotelData.script.php?' + sort + 'topRegion=' + pStrecke.topReg + '&startposition=' + ((currentSite) * numToShow) + '\', pStrecke.config.idForm, null, \'pHotels.showList()\', null, null, true)' : 
            'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + '&startposition=' + ((currentSite) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        elemNaviRight.setAttribute('onclick', link);  
    }
    
    elemNaviLeft.style.display = currentSite > 1 ? 'block' : 'none';
    elemNaviRight.style.display = nextSite <= numSites ? 'block' : 'none';
    skipNode.setAttribute('id', 'idStreckeSkip');
    elemNaviCenter.innerHTML = html;
    skipNode.appendChild(elemNaviLeft);
    skipNode.appendChild(elemNaviCenter);
    skipNode.appendChild(elemNaviRight);
    
    elemNaviLeft.innerHTML = '<img src="' + pStrecke.config.urlCustomerParams + 'img/neu/pfeil_links.gif" />';
    elemNaviRight.innerHTML = '<img src="' + pStrecke.config.urlCustomerParams + 'img/neu/pfeil_rechts.gif" />';
    if (showInactiveArrows) {
        if (currentSite <= 1) {
            elemNaviLeft.innerHTML = '<img src="' + pStrecke.config.urlCustomerParams + 'img/neu/pfeil_links_inaktiv.gif" />';
            elemNaviLeft.style.display = 'block';
            elemNaviLeft.style.cursor = 'default';
        }
        if (nextSite > numSites) {
            elemNaviRight.innerHTML = '<img src="' + pStrecke.config.urlCustomerParams + 'img/neu/pfeil_rechts_inaktiv.gif" />';
            elemNaviRight.style.display = 'block';
            elemNaviRight.style.cursor = 'default';
        }
    }
    
    // Tracking
    if (pTracking != null && typeof pTracking.track == 'function') {
        if (pStrecke.step == 'hotel') {
            pTracking.track('paginationHotel', true, currentSite + '/' + numSites);
        }
    }
    
    jQuery(skipNode).appendTo(jQuery('#' + this.targetId));
}

/**
 * Liefert eine Skipleiste, deren Seiten rotieren und die konfigurierbar ist
 */

TTListSkip.prototype.getSkipRotationExtended = function(oConfig) {
    var onclick;
    
    if (typeof oConfig.numResults == 'undefined') {
        oConfig.numResults = this.oSkip.numResults;
    }
    
    if (typeof oConfig.numItemsToRotate == 'undefined') {
        oConfig.numItemsToRotate = 3;
    }
    
    if (typeof oConfig.numToShow == 'undefined') {
        oConfig.numToShow = 10;
    }
    
    if (typeof oConfig.posCurrent == 'undefined') {
        oConfig.posCurrent = 2;
    }
    
    if (typeof oConfig.showMaxValues == 'undefined') {
        oConfig.showMaxValues = true;
    }
    
    if (typeof oConfig.fillingBeforeMax == 'undefined') {
        oConfig.fillingBeforeMax = '...';
    }
    
    // Nur dann wird überhaupt irgendwas rotiert
    if (typeof oConfig.minResultsForRotation == 'undefined') {
        oConfig.minResultsForRotation = 6;
    }
    
    // Selbst wenn es genug Ergebnisse gibt wird erst ab dieser Seite rotiert
    if (typeof oConfig.minPageForRotation == 'undefined') {
        oConfig.minPageForRotation = 5;
    }
    
    if (typeof oConfig.currentSite == 'undefined') {
        oConfig.currentSite = this.oSkip.currentPage;
    }
    
    if (oConfig.currentSite == '0') {
        oConfig.currentSite = '1';
    }
    
    if (typeof this.oSkip.curSite != 'undefined' && pStrecke.config.groupByServicesAjaxTermin) {
        oConfig.currentSite = this.oSkip.curSite;
    }
    
    var numToShow = oConfig.numToShow;
    var html = '';
    var skipNode = document.createElement('div');
    var classDivRotate;
    var maxSkipValue;
    var maxPage = oConfig.numResults / oConfig.numToShow;
    var maxValueForNextBtn;
    var sort = '';
    
    if (getParams.hotelsortierung) {
        sort = '&sortierung=' + getParams.hotelsortierung + '&';
    } else if (typeof $('#hotelsortierung')[0] != 'undefined' && $('#hotelsortierung').val() != '') {
        sort = '&sortierung=' + $('#hotelsortierung').val();
    } else if (typeof pStrecke.objects.sortierung != 'undefined') {
        sort = '&sortierung=' + pStrecke.objects.sortierung;
    }
    
    // Anzahl Ergebnisse runden
    if (maxPage > parseInt(maxPage)) {
        maxPage = parseInt(maxPage) + 1;
    }    
    
    if (oConfig.currentSite < oConfig.posCurrent) {
        oConfig.posCurrent = oConfig.currentSite;
    }
    
    // Obergrenze erreicht
    if ((oConfig.currentSite + oConfig.numItemsToRotate - (oConfig.posCurrent - 1)) > maxPage) {
        oConfig.posCurrent = oConfig.currentSite + oConfig.numItemsToRotate - maxPage;
    }
    
    maxSkipValue = (oConfig.currentSite + oConfig.numItemsToRotate - oConfig.posCurrent);
    maxValueForNextBtn = maxSkipValue;
    
    var showMaxValuesPrev = oConfig.showMaxValues;
    var showMaxValuesNext = oConfig.showMaxValues;
    
    // keine Rotation weil zu wenig Seiten
    if (oConfig.minResultsForRotation > maxPage) {
        oConfig.posCurrent = oConfig.currentSite;
        maxSkipValue = maxPage;
        maxValueForNextBtn = oConfig.currentSite;
        showMaxValuesPrev = false;
        showMaxValuesNext = false;
    } else if (oConfig.currentSite < oConfig.minPageForRotation) {
        // keine Rotation weil min-Seite nicht erreicht
        oConfig.posCurrent = oConfig.currentSite;
        maxSkipValue = oConfig.minPageForRotation - 1;
        showMaxValuesPrev = false;
        showMaxValuesNext = true;    
    }
    
    if (typeof oConfig.url == 'undefined') {
        oConfig.url = 'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + sort;
    }    
    
    // Zurück Button
    if (oConfig.currentSite > 1) {
        onclick = oConfig.url + '&startposition=' + ((oConfig.currentSite - 2) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (oConfig.currentSite - 1) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
         
        html += 
            '<div class="ttListSkipElementBack" onclick="' 
                + onclick 
            + '"><img src="/images/spacer.gif" alt=""/></div>';
    }
    
    if (showMaxValuesPrev && oConfig.currentSite > 1) {
        onclick = oConfig.url + '&startposition=0\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (1) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
                
        html += 
            '<div class="ttListSkipElementMinPage" onclick="' 
                + onclick  
            + '">1</div>'
            + '<div class="ttListSkipElementMinPageFilling">' + oConfig.fillingBeforeMax + '</div>';        
    }
    
    html += '<div class="ttListSkipRotation">';
    
    for (var i = (oConfig.currentSite - oConfig.posCurrent + 1); i <= maxSkipValue; i++) {
        onclick = oConfig.url + '&startposition=' + ((i - 1) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + i + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
        
        classDivRotate = i == oConfig.currentSite ? 'ttListSkipElementRotateActive' : 'ttListSkipElementRotate';
        html += 
            '<div class="' + classDivRotate + '" onclick="' 
                + onclick 
            + '">' + i + '</div>';
    }
    
    html += '</div>';
    
    if (showMaxValuesNext && maxValueForNextBtn < maxPage) {
        onclick = oConfig.url + '&startposition=' + ((maxPage - 1) * oConfig.numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (maxPage) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
                
        html += 
            '<div class="ttListSkipElementMaxPageFilling">' + oConfig.fillingBeforeMax + '</div>'       
            + '<div class="ttListSkipElementMaxPage" onclick="' 
                + onclick 
            + '">' + maxPage + '</div>';
    }    
    
    // Weiter Button
    if (oConfig.currentSite < maxPage) {
        onclick = oConfig.url + '&startposition=' + (oConfig.currentSite * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (parseInt(oConfig.currentSite) + 1) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
                
        html += 
            '<div class="ttListSkipElementNext" onclick="' 
                + onclick 
            + '"><img src="/images/spacer.gif" alt=""/></div>';
    }    
    
    skipNode.innerHTML = html;
    
    return jQuery(skipNode);
}

/**
 * Liefert eine weitere Skipleiste, deren Seiten rotieren und die konfigurierbar ist
 */

TTListSkip.prototype.getSkipRotationPlainExtended = function(oConfig) {
    var onclick;
    
    if (typeof oConfig.numResults == 'undefined') {
        oConfig.numResults = this.oSkip.numResults;
    }

    if (typeof oConfig.numItemsToRotate == 'undefined') {
        oConfig.numItemsToRotate = 3;
    }
    
    if (typeof oConfig.numToShow == 'undefined') {
        oConfig.numToShow = 10;
    }
    
    if (typeof oConfig.posCurrent == 'undefined') {
        oConfig.posCurrent = 2;
    }
    
    // Nur dann wird überhaupt irgendwas rotiert
    if (typeof oConfig.minResultsForRotation == 'undefined') {
        oConfig.minResultsForRotation = 5;
    }
    
    // Selbst wenn es genug Ergebnisse gibt wird erst ab dieser Seite rotiert
    if (typeof oConfig.minPageForRotation == 'undefined') {
        oConfig.minPageForRotation = 3;
    }
    
    if (typeof oConfig.currentSite == 'undefined') {
        oConfig.currentSite = this.oSkip.currentPage;
    }
    
    if (oConfig.currentSite == '0') {
        oConfig.currentSite = '1';
    }
    
    if (typeof this.oSkip.curSite != 'undefined' && pStrecke.config.groupByServicesAjaxTermin) {
        oConfig.currentSite = this.oSkip.curSite;
    }

    if (typeof oConfig.minPageText == 'undefined')   oConfig.minPageText   = '';
    if (typeof oConfig.maxPageText == 'undefined')   oConfig.maxPageText   = '';
    if (typeof oConfig.nextPageText == 'undefined')  oConfig.nextPageText  = '';
    if (typeof oConfig.prevPageText == 'undefined')  oConfig.prevPageText  = '';
    if (typeof oConfig.pageSeparator == 'undefined') oConfig.pageSeparator = '';
    if (typeof oConfig.skipPrefix == 'undefined')    oConfig.skipPrefix    = '';
    if (typeof oConfig.skipSuffix == 'undefined')    oConfig.skipSuffix    = '';

    
    oConfig.showMaxValues = true;
    var numToShow = oConfig.numToShow;
    var html = '';
    var skipNode = document.createElement('div');
    var classDivRotate;
    var maxSkipValue;
    var maxPage = oConfig.numResults / oConfig.numToShow;
    var maxValueForNextBtn;
    var sort = '';
    
    if (getParams.hotelsortierung) {
        sort = '&sortierung=' + getParams.hotelsortierung + '&';
    } else if (typeof $('#hotelsortierung')[0] != 'undefined' && $('#hotelsortierung').val() != '') {
        sort = '&sortierung=' + $('#hotelsortierung').val();
    } else if (typeof pStrecke.objects.sortierung != 'undefined') {
        sort = '&sortierung=' + pStrecke.objects.sortierung;
    }
    
    // Anzahl Ergebnisse runden
    if (maxPage > parseInt(maxPage)) {
        maxPage = parseInt(maxPage) + 1;
    }    
    
    if (oConfig.currentSite < oConfig.posCurrent) {
        oConfig.posCurrent = oConfig.currentSite;
    }
    
    // Obergrenze erreicht
    if ((oConfig.currentSite + oConfig.numItemsToRotate - (oConfig.posCurrent - 1)) > maxPage) {
        oConfig.posCurrent = oConfig.currentSite + oConfig.numItemsToRotate - maxPage;
    }
    
    maxSkipValue = (oConfig.currentSite + oConfig.numItemsToRotate - oConfig.posCurrent);
    maxValueForNextBtn = maxSkipValue;
    
    var showMaxValuesPrev = oConfig.showMaxValues;
    var showMaxValuesNext = oConfig.showMaxValues;
    
    // keine Rotation weil zu wenig Seiten
    if (oConfig.minResultsForRotation > maxPage) {
        oConfig.posCurrent = oConfig.currentSite;
        maxSkipValue = maxPage;
        maxValueForNextBtn = oConfig.currentSite;
        showMaxValuesPrev = false;
        showMaxValuesNext = false;
    } else if (oConfig.currentSite < oConfig.minPageForRotation) {
        // keine Rotation weil min-Seite nicht erreicht
        oConfig.posCurrent = oConfig.currentSite;
        maxSkipValue = oConfig.minPageForRotation - 1;
        showMaxValuesPrev = false;
        showMaxValuesNext = true;    
    }
    
    if (typeof oConfig.url == 'undefined') {
        oConfig.url = 'sendPostRequest(\'' + pathDevAbsolute + 'booking/ibe_ajax/inc/getTerminData.script.php?topRegion=' + pStrecke.topReg + '&IFF=' + pStrecke.iff + sort;
    }    
    
    if (oConfig.currentSite > 1) {
        // Anfang Button
        onclick = oConfig.url + '&startposition=0\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (1) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
                
        html += 
            '<div class="ttListSkipElementMinPage" onclick="' 
                + onclick  
            + '">' + oConfig.minPageText + '</div>';

        // Zurück Button
        onclick = oConfig.url + '&startposition=' + ((oConfig.currentSite - 2) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (oConfig.currentSite - 1) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
         
        html += 
            '<div class="ttListSkipElementBack" onclick="' 
                + onclick 
            + '">&lt; rückwärts</div>';
    }
    
    if (oConfig.skipPrefix != '' && maxSkipValue > 0) {
        html += '<div class="ttListSkipPrefix">' + oConfig.skipPrefix + '</div>';
    }
    
    html += '<div class="ttListSkipRotation">';
    var pageSeparatorDiv = '';
    
    for (var i = oConfig.currentSite - oConfig.posCurrent + 1; i <= maxSkipValue; i++) {
        if (i > oConfig.currentSite - oConfig.posCurrent + 1 && oConfig.pageSeparator != '') {
            pageSeparatorDiv = '<div class="ttListSkipSeparator">' + oConfig.pageSeparator + '</div>';
        }
        onclick = oConfig.url + '&startposition=' + ((i - 1) * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + i + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
        
        classDivRotate = i == oConfig.currentSite ? 'ttListSkipElementRotateActive' : 'ttListSkipElementRotate';
        html +=
            pageSeparatorDiv 
            + '<div class="' + classDivRotate + '" onclick="' 
                + onclick 
            + '">' + i + '</div>';
    }
    
    html += '</div>';
    
    if (oConfig.skipSuffix != '' && maxSkipValue > 0) {
        html += '<div class="ttListSkipSuffix">' + oConfig.skipSuffix + '</div>';
    }
    
    if (oConfig.currentSite < maxPage) {
        // Weiter Button
        onclick = oConfig.url + '&startposition=' + (oConfig.currentSite * numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (parseInt(oConfig.currentSite) + 1) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
                
        html += 
            '<div class="ttListSkipElementNext" onclick="' 
                + onclick 
            + '">vorwärts &gt;</div>';

        // Ende Button
        onclick = oConfig.url + '&startposition=' + ((maxPage - 1) * oConfig.numToShow) + '\', pStrecke.config.idForm, null, \'pTermine.showList()\', null, null, true)';
        
        if (pStrecke.config.groupByServicesAjaxTermin) {
            onclick = 'pStrecke.oSkip.curSite=' + (maxPage) + ';pTermine.showList(false, \'' + pTermine.terminListGroupName + '\')';
        }
                
        html += 
            '<div class="ttListSkipElementMaxPage" onclick="' 
                + onclick 
            + '">&gt;&gt;</div>';
    }    

    skipNode.innerHTML = html;
    
    return jQuery(skipNode);
}