var Messenger = 
{
	timeout: 5000,
	autohide: null,
	divid:'SAMsg',
	
	gotonotice:function()
	{
		location.href="#top";
	},
	
	notice: function(message, mt)
	{
		d  = $(Messenger.divid);
		mto = parseInt(mt);
		if( isNaN(mto) || mto == 0)
		{	mto = Messenger.timeout;	}
		if( d != null )
		{
			d.update("<li>" + message + "</li>");
			new Effect.Appear(d, {duration: 0.5});

			if (this.autohide != null) {clearTimeout(this.autohide);}
			this.autohide = setTimeout(Messenger.fadeNotice.bind(this), mto);
		}
	},
	
	noticeindev: function(message, mt, target)
	{
		d  = $(target);
		mto = parseInt(mt);
		if( isNaN(mto) || mto == 0)
		{	mto = Messenger.timeout;	}
		if( d != null )
		{
			d.update("<li>" + message + "</li>");
			new Effect.Appear(d, {duration: 0.5});

			var ah;
			ah = setTimeout(function(){d  = $(target);new Effect.Fade(d, {duration: 0.3})}, mto);
		}
	},
	
	noticewithoutfade: function(message)
	{
		d  = $(Messenger.divid);
		if( d != null )
		{
			d.update("<li>" + message + "</li>");
			new Effect.Appear(d, {duration: 0.5});
			if (this.autohide != null) {clearTimeout(this.autohide);}
			this.gotonotice();
		}
	},
	
	fadeNotice: function()
	{
		d  = $(Messenger.divid);
		new Effect.Fade(d, {duration: 0.3});
	},
	
	fadeNoticeInDiv: function(target)
	{
		d  = $(target);
		new Effect.Fade(d, {duration: 0.3});
	}	
}