// JavaScript Document

var reageer = function() {
	
	this.object = null;
	this.action = true;
	
	this.set = function(id, bg) {
		if(!this.object) {
			this.object = id;
			this.request(this.object, bg);
		}
		else if(this.object != id) {
			old = this.object;
			Effect.BlindUp('profiel' + this.object, { duration: 1.0, 
				afterFinish: function() {
					document.getElementById('profiel' + old).innerHTML = '';
					this.object = id; 
					reageer.request(this.object, bg);
				} 
			})
		}
	}
	
	this.request = function(obj, bg) {
		
		var ID = obj;
		this.object = obj; 
		new Ajax.Request('request.php', { method: 'post', postBody: 'zoekers=' + this.object + '&bg='+bg,
			onSuccess: 
			function(response) {
				document.getElementById('profiel' + ID).innerHTML = response.responseText;
				Effect.BlindDown('profiel' + ID, { duration: 1.0 })
			}
			
		});
	}
	
}