Vetstoria.debug = new (new Class( {
	__construct : function() {

		// [{(str) level, (str) datetime, (str) information}, ...]
		this.reports = [];

	},

	init : function() {
		console.log('Vetstoria.debug:', 'Debug init');

		this.add('info', this.now, 'debug started');
	},

	add : function(level, datetime, information) {

		if (datetime == 0)
			datetime = this.now;

		this.reports.push( {
			'level' : level,
			'datetime' : datetime,
			'information' : information
		});
	},

	popup : function(level, datetime, information) {
		this.add(level, datetime, information);

		// replace this by a facebox to show the error
	alert(level + ' : ' + information);
},

	show_all : function() {
		// #1 make everything in a <table> or a <ul>
		// #2 display
	},

	now : function() {

		var now = new Date();

		function pad(n) {
			return n < 10 ? '0' + n : n
		}

		now = now.getFullYear() + '-' + pad(now.getMonth() + 1) + '-'
				+ pad(now.getDate()) + ' ' + pad(now.getHours()) + ':'
				+ pad(now.getMinutes()) + ':' + pad(now.getSeconds()) + '';

		return now;

	}

}));
