
//error function
function error(mess, id) {
	var selector = ".msg.error.ajax";
	if (id) selector += "#"+id;
	/*
	if ($(selector).html() != mess) { 
		$(selector).hide(200, function() {
			$(selector).html(mess).show(200);
		});
	} else $(selector).html(mess).show(200);*/
	$(selector).hide(200, function() {
		$(selector).html(mess).show(200);
		setTimeout("hideMessages()", 5000);
	});
};


//info function
function info(mess, id) {
	var selector = ".msg.info.ajax";
	if (id) selector += "#"+id;
	/*
	if ($(selector).html() != mess) { 
		$(selector).hide(200, function() {
			$(selector).html(mess).show(200);
		});
	} else $(selector).html(mess).show(200);*/
	$(selector).hide(200, function() {
		$(selector).html(mess).show(200);
		setTimeout("hideMessages()", 7000);
	});
};


//warning function
function warn(mess, id) {
	var selector = ".msg.warn.ajax";
	if (id) selector += "#"+id;
	/*
	if ($(selector).html() != mess) { 
		$(selector).hide(200, function() {
			$(selector).html(mess).show(200);
		});
	} else $(selector).html(mess).show(200);*/
	$(selector).hide(200, function() {
		$(selector).html(mess).show(200);
		setTimeout("hideMessages()", 7000);
	});
};

/**
 * Hide server-side messages.
 */
function hideMessages() {
	var msgs = $(".msg").not(".dontHide");
	
	if ($(msgs).length != 0) {
		$(msgs).slideUp(500);
	}
}

jQuery(document).ready(function($) {
	setTimeout("hideMessages()", 7000);
});


