function timer(name) {
	this.name = name;
	this.starttime = new Date();
	this.stoptime = null;
	this.start = _timerStart;
	this.stop  = _timerStop;
	this.getTime = _timerGet;
	if (!window.timers) window.timers = new Array();
	window.timers[name] = this;
}

function _timerStart() {
	if(this.starttime)
		delete this.starttime;
	this.starttime = new Date();
}

function _timerStop() {
	this.stoptime = new Date();
}

function _timerGet() {
	if(this.stoptime)
		return (this.stoptime - this.starttime);
	else {
		var now = new Date();
		return (now - this.starttime);
		delete now;
	}
}

function showAllTimers() {
	var output = "";
	for (timer in window.timers) {
		output += (timer + ": " + window.timers[timer].getTime() + "\n")
	}
	return(output);
}
