function listing_count(buffer, pageNo, totalPages, firstIndex, lastIndex, totalResults, totalMapSearchCount) { buffer.append('
'); if (totalMapSearchCount != null && totalMapSearchCount > 200) { buffer.append('
Seuls les 200 premières annonces trouvées sont affichées. Veuillez zoomer sur la carte ou affinez vos critères de recherche.
'); } pageLinks(buffer, pageNo, totalPages); var str = 'annonces ${1} - ${2} sur ${3}'; str = str.replace('$\{1\}', firstIndex); str = str.replace('$\{2\}', lastIndex); str = str.replace('$\{3\}', totalResults); buffer.append('

'+str+'

'); buffer.append('
'); } function pageLinks(buffer, pageNo, totalPages) { buffer.append(''); buffer.append(''); buffer.append(''); buffer.append(''); buffer.append(''); buffer.append('
'); if (pageNo > 1) { buffer.append(''); } else { buffer.append(' '); } buffer.append(''); var minPage = pageNo - 5; if (minPage <= 0) { minPage = 1; } var maxPage = pageNo + 5; if (maxPage > totalPages) { maxPage = totalPages; } buffer.append('
'); for (var i = minPage; i <= maxPage; i++) { if (i == pageNo) { buffer.append('' + pageNo + ''); } else { buffer.append(' ' + i + ' '); } } buffer.append('
'); buffer.append('
'); if (pageNo < totalPages) { buffer.append(''); } else { buffer.append(' '); } buffer.append('
'); } function create_results_page(firstIndex, listings, pageNo, totalPages, lastIndex, totalResults) { var buffer = new StringBuffer(); if (listings != null && listings.length > 0) { buffer.append('
'); buffer.append('\n'); buffer.append('
'); if(typeof totalMapSearchCount === "undefined"){ totalMapSearchCount = totalResults; } listing_count(buffer, pageNo, totalPages, firstIndex, lastIndex, totalResults, totalMapSearchCount); buffer.append('
'); buffer.append(''); // todo: select current sort order buffer.append(''); //buffer.append('     '); buffer.append('
'); buffer.append('
'); buffer.append('
'); buffer.append('
'); buffer.append('
'); buffer.append('
'); var two_col = isWide(); if(two_col) buffer.append(''); for (var i = 0; i < listings.length; i++) { if (two_col == true){ if (i % 2 == 0) { buffer.append(''); } else { buffer.append(''); } buffer.append(''); if (i % 2 == 1 || i == listings.length - 1) { buffer.append(''); } } } if (two_col == true) buffer.append('
'); } listing_text(buffer, firstIndex + i, listings[i]); if (two_col == true){ buffer.append('
'); buffer.append('
'); buffer.append('
'); listing_count(buffer, pageNo, totalPages, firstIndex, lastIndex, totalResults); buffer.append('
'); } else { buffer.append('
'); buffer.append('\n'); buffer.append('
'); buffer.append('

'); buffer.append('Aucun annonce ne correspond à vos critères de recherche.'); buffer.append('

'); } return buffer.toString(); }