function strayegg_connection(
	in_callback,
	in_key
) {

	this.callback = in_callback;
	this.key = in_key;
	this.obj = {};
	this.queue = [];
	
	this.poll = function() {
		$.ajax({
			url: this.callback,
			dataType: 'json',
			data: {k:this.key,q:JSON.stringify(this.queue)},
			type: 'POST',
			success: function(data) {
				/* do things with response */
				for (i in data.POLL) {
					this.obj[i.toLowerCase()].handler(data.POLL[i]);
				}
				
				
				if (data.NEXT > 0) {
					window.setTimeout(this.poll.bind(this),data.NEXT);
				}
			}.bind(this)
		});
		this.queue = [];
	}
	
	this.register = function(str_name,obj_this) {
		obj_this.parent = this;
		obj_this.objname = str_name;
		this.obj[str_name] = obj_this;	// stores object in correct place
	};
	
	this.queueaction = function(obj_name,obj_args) {
		this.queue[this.queue.length] = {
			o:obj_name,
			a:obj_args
		};
	}

}


