var HashManager = {
    delimiter: '&',
    
    get: function(){
        var hash = location.hash,
            parts = hash.split(this.delimiter),
            len = parts.length,
            res = {};
            
        for(var i = 0; i < len; i++){
            var pieces = parts[i].split('=');
            
            if(pieces[0].test(/^#/)){
                pieces[0] = pieces[0].substring(1);
            }
            
            res[pieces[0]] = pieces[1];
        }
        
        return res;
    },
    
    set: function(key, value){
        var hash = this.get(),
            new_hash = [];
        
        hash[key] = value;
        
        for(var i in hash){
            if(i && hash[i]) new_hash.push(i + '=' + hash[i]);
        }
        
        window.location.hash = new_hash.join(this.delimiter);
        
        return this;
    },
    
    key: function(key){
        return this.get()[key] || false;
    }
};