// NOTE: This isn't working well (when you change PHOTO tabs... needs to be worked on...

if(typeof(XPRIMA) == "undefined") XPRIMA = {};

XPRIMA.HashHistory = function() {
  return {
    _h : window.location.hash,
    _f : null,
    _t : null,
    
    addWatcher : function(fn) {
      this._f = fn;
      this._timer();
    },
    
    _timer : function() {
      this._t = setTimeout("XPRIMA.HashHistory._check()", 500);
    },
    
    _check : function() {
      if(typeof(this._f) == "function") {
        if(window.location.hash != this._h) {
          this._h = window.location.hash;
          this._f(this._h);
        }
        this._timer();
      }
    }
  }
}();

