//////////////////////////////////////////////////////////////////////////////////////////////
//																	   //
// Scripts mlmb par erwansims													   //
//																	   //
// Si vous souhaitez prendre une partie du code contenu dans ce fichier, veuillez d'abord m'en informer	   //
// sur MessLive (http://www.messlive.net)											   //
//																	   //
//////////////////////////////////////////////////////////////////////////////////////////////

var mlbmId = 0;
var timeOut;

window.addEvent('domready', function() {
	if($defined($('mlbm_effect')))
	{
		$$('.mlbm_effect').setStyles({
			'height': '30px',
			'position': 'relative',
			'top': '30px'
		});

		if(Browser.Engine.trident && navigator.userAgent.match(/MSIE ([0-9.]+);/)[1] != "8.0")
		{
			$$('.mlbm_effect').fade('hide');
		}

		if($defined($$('.mlbm_effect_link')[0]))
		{
			$$('.mlbm_effect_link').each(function(item) {
				item.store('tip:title', '<span style="font-weight: bold;">' + item.get('text') + '</span>');
				item.store('tip:text', '<span style="margin-left: 5px;">' + item.get('title') + '</span>');
			});
		}

		$('mlbm_effect').setStyle('visibility', 'visible');

		if($defined($$('.mlbm_effect_link')[0]))
		{
			var Tips1 = new Tips('.mlbm_effect_link', {className: 'infoBulleMaintenance'}).addEvent('hide', function(tip) {
				timeOut = changeElementAffiched.delay(2000);
				tip.fade(0);
			}).addEvent('show', function(tip){
				$clear(timeOut);
				tip.fade(.75);
			});
		
			$$('.infoBulleMaintenance')[0].fade(0);
			$$('.infoBulleMaintenance')[0].setStyles({'background-color': '#000000', 'color': '#FFFFFF', 'padding': '5px', 'width': '300px'});
		}
		
		$$('.mlbm_effect').set('tween', {duration: 'long', transition: 'elastic:out'});
		changeElementAffiched();
	}
});

function changeElementAffiched()
{
	$clear(timeOut);
	
	if(mlbmId >= $$('.mlbm_effect').length)
	{
		$$('.mlbm_effect').setStyle('top', '30px');
		mlbmId = 0;
	}
	$$('.mlbm_effect').tween('top', $$('.mlbm_effect')[mlbmId].getStyle('top').toInt() - 30);
	
	if(Browser.Engine.trident && navigator.userAgent.match(/MSIE ([0-9.]+);/)[1] != "8.0")
	{
		$$('.mlbm_effect')[mlbmId].fade(1);
		if($defined($$('.mlbm_effect')[mlbmId - 1]))
		{
			$$('.mlbm_effect')[mlbmId - 1].fade(0);
		}
	}
	
	mlbmId++;
	
	timeOut = changeElementAffiched.delay(5000);
}
