var $,ajaxrequest,buildpage,exports;$=jQuery;exports=this;exports.setitems_url=setitems_url;buildpage=function(data){var arrow,c,column,columns,html,i,linfo,newdirection,pages_html,pages_tmpl,style,title_html,title_tmpl,tmpl,_i,_len;buildrows(data.items,'archive');$('div.pages').html(pagination(data,'archive'));if(data.items.length){pages_tmpl=gettext('Showing items {{first_item}} to {{last_item}} of {{item_count}}.');pages_html=$.mustache(pages_tmpl,data);title_tmpl=gettext('Messages :: Archive :: Showing page {{page}} of {{page_count}} pages.');title_html=$.mustache(title_tmpl,data);}else{pages_html=gettext('No items found');title_html=gettext('Messages :: Archive');}$('div.toolbar p').html(pages_html);$('#title').html(title_html);$.address.title('.:. Baruwa :: '+title_html);$('div.pages a').click(function(e){var url;url=$(this).attr('href')+'.json';return ajaxify(e,url);});columns=['timestamp','from_address','to_address','subject','size','sascore'];linfo=[gettext('Date/Time'),gettext('From'),gettext('To'),gettext('Subject'),gettext('Size'),gettext('Score')];style=['.date_heading','.from_heading','.to_heading','.subject_heading','.size_heading','.score_heading'];tmpl='<a href="/messages/archive/{{order_by}}/{{direction}}/1">{{column}}</a>';for(i=_i=0,_len=columns.length;_i<_len;i=++_i){column=columns[i];html=$.mustache(tmpl,{'order_by':column,'direction':data.direction,'column':linfo[i]});if(column===data.order_by){if(data.direction==='dsc'){newdirection='asc';c='&nbsp;&uarr;';}else{newdirection='dsc';c='&nbsp;&darr;';}arrow=$.mustache(tmpl,{'order_by':data.order_by,'direction':newdirection,'column':c});html=html+arrow;}replacelink(html,style[i]);1;}$('thead a').click(function(e){var url;url=$(this).attr('href')+'.json';return ajaxify(e,url);});return 1;};ajaxrequest=function(url){if(!$('#shield').length)$('#wrap').after(exports.loading);else $('#shield').show();$.ajax(url,{type:'GET',cache:false,dataType:'json',success:buildpage});return 1;};$(document).ready(function(){exports.inprogress=false;$('div.pages a').click(function(e){var url;url=$(this).attr('href')+'.json';return ajaxify(e,url);});$('thead a').click(function(e){var url;url=$(this).attr('href')+'.json';return ajaxify(e,url);});$('html').ajaxStart(function(){return exports.inprogress=true;}).ajaxError(display_global_ajax_error).ajaxComplete(function(){exports.inprogress=false;$('#shield').hide();if($(window).scrollTop())return $('html,body').animate({scrollTop:$("#header-bar").offset().top},1500);}).ajaxSuccess(function(){if($('#alertmsg').length){$('#alertmsg').empty();return $('#alertmsg').remove();}});$('a').click(disable_links);$.address.externalChange(function(e){var url;if(e.path==='/'){$.address.history($.address.baseURL());return;}url=$.address.value()+'.json';return ajaxify(e,url);});$('#sarchivetop, #sarchivebottom').change(function(){var n;n=$(this).val();return location.href=""+exports.setitems_url+"?n="+n;});return 1;});