var defaultTitle = "BALTIC Restaurant";
	var currentTitle = defaultTitle;

	function initialize() {
		var iniHash = window.location.hash;

		if(iniHash==""){
			iniHash = "home";
		}else{
			iniHash = iniHash.substring(1)
		};
		dhtmlHistory.initialize();	
		dhtmlHistory.addListener(historyChange);
		//dhtmlHistory.addListener(historyHandler);
		
		var initialLocation = dhtmlHistory.getCurrentLocation();
		setPageTitle(defaultTitle);
		historyChange(iniHash,true);

	}
	function setHistoryLink(newLocation){
		setPageTitle(defaultTitle);
		dhtmlHistory.add(newLocation);
	}
	function getHistoryLink(){
		return dhtmlHistory.getCurrentLocation();
	}
	function getPageTitle(){
		//return document.title;
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return window.title;
		}
		else {
			return document.title;
		}
	}
	function setPageTitle(windowTitle){
			document.title = windowTitle;		
	}
//----------------

	var valueHash = window.location.hash ;
	var valueCurrent = "http://" + window.location.hostname + window.location.pathname;
		/** Our callback to receive history 
		 change events. */
	function historyChange(newLocation,historyData) {
		var historyMsg = historyData;
		
		debugMsg(
			  "<iframe src=\"controll.php?sNum="+sessionNum+"&sMes="+newLocation+"\" width=\"1\" height=\"1\" scrolling=\"no\" name=\"hidden\" frameborder=\"0\"/>"
			  );
		setPageTitle(newLocation);
		setHistoryLink(newLocation);
	}
		
	function debugMsg(msg) {
		var debugMsg = 
		  document.getElementById("debugMsg");
		debugMsg.innerHTML = msg;
	}
		
	function callJavascript(str) {
		var targetDir= str;
		historyChange(targetDir,true);
		currentTitle = getPageTitle();
		dhtmlHistory.add(targetDir,true);
		
	}
	