// Team 1 Project - Palo Alto Bicycle Club
// Author: Vern McGeorge
// Class: COIN 71
// Filename: status.js
// Date Created: 14 March 09
// Purpose:
// 		Show status messages about the application in the right column.

var Status_Info			= 0;
var Status_Success	= 1;
var Status_Warning	= 2;
var Status_Error		= 3;

var Status_Strings = ["info", "success", "warning", "error"];

// Clear the status area.
function clearStatus () {
	var statusArea = document.getElementById('statusArea');
	statusArea.innerHTML = "";
}

// Append a status message (color coded by CSS class) to the status area.
function showStatus (level, message) {
	var statusArea = document.getElementById('statusArea');
	if (statusArea != null) {
		var newMessage = document.createElement('div');
		newMessage.setAttribute("class", "status-" + Status_Strings[level]); 
		statusArea.appendChild(newMessage);
		var textNode = document.createTextNode(message);
		newMessage.appendChild(textNode);
	}
}
