if ( typeof Message == 'undefined' )
{
	Message = function()
	{
		this.popup = new Popup();
		this.error = '';
		this.message = '';
		this.block = 'msg';
	};
}


Message.prototype.add = function( type, text )
{
	if ( type == 'error' )
	{
		this.error += text;
		$('#' + this.block + ' p:eq(1)').html( this.error );
	}
	else if ( type == 'message' )
	{
		this.message += text;
		$('#' + this.block + ' p:eq(1)').html( this.message );
	}
	
	return this;
}


Message.prototype.show = function()
{
	this.setStyle();
	this.popup.show( this.block );
	this.clear();
}


Message.prototype.setStyle = function()
{
	if ( this.error )
		$('#' + this.block + ' p:eq(1)').css( 'color', '#C60000' );
	else if ( this.message )
		$('#' + this.block + ' p:eq(1)').css( 'color', '#3C3C3C' );
}


Message.prototype.clear = function()
{
	this.error = this.message = '';
}