function getMax(anumber, another) {return((anumber> another) ? anumber : another);}
function resizeTextArea(t, minRows) {
	t.rows = minRows;
	lines = t.value.split("\n");
	t.rows = getMax(lines.length +1, minRows);
}
			
			

var cAP = new Class({
	initialize: function(opts){
		this.Options = opts;
		this.Objekte = []; //Listen und Karte, die aktulisiert werden müssen
		this.AktualisierungsNummer = 0;
		
		this.Request = new Request({url: this.Options.AjaxURL, 
			link:'cancel', method:'get',
			onSuccess : function(atxt, bxml){
				if(this.parent.Objekte.length>0) 
				this.parent.Objekte.each(function(o){
					o.laden(o.parent.AktualisierungsNummer)
				});

			}
		});
		this.Request.parent = this; 
		
	},
	
	ObjektRegistrieren: function(o){
		o.parent = this;
		this.Objekte.push(o)
	},

	
	aktualisieren: function(apakt, p){
		if(arguments.length>0){
			this.AktualisierungsNummer = apakt;

			this.Request.cancel();
			this.Request.send('apakt=' + apakt + '&' + p);
			return false;
		}else{
			if(this.Objekte.length>0) 
			this.Objekte.each(function(o){
				o.laden()
			});
		
		}
	},
	
	aktualisierenQS: function(p){
		var q = new QS();
		this.AktualisierungsNummer = -8; //für QS
		this.Request.cancel();
		this.Request.send(location.search.substring(1,location.search.length));
		return false;
	}
	
});
			
