
var currentRecord=0;var recordCount;var previousPage;var currentPage;var nextPage;var active=false;if(!pagingSize){var pagingSize=3;}
if(!searchTerm){var searchTerm='';}
if(!filterID){var filterID='';}
switch(listboxType){case"listbox":lType='listbox';break;case"listboxMini":lType='listboxMini';break;default:lType='listbox';break;}
Event.observe(window,'load',init,false);function init(){getRecordCount();showNavigation();getTableData();setTimeout(function(){getNextData();},500);}
function getRecordCount(){var myAjax=new Ajax.Request('/engine/responders/listbox/count/'+listboxTable+'/'+listboxCategory,{method:'get',parameters:'',onComplete:function(response){recordCount=response.responseText;}});}
function getTableData(){var myAjax=new Ajax.Request('/engine/responders/listbox/'+listboxTable+'/'+listboxCategory+'/'+sort+'/'+sorton+'/'+currentRecord+'/'+pagingSize+'/'+searchTerm+'/'+filterID,{method:'get',parameters:'',onComplete:function(response){currentPage=eval('('+response.responseText+')');drawTable(currentPage,$('view'));}});}
function getNextData(){$('next').innerHTML='';active=true;var myAjax=new Ajax.Request('/engine/responders/listbox/'+listboxTable+'/'+listboxCategory+'/'+sort+'/'+sorton+'/'+(currentRecord+pagingSize)+'/'+pagingSize+'/'+searchTerm+'/'+filterID,{method:'get',parameters:'',onComplete:function(response){nextPage=eval('('+response.responseText+')');active=false;drawTable(nextPage,$('next'));}});}
function getPreviousData(){if((currentRecord-pagingSize)>=0){$('previous').innerHTML='';active=true;var myAjax=new Ajax.Request('/engine/responders/listbox/'+listboxtable+'/'+listboxCategory+'/'+sort+'/'+sorton+'/'+(currentRecord-pagingSize)+'/'+pagingSize+'/'+searchTerm+'/'+filterID,{method:'get',parameters:'',onComplete:function(response){previousPage=eval('('+response.responseText+')');active=false;drawTable(previousPage,$('previous'));}});}
else{$('previous').innerHTML='';}}
function drawTable(page,contain){partials='<div class="partials">';alt='';for(i=0;i<page['produkties'].length;i++){category=page['produkties'][i].type;category=category.toLowerCase();partials+='<div id="'+page['produkties'][i].produktieid+'"class="'+lType+'Partial" onmouseover="this.className=\''+lType+'PartialActive\'" onmouseout="this.className=\''+lType+'Partial\'" onclick="window.location=\'/'+topCategory+'/'+category+'/id/'+page['produkties'][i].produktieid+'\'"'+'>'+'<div class="'+lType+'Still"><img src="'+mediaBase+'/'+topCategory+'/'+page['produkties'][i].type+'/'+page['produkties'][i].directory+'/'+lType+'.jpg" class="'+lType+'Still"></div>'+'<div class="'+lType+'Head">'+page['produkties'][i].name+'</div>';if(lType=='listbox'){partials+='<div class="'+lType+'Text">'+page['produkties'][i].textShort+'</div>';}
partials+='</div>';(alt=='')?alt='Alt':alt='';}
partials+='</div>';contain.innerHTML=partials;}
function getNextPage(){if(!active){currentRecord+=pagingSize;showNavigation();previousPage=currentPage;currentPage=nextPage;drawTable(currentPage,$('view'));drawTable(previousPage,$('previous'));getNextData();}}
function getPreviousPage(){if(!active){currentRecord-=pagingSize;showNavigation();nextPage=currentPage;currentPage=previousPage;drawTable(currentPage,$('view'));drawTable(nextPage,$('next'));getPreviousData();}}
function showNavigation(){var lastSpanRecord=currentRecord+pagingSize;var pageNumber=currentRecord/pagingSize;var firstSpanRecord=currentRecord+1;if((currentRecord+pagingSize)>recordCount){lastSpanRecord=recordCount;}
if(pagingSize>=recordCount){lastSpanRecord=recordCount;}
$('aantalInfo').innerHTML='<img src="http://media.netwerk6.nl/vormgeving/searchnav/'+firstSpanRecord+"-"+lastSpanRecord+'.png" border="0">';$('currentRec').innerHTML=pageNumber+1;if(!$('view').innerHTML){$('view').addClassName='loading';}
(currentRecord==0)?$('previousLink').style.display='none':$('previousLink').style.display='visible';((currentRecord+pagingSize)>=recordCount)?$('nextLink').style.display='none':$('nextLink').style.display='visible';}
