window.onload = initialize;
function initialize() {
 skalowanie();
 dhtmlHistory.initialize();	
 dhtmlHistory.addListener(handleHistoryChange);
 var initialLocation = dhtmlHistory.getCurrentLocation();
 if (initialLocation == ""){
 initialLocation = "HOME";
	}
 updateUI(initialLocation, null);
}
function updateUI(newLocation, historyData) {
 var historyMessage;
 if (historyData != null){
 historyMessage = historyData.message;
		//document.title = "Hotel Stok - "+historyData.message;
	} else {
		historyMessage = "<i>No History Data - init history</i>";
		//document.title = "Hotel Stok - "+newLocation.split("&")[1];
	} 
 var message = "<b>Location:</b> " + newLocation + "<br /><b>History Data Storage:</b> " + historyMessage;    
}
function handleHistoryChange(newLocation, historyData) {	
	updateUI(newLocation, historyData);
	callExternalInterface();
	
	
}
function callExternalInterface() {
 if(thisMovie("main").manageURL){
		thisMovie("main").manageURL(dhtmlHistory.getCurrentLocation());
	} else {
		return true;
	}
}
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
  return window[movieName]
 }
 else {
  return document[movieName]
 }
}
function setDeepLink(newLocation, historyMessage){
	var historyData = {message:historyMessage};
 updateUI(newLocation, historyData);
	dhtmlHistory.add(newLocation, historyData);
	
	urchinTracker('/' + newLocation);
}
function getDeepLink(){
	return dhtmlHistory.getCurrentLocation();
}
function getPageTitle(){
	return document.title;
}
function setPageTitle(windowTitle){
	document.title = windowTitle;
}
function doNothing() { return true; }
if (typeof window.onunload == 'function') {
 var oldunload = window.onunload;
 window.onunload = function() {
 allSwfsMustDIE();
 oldunload();
 }
} else {
 window.onunload = allSwfsMustDIE;
}
function scrollWindow(xScroll, yScroll){
	scroll(xScroll,yScroll);
	return true;
}
