// JavaScript Document
HashEvent = {
	
	currentHash: location.hash,
	
	checkInterval : 700,
	
	init : function()
	{
		setInterval(this.checkHash.bind(this), this.checkInterval);
	},
	
	checkHash : function()
	{
		if(location.hash != this.currentHash)
		{
			this.currentHash = location.hash;
			document.fire("HashEvent:change");
		}
	},
		
	// changing hash without raising the event
	setSilent : function(hash)
	{
		location.hash = hash;	
		this.currentHash = location.hash;
	}
}

document.observe("dom:loaded", HashEvent.init.bind(HashEvent));
