function clearMessages () {
	document.getElementById('cms_messages').removeChild (document.getElementById('cms_messages').firstChild);
}

Message = function (text) {
	this.flush (text);
}

Message.prototype = {
	
	oBox : null,
	
	flush : function (text) {
		this.oBox = document.createElement ('div');
		this.oBox.className = 'message';
		this.oBox.innerHTML = text;
		
		var __self = this;
		
		this.oBox.onclick = function () {
			document.getElementById('cms_messages').removeChild (__self.oBox);
		};
		
		document.getElementById('cms_messages').appendChild (this.oBox);
		
		setTimeout ('clearMessages()', 5000);
	}
	
}

Error = function (text) {
	this.flush (text);
}

Error.prototype = {
	
	oBox : null,
	
	flush : function (text) {
		this.oBox = document.createElement ('div');
		this.oBox.className = 'error';
		this.oBox.innerHTML = text;
		
		var __self = this;
		
		this.oBox.onclick = function () {
			document.getElementById('cms_messages').removeChild (__self.oBox);
		};
		
		document.getElementById('cms_messages').appendChild (this.oBox);
		
		setTimeout ('clearMessages()', 5000);
	}
	
}
