
// $Id: class.waiter.js,v 1.1 2006-09-17 12:34:56 pheckel Exp $
// Release 2
var Waiter = Class.create();
Object.extend(Waiter.prototype, {
	initialize: function(waiterId) {
		if (!typeof imgs == 'string') this.waiterObj = $(waiterId);
		else this.waiterObj = waiterId;
			
		this.requests = 0;
		this.waiterObj.style.display = 'none';
	},
	
	addRequest: function() { 
		this.requests++;
		this.waiterObj.style.display = 'block';
		
		setTimeout(
			function() { 
				if (this.requests) return;
				this.waiterObj.style.display = 'none';
			}.bind(this),
			10
		);
	},
	
	delRequest: function() { 
		if (this.requests > 0) this.requests--;
		if (!this.requests) this.waiterObj.style.display = 'none';
	}	
});

