/* 
    jquery.history.js
    ~~~~~~~~~~~~~~~~~

    :copyright: (C) 2009 Florian Boesch <pyalot@gmail.com>
    :license: GNU AGPL3, see LICENSE for more details.
    :download: <http://hg.codeflow.org/tlog/archive/tip.tar.gz>
*/
(function($){
    $.get_hash = function(){
        return location.hash.replace(/^#/, '')
    }
    var current_hash = $.get_hash();
    $.history = function(callback){
        callback(current_hash);
        setInterval(function(){
            var new_hash = $.get_hash();
            if(current_hash != new_hash){
                callback(new_hash);
                current_hash = new_hash;
            }
        }, 100);
    }
})(jQuery);
