function showFlashBox()
{
	if(arguments.length < 1)
		return false;

	el = getEl(arguments[0]);

	if(arguments[1])
		var effect = arguments[1];
	else
		var effect = 'slideDown';

	el.show();

	switch(effect)
	{
		case 'slideDown':
			new Effect.MoveBy(el, 120, 0, {duration: 0.3 ,transition: Effect.Transitions.slowstop});
		break;

		case 'switchOn':
			el.setStyle(
			{
				'opacity': 1,
				'width': 0,
				'height': 0,
				'marginLeft': 0,
				'marginTop': 0,
				'padding': 0,
				'top': '14px',
				'display': 'block'
			});
			new Effect.Morph(el,
			{
				style: {
					width: '800px',
					marginLeft: '-400px',
					paddingLeft: '10px',
					paddingRight: '10px'
				},
				duration: 0.4,
				queue: 'end'
			});
			new Effect.Morph(el,
			{
				style: {
					top: '5px',
					height: '15px',
					paddingTop: '2px',
					paddingBottom: '2px'
				},
				duration: 0.4,
				queue: 'end',
				afterFinish: function(){$('flashBox').setStyle({height: ''})}
			});
		break;
	}

	var hideFlashBox = "hideFlashBox('"+el.id+"', '"+effect+"'); return false;";
	$('flashMessage').innerHTML = "<a href='#' onclick=\""+hideFlashBox+"\" style='float: right'>X</a>"+$('flashMessage').innerHTML;
}

function hideFlashBox(elId, effect)
{
	el = getEl(elId);
	new Effect.Morph(el,
	{
		style:
		{
			top: '150px'
		},
		duration: 0.3
	});
	new Effect.Opacity(el,
	{
		duration: 0.22,
		delay: 0.08,
		to: 0,
		afterFinish: function()
		{
			el.hide();
		}
	});
}

function flash(_text, _class)
{
	_class = ucfirst(_class);
	if($('flashBox'))
	{
		$('flashBox').className = 'flash'+_class;
		$('flashMessage').innerHTML = _text;
	}
	else
	{
		var flashBox = document.createElement('div');
		flashBox.id = 'flashBox';
		flashBox.className = 'flash'+_class;
		flashBox.innerHTML = '<div id="flashMessage" class="message">'+_text+'</div>';
		document.body.appendChild(flashBox);
	}
	showFlashBox("flashBox", "switchOn");
}

