Cwo.RegisterNamespace("Cwo.Search");Cwo.Search.PagingController=function(c,e,d,f,a,g){var b=this;this.RenderButtons=function(j){var t="",o=isNaN(j)?c():j,r=f(),l=a(),s=Math.ceil(r/l),q,p=Math.ceil(r/l);scroll(0,0);if(p>0){var k=$("#ResultsListPagingSummary");if(k.length){k.text("Page "+o.toString()+" of "+p)}else{var n=$(".ResultsListPagingSummary");if(n.length){$.each(n,function(u,i){$(i).text("Page "+o.toString()+" of "+p)})}}}if(s>1){if(o>1){t+=b.ButtonHtml(o-1,"Prev",o)}for(q=-2;q<3;q++){var h=parseInt(q,10)+parseInt(o,10);if((h>0)&&(h<=s)){t+=b.ButtonHtml(h,h,o)}}if((parseInt(o,10)===1)&&(s>=4)){t+=b.ButtonHtml(parseInt(4,10),parseInt(4,10),o)}if((parseInt(o,10)<3)&&(s>=5)){t+=b.ButtonHtml(parseInt(5,10),parseInt(5,10),o)}if(o<s){t+=b.ButtonHtml(parseInt(1,10)+parseInt(o,10),"Next",o)}}var m=e.length;for(q=0;q<m;q++){$("#"+e[q]).html(t);$("#"+e[q]+" .pagingbutton").bind("click",function(i){var u=$(this).attr("pagenumber");b.RenderButtons(u);d(u)})}};Cwo.Page.EventController.Subscribe(g,this.RenderButtons);this.ButtonHtml=function(k,j,h){if(typeof(j)==="undefined"){j=k}var i=" <li";if((+k)===(+h)){i+=' class="Selected"'}i+='><a class="pagingbutton" pagenumber="'+k+'" a href="#Page '+k+'" title="'+j+'">'+j+"</a></li>";return i}};$(document).ready(function(){var b=$("#ForSaleFilters");if(b){var a=b.find("li.Selected");if(a.length>0){var c=a[a.length-1];$(c).find("li").addClass("Last")}}});
