
$(document).ready(function() {
	$Msg.init('message-box');
});

var $Msg = {
	 boxMessageContainer: false
	,boxMessage: false
	,boxBackground: false
	,initialized: false
	,isInitialized: function() {
		return $Msg.initialized;
	}
	,init: function(id) {
		id = '#'+id;
		$Msg.boxMessageContainer = $(id);
		if (!$Msg.boxMessageContainer) return;
		$Msg.boxMessage = $(id+'-txt');
		if (!$Msg.boxMessage) return;
		$Msg.boxBackground = $(id+'-bk');
		if (!$Msg.boxBackground) return;
		$Msg.boxBackground.css('opacity', 0.9);
		$Msg.initialized = true;
	}
	,on: function() {
		if (!$Msg.initialized) return;
		$Msg.boxMessageContainer.removeClass('off');
		$Msg.boxBackground.css({
			 'width': $Msg.boxMessage.width()
			,'height': $Msg.boxMessage.height()
		});
	}
	,off: function() {
		if (!$Msg.initialized) return;
		$Msg.boxMessageContainer.addClass('off');
	}
	,show: function(t) {
		if (!$Msg.initialized) return;
		$Msg.boxMessage.html(t);
		$Msg.on();
	}
	,clear: function() {
		if (!$Msg.initialized) return;
		$Msg.off();
		$Msg.boxMessage.text('');
	}
};


