queryString = '&t=3&l=s&b=1&br=1'; /*-------------------------GLOBALS-------------------------*/ var currentRecord = 0; var pagingSize = 9; recordCount = 28; var previousPage; var currentPage; var nextPage; var active = false; /*---------------------------------------------------------------*/ //Event.observe(window, 'load', init, false); window.onload = init; function init() { //alert('hello'); //showNavigation(); getTableData(); setTimeout(function() {getNextData();}, 500 ); } function getTableData() { pagina = Math.ceil((currentRecord/pagingSize)); document.getElementById("loading").style.display="block"; var myAjax = new Ajax.Request( 'flow.php?pagi='+pagina+'&action=page¤t='+currentRecord+'&size='+pagingSize+queryString, { method: 'get', parameters: '', onComplete: function(response) { // alert(response.responseText); // alert(pagina); currentPage = eval('(' + response.responseText + ')'); showNavigation(); drawTable(currentPage, $('view')); document.getElementById("loading").style.display="none"; } }); //showNavigation(); } function getNextData() { active = true; pagina = Math.ceil(((currentRecord+pagingSize)/pagingSize)); var myAjax = new Ajax.Request( 'flow.php?pagi='+pagina+'&action=page¤t='+(currentRecord+pagingSize)+'&size='+pagingSize+queryString, { method: 'get', parameters: '', onComplete: function(response) { nextPage = eval('(' + response.responseText + ')'); active = false; // alert(pagina); } }); } function getPreviousData() { if((currentRecord - pagingSize) >= 0) { //$('previous').innerHTML = ''; pagina = Math.ceil(((currentRecord-pagingSize)/pagingSize)); active = true; var myAjax = new Ajax.Request( 'flow.php?pagi='+pagina+'&action=page¤t='+(currentRecord-pagingSize)+'&size='+pagingSize+queryString, { method: 'get', parameters: '', onComplete: function(response) { previousPage = eval('(' + response.responseText + ')'); active = false; //drawTable(previousPage,$('previous')); } }); } else { //$('previous').innerHTML = ''; } } /*---------------------------------------------------------------*/ function drawTable(page, contain) { var l = 0; table = ''; for(i = 0; i < page['players'].length; i++) { l++; switch (page['players'][i].categoria) { case "1": // alert('i am here'); if (page['players'][i].refnum != 'NULL') { elrefnum = ' (#' + page['players'][i].refnum +') '; } else { elrefnum = ""; } laliga = "Puerto_vallarta_bienes_raices_"; table += ''; if ((l % 3) == 0 && l < page['players'].length) { table +=''; if (l < page['players'].length) { table += ''; } } break; case "0": table += ''; showNavigation(0); break; } } table += '
'+ '
'+ ''+ '' + page['players'][i].nombre + '
'+ ''+ ''+ ''+ '
' + page['players'][i].nombre +'
'+ elrefnum + page['players'][i].zona + '
'; if (page['players'][i].especial == 1) { table +='
Tropicasa New Listing!
'; } if (page['players'][i].especial == 2) { table +='
Tropicasa Reduced Price!
'; } if (page['players'][i].especial == 3) { table +='
This listing is SOLD!!
'; } if (page['players'][i].especial == 4) { table +='
This listing is in Escrow!
'; } if (page['players'][i].especial == 5) { table +='
Tropicasa Special!
'; } table +='
' + page['players'][i].descripcion + '
$' + page['players'][i].price + '.00 Send me more information on this listing!'; if (page['players'][i].mapa == 'yes') { table +='View in Google Maps!'; } table +='
Disculpe las molestias, pero no se encontro ningun listado con las caracteristicas deseadas!
'; //alert(table); contain.innerHTML = table; } function getPage(cuantos) { if(!active) { currentRecord = cuantos; showNavigation(); getNextData(); getPreviousData(); getTableData(); drawTable(currentPage, $('view')); } } function getNextPage() { if(!active) { currentRecord += pagingSize; showNavigation(); previousPage = currentPage; currentPage = nextPage; drawTable(currentPage, $('view')); getNextData(); } } function getPreviousPage() { if(!active) { currentRecord -= pagingSize; showNavigation(); nextPage = currentPage; currentPage = previousPage; drawTable(currentPage, $('view')); getPreviousData(); } } function showNavigation(siono) { // build page links //alert("Results " + (currentRecord+1) + " - " + (currentRecord+pagingSize) + " of " + recordCount + " records"); if(siono != 0) { var todos = Math.ceil(recordCount / pagingSize); var pages = ''; if (todos >=2) { $('numRec').innerHTML = pages; $('numRec2').innerHTML = $('numRec').innerHTML; } else { $('numRec').innerHTML = ''; $('numRec2').innerHTML = $('numRec').innerHTML; $('resultpage2').innerHTML = $('numRec').innerHTML; $('resultpage').innerHTML = $('numRec').innerHTML; } if ((currentRecord + pagingSize) >= recordCount) { $('currentRec').innerHTML = "Resultados " + (currentRecord+1) + " - " + recordCount + " of " + recordCount; $('currentRec2').innerHTML = $('currentRec').innerHTML; $('nextLink').innerHTML = '' $('nextLink2').innerHTML = $('nextLink').innerHTML; } else { $('currentRec').innerHTML = "Resultados " + (currentRecord+1) + " - " + (currentRecord+pagingSize) + " of " + recordCount; $('currentRec2').innerHTML = $('currentRec').innerHTML; $('nextLink').innerHTML = 'Siguiente'; $('nextLink2').innerHTML = $('nextLink').innerHTML; } if (currentRecord == 0) { $('previousLink').innerHTML = ''; $('previousLink2').innerHTML = $('previousLink').innerHTML; }else { $('previousLink').innerHTML = 'Anterior'; $('previousLink2').innerHTML = $('previousLink').innerHTML; } } else { $('numRec').innerHTML = ""; $('numRec2').innerHTML = ""; /*$('nextLink2').style.visibility = 'hidden'; $('previousLink2').style.visibility = 'hidden'; $('nextLink2').innerHTML = '' $('previousLink2').innerHTML = '' $('currentRec2').innerHTML = ''; $('currentRec').innerHTML = ''; $('result').innerHTML = ''; $('result2').innerHTML = ''; */ $('result').style.visibility = 'hidden'; $('result2').style.visibility = 'hidden'; $("loading").style.display="none"; } }