/*
	unFocusHistoryKeeper, version 0.8.3 (alpha) (2005/07/29)
	Copyright: 2005, Kevin Newman (http://www.unfocus.com/Projects/HistoryKeeper/)
	License: http://creativecommons.org/licenses/LGPL/2.1/
*/
if (!window.unFocusHistoryKeeper) new function() { window.unFocusHistoryKeeper = this; var _pollInterval = 200; var _listeners = []; var _currentHash = _GetHash(); if (setInterval)
var _intervalID = setInterval(_CheckHash, _pollInterval); function _GetHash() { return location.hash.substring(1);}; function _SetHash($newHash) { window.location.hash = $newHash;}; function _CheckHash() { var $newHash = _GetHash(); if (_currentHash != $newHash) { _currentHash = $newHash; _NotifyListeners($newHash);}
}; function _NotifyListeners($newHash) { for (var i=0; i < _listeners.length; i++)
_listeners[i].unFocusHistoryUpdate($newHash);}; this.AddListener = function($obj) { if (!$obj.unFocusHistoryUpdate) return false; for (var i=0; i < _listeners.length; i++)
if (_listeners[i] == $obj)
return true; _listeners.push($obj); if ($obj.unFocusHistoryLoad)
$obj.unFocusHistoryLoad(_currentHash); return true;}; this.RemoveListener = function($obj) { for (var i=0; i < _listeners.length; i++) { if (_listeners[i] == $obj) { _listeners.splice(i,1); break;}
}
}; this.AddBookmark = function($newHash) { _currentHash = $newHash; _SetHash($newHash); _NotifyListeners($newHash);}; if (/MSIE/.test(navigator.userAgent) && !/Opera/.test(navigator.userAgent)) { if (navigator.appVersion.match(/MSIE (\d\.\d+)/)[1] >= 5.5) { var $historyFrame = false; this.AddBookmark = function($newHash) { _currentHash = $newHash; _CreateHistoryHTML($newHash, true);}; this._NotifyListeners = function($newHash) { this._NotifyListeners = function($newHash) { _currentHash = $newHash; _SetHash($newHash); _NotifyListeners($newHash);};}; function _CreateHistoryHTML($newHash) { $historyFrame.document.open('text/html'); $historyFrame.document.write('<html><head></head><body onload="window.parent.unFocusHistoryKeeper._NotifyListeners(\''+$newHash+'\');"></body></html>'); $historyFrame.document.close();}; function _SetUpHistoryFrame() { if (!window.frames['unFocusHistoryFrame']) { $historyFrame = document.createElement("iframe"); $historyFrame.name = 'unFocusHistoryFrame'; $historyFrame.id = 'unFocusHistoryFrame'; $historyFrame.style.position = 'absolute'; $historyFrame.style.top = '-900px'; document.body.appendChild($historyFrame);}
$historyFrame = window.frames[window.frames.length-1]; _CreateHistoryHTML(_currentHash);}; window.attachEvent('onload', _SetUpHistoryFrame);} else { this.AddBookmark = function($newHash) { _currentHash = $newHash; _CreateAnchor($newHash); _SetHash($newHash); _NotifyListeners($newHash);}; function _CreateAnchor($newHash) { var $anchor = document.createElement('a'); $anchor.setAttribute('name',$newHash); if (/MSIE/.test(navigator.userAgent)) $anchor = document.createElement('<a name="'+$newHash+'"></a>'); $anchor.style.position = 'absolute'; $anchor.style.left = document.body.scrollLeft; $anchor.style.top = document.body.scrollTop; document.body.appendChild($anchor);};}
}
}; 
