var historyManager = {
	moduleName: null,
	defaultState: null,
	bookmarkedState: null,
	initialState: null,
	currentState : null,
	documentTitle : document.title,
	
	init : function(moduleName, defaultState) {
		this.moduleName = moduleName;
		this.defaultState = defaultState;
	
		this.bookmarkedState = YAHOO.util.History.getBookmarkedState( this.moduleName );
		this.initialState = this.bookmarkedState || this.defaultState;
		
		YAHOO.util.History.register(this.moduleName, this.defaultState, this.stateChangeHandler);
		
		YAHOO.util.History.onLoadEvent.subscribe(function () {
			historyManager.currentState = YAHOO.util.History.getCurrentState(historyManager.moduleName);
			historyManager.stateChangeHandler(historyManager.currentState);
			//document.getElementById('history_state').innerHTML = historyManager.currentState;
		});
		
	},
	stateChangeHandler : function(state) {
		sendToActionScript(state);
		document.title = historyManager.documentTitle;
		//document.getElementById('history_state').innerHTML = state;
	},
	navigate : function(module, state) {
		document.title = historyManager.documentTitle;
		YAHOO.util.History.navigate(module, state);
	}
}