//Notification central is a singleton
var JSNotificationCenter = Class.create();
Object.extend(JSNotificationCenter.prototype, {
  initialize:function(){/* empty */},
	addMessage:function(theElement) {
		var idNum = Math.random();
		
		var wrapperDiv = document.createElement('div');
		wrapperDiv.setAttribute('class', 'alert no-stress');
		wrapperDiv.setAttribute('id', 'js-notification-'+idNum);		
		wrapperDiv.appendChild(theElement);
		
		var removeMessage = document.createElement('p');
		removeMessage.setAttribute('class', 'small-top-margin');
		
		var removeLink = document.createElement('a');
		removeLink.setAttribute('href', '#');
		removeLink.setAttribute('onclick', 'JSNotificationCenter.removeNotification(\''+idNum+'\')');
		removeLink.appendChild(document.createTextElement('Remove'));
		
		removeMessage.appendChild(removeLink);
		
		wrapperDiv.appendChild(removeMessage);
				
		$('notices-left').appendChild(wrapperDiv);
	},
	
	addError:function(text) {
		
	},
	
	removeNotification:function(id) {
		
	},
	
});

JSNotificationCenter = new JSNotificationCenter();