liwe.utils.notifier = {};

liwe.utils.notifier.fx = false; 	// Flag T/F. If T fx are used (if present)
liwe.utils.notifier.fade_in = 50; 	// Flag T/F. If T fx are used (if present)
liwe.utils.notifier.fade_out = 50; 	// Flag T/F. If T fx are used (if present)


liwe.utils.notifier.show = function ( text, mode )
{
	if ( ! mode ) mode = liwe.utils.notifier.mode.MESSAGE;

	liwe.utils.notifier._show ( text, mode );
};

liwe.utils.notifier.hide = function ()
{
	if ( ! liwe.utils.notifier._el || liwe.utils.notifier._el.style.display != 'block' ) return;

	if ( liwe.utils.notifier.fx && liwe.fx && liwe.fx.fade_in )
	{
		liwe.fx.fade_out ( liwe.utils.notifier._el, 10, liwe.utils.notifier.fade_out, function () { liwe.utils.notifier._el.style.display = "none"; } ); 
	} else 
		liwe.utils.notifier._el.style.display = "none";
};

liwe.utils.notifier.mode = { ALERT : "alert",
			     WARN  : "warn",
			     NOTICE : "notice",
			     MESSAGE : "message",
			     INFO : "info" 
			};

liwe.utils.notifier._el = null;

liwe.utils.notifier._show = function ( txt, mode )
{
	if ( ! liwe.utils.notifier._el )
	{
		liwe.utils.notifier._el = document.createElement ( "div" );
		document.body.insertBefore ( liwe.utils.notifier._el, document.body.firstChild );
	}

	liwe.utils.notifier._el.innerHTML = txt;

	liwe.utils.notifier._el.style.display = "none";
	liwe.utils.notifier._el.className = "liwe_notifier_" + mode;

	window.scrollTo ( 0, 0 );

	if ( liwe.utils.notifier.fx && liwe.fx && liwe.fx.fade_in )
	{
		liwe.fx.set_opacity ( liwe.utils.notifier._el, 0 ); 
		liwe.utils.notifier._el.style.display = "block";
		liwe.fx.fade_in ( liwe.utils.notifier._el, 10, liwe.utils.notifier.fade_in ); 
	} else 
		liwe.utils.notifier._el.style.display = "block";
};

