var Loading = {
	id:'#loadIndicator',
	arrange: function(){ 
		$(Loading.id).css('top', $(window).scrollTop() );
	},
	show: function(){
		$(Loading.id).show();
		SMessages.hide();
		$(window).bind('scroll', Loading.arrange);
	},
	hide: function(){
		$(Loading.id).fadeOut();
		$(window).unbind('scroll', Loading.arrange);
	}
}
var SMessages = {
	ttl: 10000,
	error: {
		id: '#error',
		isShown: false,
		text: function(message){ $(SMessages.error.id).html(message); },
		show: function(message){
			if (SMessages.error.isShown) return;
			if(message.length == 0) return;
			SMessages.error.text(message);
			SMessages.error.onShow();
			SMessages.error.isShown = true;		
			clearInterval(SMessages.error.timerId);
			SMessages.error.timerId = setTimeout("SMessages.error.hide()", SMessages.ttl);
		},
		hide: function(){
			if (!SMessages.error.isShown) return;
			SMessages.error.onHide();
			SMessages.error.isShown = false;
		},
		onShow: function(){ $(this.id).stop().fadeIn(); },
		onHide: function(){ $(this.id).stop().fadeOut(); }
	},
	status:{
		id: '#status',
		timerId: null,
		isShown: false,
		text: function(message){ $(SMessages.status.id).html(message); },
		show: function(message){
			if (SMessages.status.isShown) return;
			if(message.length == 0) return;
			SMessages.status.text(message);
			SMessages.status.onShow();
			SMessages.status.isShown = true;
			clearInterval(SMessages.status.timerId);
			SMessages.status.timerId = setTimeout("SMessages.status.hide()", SMessages.ttl);
		},
		hide: function(){
			if (!SMessages.status.isShown) return;
			SMessages.status.onHide();
			SMessages.status.isShown = false;
		},
		onShow: function(message){ $(this.id).stop().fadeIn(); },
		onHide: function(){ $(this.id).stop().fadeOut(); }
	},
	hide: function(){
		SMessages.error.hide();
		SMessages.status.hide();
	}
}