//Copyright © [Year(s)] Nokia Corporation and/or its subsidiary(-ies).
Fp.History={log:[],historyLength:0,currentPosition:0,cacheLimit:100,activated:false,init:function(){},loadPage:function(a){if(this.log[a]){Fp.openDetailContainer(this.log[a]);return true;}return false;},add:function(a){if(!a.firstElement&&!a.fromHistory){this.clear();}if(this.getHistoryActivated()&&a.fromHistory){return;}if(this.historyLength===0){a.firstElement=true;}if(this.currentPosition>0){this.log.splice(0,this.currentPosition);this.currentPosition=0;}if(this.historyLength===this.cacheLimit){this.log.pop();}this.log.unshift(a);this.historyLength=this.log.length;},back:function(){if(this.currentPosition===this.historyLength||this.currentPosition===this.cacheLimit-1){this.setHistoryActivated(false);return false;}this.currentPosition++;this.setHistoryActivated(true);this.loadPage(this.currentPosition);},clear:function(){this.log=[];this.currentPosition=0;this.historyLength=this.log.length;},setHistoryActivated:function(a){if(typeof a==="boolean"){this.activated=a;}},getHistoryActivated:function(){return this.activated;}};