function BackMonitor(b,c,a,d){this.Y=d;this.window=b;this.checkInterval=isNaN(c)?500:c;this.detectedCallback=a;this.timerId=null;this.started=false;}BackMonitor.prototype.start=function(){if(!this.started){this.setFragment();this.started=true;this.setTimer();}};BackMonitor.prototype.stop=function(){if(this.timerId!=null){this.window.clearInterval(this.timerId);this.timerId=null;}this.removeFragment();this.started=false;};BackMonitor.prototype.toString=function(){return"[object BackMonitor]";};BackMonitor.prototype.currentLocation=function(){return window.location.toString();};BackMonitor.prototype.checkBack=function(){if(this.started){if(!this.windowHasFragment()){if(typeof this.detectedCallback==="function"){this.detectedCallback();}this.stop();}}else{}};BackMonitor.prototype.setTimer=function(){if(this.timerId!=null){clearTimerId(this.timerId);}var a=this.getDeferableCheckBackFunction();this.timerId=this.window.setInterval(a,this.checkInterval);};BackMonitor.prototype.getDeferableCheckBackFunction=function(){var a=this;return(function(){a.checkBack();});};BackMonitor.prototype.windowHasFragment=function(){var a=this.currentLocation();return a.indexOf(BackMonitor.FRAGMENT)>-1;};BackMonitor.prototype.setFragment=function(){var b=this.currentLocation();var a=b.replace(/#[^&\?]*/,"");a+="#"+encodeURIComponent(BackMonitor.FRAGMENT);if(a!==b){this.window.location.href=a;}};BackMonitor.prototype.removeFragment=function(){var b=this.currentLocation();var a=b;if(BackMonitor.MATCH_FRAGMENT_REGEXP.test(b)){a=b.replace(BackMonitor.MATCH_FRAGMENT_REGEXP,"");a+="#";}if(a!==b){this.window.location.href=a;}};BackMonitor.FRAGMENT="b.mon.tag";BackMonitor.MATCH_FRAGMENT_REGEXP=new RegExp("#"+encodeURIComponent(BackMonitor.FRAGMENT));