UINavigation = $.klass({
	
	currentHash: false,
	
	initialize: function(listener){
		
		this.listener = listener;

		if (!this.listener.onChangeHash || typeof this.listener.onChangeHash != 'function') {
			throw "É obrigatório implementar o método onChangeHash";
		}
		
	    setInterval($.bind(this.verifyHash, this), 100);
	},
	
	verifyHash: function(){
        if(window.location.hash != this.currentHash) {
            this.currentHash = window.location.hash;
            this.onChangeHash();
        }	
	},
	
	onChangeHash: function(){
		this.listener.onChangeHash(this.currentHash.replace("#!",""));
	}
	
});
