var LoadingMessage = "";
var DefaultLoadingMessage = "Loading...";

function SetLoadingMessage(msg){
	LoadingMessage = msg;
}

function ShowLoading(){
	if(LoadingMessage=="") LoadingMessage = DefaultLoadingMessage;
	$('loading-message').innerHTML = LoadingMessage;
	LoadingMessage = "";
	Effect.Appear('loading-div');
	Effect.Fade('main-content',{duration:0.8});
	Effect.BlindUp('main-content',{scaleTo:50,duration:0.8});
}

function HideLoading(){
	Effect.Fade('loading-div');
	Effect.Appear('main-content',{duration:0.8});
	Effect.BlindDown('main-content',{scaleFrom:50,duration:0.8});
}

Ajax.Responders.register({
	onCreate: function(){	
		//ShowLoading();
 	},
	onComplete: function(){
		//HideLoading.delay(1);
	}
});

/*
var LastLocationHash = window.location.hash.substring(1);
var LocationHashCheckFreq = 0.2;

function LocationHashCheck(){
	if(window.location.hash.substring(1) != LastLocationHash){
		LastLocationHash = window.location.hash.substring(1);
		var q = window.location.hash.substring(1);
		new Ajax.Updater('main-content','/'+q,{method:'get'});
	}
}
*/

Event.observe(window, 'load', function(){
	//Effect.Appear('content-wrapper');
	//new Ajax.Request('?init',{method:'get'});
	//new Ajax.Updater('main-content','?init',{method:'get'});
	//new PeriodicalExecuter(LocationHashCheck, LocationHashCheckFreq);
});

