/**
* -------------------------------------------------------------------------------
* @class Message (jQuery)
* 	Controla as mensagens amigáveis dos formulários.
* -------------------------------------------------------------------------------
*/
oMessage = $.extend(
	new Storage({
		elementId: '#message-box',
		classNames: ['information-simple', 'success-simple', 'warning-simple', 'error-simple', 'information', 'success', 'warning', 'error'],
		hideMsgTimeout: 7,
		timeoutId: null
	}), {
		
		show: function(){
			var hConfig = $.extend({
				box: this.Store.get('elementId'),
				type: 'warning',
				text: '',
				autoHide: false,
				autoHideTimeout: this.Store.get('hideMsgTimeout'),
				scrollTo: false
			}, arguments[0] || {});
			
			if(null != this.Store.get('timeoutId'))
				window.clearTimeout(this.Store.get('timeoutId'));
			
			var oElement	= $(hConfig.box);
			var aClassNames = this.Store.get('classNames');
			
			if(-1 === $.inArray(hConfig.type, aClassNames))
				return;
						
			oElement.removeClass().addClass(hConfig.type).html(hConfig.text).show();
			
			if(hConfig.scrollTo){
				var hOffset = oElement.offset();
				window.scrollTo(hOffset.top, hOffset.left);
			}
			
			if(hConfig.autoHide)
				this.Store.replace('timeoutId', setTimeout(function(){
					oMessage.hide.apply(this, [hConfig.box])
				}, (hConfig.autoHideTimeout * 1000)));
			
			return oElement;
		},
		
		hide: function(){
			var sBox = arguments[0] || this.Store.get('elementId');
			return $(sBox).hide().empty();
		}
		
	}
);