// The Flash Message

// Global
WINDOW_TIME_OUT = 0;

jQuery.fn.flashMessage = function(time) {
	if (WINDOW_TIME_OUT != 0)
		window.clearTimeout(WINDOW_TIME_OUT);

	var time = time || 8000;
	WINDOW_TIME_OUT = window.setTimeout("jQuery('#" + this.attr("id") + "').hide()", time);
	return this;
}

jQuery.fn.msgInfo = function(text){
	this.removeClasses();
	this.addClass("msg-info").html(text).show();
	return this;
}

jQuery.fn.msgAlert = function(text){
	this.removeClasses();
	this.addClass("msg-alert").html(text).show();
	return this;
}

jQuery.fn.msgSuccess = function(text){
	this.removeClasses();
	this.addClass("msg-success").html(text).show();
	return this;
}

jQuery.fn.msgError = function(text){
	this.removeClasses();
	this.addClass("msg-error").html(text).show();
	return this;
}

/*
	Remove as classes já setadas na mensagem
*/
jQuery.fn.removeClasses = function(){
	this.removeClass("msg-alert");
	this.removeClass("msg-success");
	this.removeClass("msg-error");
	this.removeClass("msg-info");
}

