function listing_count(buffer, pageNo, totalPages, firstIndex, lastIndex, totalResults, totalMapSearchCount) {
buffer.append('
');
if (totalMapSearchCount != null && totalMapSearchCount > 200) {
buffer.append('
Only displaying the first 200 listings found. Please zoom the map or refine your search criteria.
');
}
pageLinks(buffer, pageNo, totalPages);
var str = 'Listings ${1} - ${2} of ${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('');
if (pageNo > 1) {
buffer.append(' ');
} else {
buffer.append(' ');
}
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(' | ');
buffer.append('');
if (pageNo < totalPages) {
buffer.append(' ');
} else {
buffer.append(' ');
}
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('');
buffer.append('');
buffer.append('');
listing_count(buffer, pageNo, totalPages, firstIndex, lastIndex, totalResults);
buffer.append('
');
} else {
buffer.append('');
buffer.append('');
buffer.append('None of the listings meet your search criteria');
buffer.append('
');
}
return buffer.toString();
}