/*    HTTP Host:  b.static.ak.fbcdn.net                                        */
/*    Generated:  February 9th 2010 11:49:40 AM PST                            */
/*      Machine:  10.16.140.109                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/3j0op9zxc7y8wg44.pkg.js h:9p4xp97y                        */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/3j0op9zxc7y8wg44.pkg.js                                   */

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/3j0op9zxc7y8wg44.pkg.js"]); }

Arbiter.inform("template\/registerTemplate", {"name":"\/templates\/UIPager.tmpl","template":"\n<span class=\"UIPager\" bindPoint =\"root\">\n  <span class=\"UIPager_PageNum\" bindPoint=\"pageNumber\"><\/span>\n  <span class=\"UIPager_ButtonWrapper\" bindPoint=\"backWrapper\">\n    <a class=\"UIPager_Button UIPager_ButtonBack\" bindPoint=\"backRoot\" href=\"#\"><\/a>\n  <\/span>\n  <span class=\"UIPager_ButtonWrapper\" bindPoint=\"forwardWrapper\">\n    <a class=\"UIPager_Button UIPager_ButtonForward\" bindPoint=\"forwardRoot\" href=\"#\"><\/a>\n  <\/span>\n<\/span>\n"}, Arbiter.BEHAVIOR_PERSISTENT);
function UIPager(_L0,_L1,_L2,_L3){copy_properties(this,{_rm:new RenderManager(this),_callback:_L3||bagofholding,_backHandler:null,_forwardHandler:null,_maxPerPage:_L1,_total:_L0,_offset:_L2,_isDisabled:false,root:null,backRoot:null,forwardRoot:null,pageNumber:null,backWrapper:null,fowardWrapper:null});this.parent.construct(this,URI('/templates/UIPager.tmpl'));this._summaryTextHandler=this._getSummaryText;this._rm.dirty();this._setupHandlers();return this;}UIPager.extend('TemplateObject');UIPager.prototype._setupHandlers=function(){this._backHandler=Event.listen(this.backRoot,'click',this._handleClick.bind(this,'back'));this._forwardHandler=Event.listen(this.forwardRoot,'click',this._handleClick.bind(this,'forward'));};UIPager.prototype._handleClick=function(_L0){var _L1;var dir;if(_L0=='forward'){_L1=this.forwardWrapper;dir=1;}else{_L1=this.backWrapper;dir=-1;}if(!CSS.hasClass(_L1,'UIPager_ButtonDisabled')){this._offset=this._offset+(dir*this._maxPerPage);this._callback(this._offset,dir);this._rm.dirty();}return false;};UIPager.prototype._getSummaryText=function(_L0,_L1,_L2){if(_L1==0)return '';if(_L1<=_L2){if(_L1==1){return _tx("1 resultat");}else return _tx("{number_of_results} results",{number_of_results:_L1});}else{if(_L0+_L2<_L1){var _L3=((_L0/_L2+1)*_L2);}else var _L3=_L1;if(_L1>500){var _L4=_tx("{starting_offset}{ending_offset} av over {number_of_results} resultater",{starting_offset:(_L0+1),ending_offset:_L3,number_of_results:500});}else var _L4=_tx("{starting_offset}-{ending_offset} av {number_of_results} treff",{starting_offset:(_L0+1),ending_offset:_L3,number_of_results:_L1});return _L4;}};UIPager.prototype.setCallback=function(_L0){this._callback=_L0;return this;};UIPager.prototype.setMaxPerPage=function(_L0){this._maxPerPage=Math.max(_L0,0);this._rm.dirty();return this;};UIPager.prototype.setTotal=function(_L0){this._total=Math.max(_L0,0);this._rm.dirty();return this;};UIPager.prototype.setOffset=function(_L0){this._offset=Math.max(_L0,0);this._rm.dirty();return this;};UIPager.prototype.setPage=function(_L0){this._offset=Math.max(_L0-1,0)*this._maxPerPage;this._rm.dirty();return this;};UIPager.prototype.setDisabled=function(_L0){this._isDisabled=_L0;this._rm.dirty();return this;};UIPager.prototype._getCurrentPage=function(){return this._offset/this._maxPerPage+1;};UIPager.prototype._getPageCount=function(){return Math.ceil(this._total/this._maxPerPage);};UIPager.prototype.setSummaryTextHandler=function(fn){this._summaryTextHandler=fn;this._rm.dirty();return this;};UIPager.prototype._setDisabled=function(_L0,_L1){var _L2;if(_L0=="back"){_L2=this.backWrapper;}else if(_L0=="forward")_L2=this.forwardWrapper;CSS.conditionClass(_L2,'UIPager_ButtonDisabled',_L1);return this;};UIPager.prototype.paint=function(){if(this._offset==0||this._isDisabled){this._setDisabled("back",true);}else this._setDisabled("back",false);if((this._offset+this._maxPerPage)>=this._total||this._isDisabled){this._setDisabled("forward",true);}else this._setDisabled("forward",false);var _L0=this._summaryTextHandler(this._offset,this._total,this._maxPerPage);if(_L0){DOM.setContent(this.pageNumber,_L0);}else hide(this.pageNumber);};UIPager.prototype.resetPager=function(_L0,_L1,_L2,_L3){this.setOffset(_L2);this.setTotal(_L0);this.setMaxPerPage(_L1);if(_L3)this._callback=_L3;this._rm.dirty();};UIPager.prototype.getRoot=function(){return this.root;};UIPager.prototype.setHidden=function(_L0){CSS.conditionClass(this.root,'hidden_elem',_L0);return this;};UIPager.prototype.getHidden=function(){return CSS.hasClass(this.root,'hidden_elem');};

if (window.Bootloader) { Bootloader.done(["js\/3j0op9zxc7y8wg44.pkg.js"]); }