/**
 * xxx [..] by http://www.easy-coding.de
 * 
 * @param url
 * @param poll		
 */
function UpdateManyDivs(url, poll) {
	this.url = url;
	this.poll = poll ? poll : 750;
	this.list = [];
	this.timer = null;
	
	/**
	 * adds elem
	 * @param	id		string as id
	 */
	this.push = function(id) {
		this.list.push(id);
	};
	
	/**
	 * sends single request
	 * @param loop	boolean		
	 */
	this.fire = function(loop) {
		ajaxPost(this.url + '?' +this.list.join('&'), 'seed='+ new Date().getTime(), function(up) {
			return function() {
				if (this.readyState == 4 && this.status == 200) {
					if(loop) {
						// start timer
						up.start();
					}
			
					var data = eval('(' + this.responseText + ')');
					for(var key in data) {
						document.getElementById(key).innerHTML = data[key];
					}
				}
			};
		}(this));
	};
	
	/**
	 * stops auto updater
	 */
	this.stop = function() {
		window.clearTimeout(this.timer);
	};
	
	/**
	 * starts auto updater
	 */
	this.start = function() {
		this.timer = window.setTimeout(function(up) {
			return function() {
				up.fire(true);
			};
		}(this), this.poll);
	};
}

