var UniqeGrupyThis;
var mz_Grupy = new Class({
	initialize: function(uid_grupy,id_content, max, peer_page){
		this.id_content = id_content;
		this.uid_grupy = uid_grupy;
		this.page = 1;
		this.max = max;
		this.peer_page = peer_page;
		UniqeGrupyThis = this;
	},

	NextPage: function()
	{
		this.page++;
		if (this.page>this.max)
		{
			this.page = this.max;
			return;
		}
		this.Load();
	},
	
	PrevPage: function()
	{
		this.page--;
		if (this.page<1)
		{
			this.page = 1;
			return;
		}
		this.Load();
	},
	
	Load: function()
	{ 
		var send_object = {
			"action":"load",
			"uid": this.uid_grupy,
			"page": this.page,
			"peer_page": this.peer_page
		}
		var q = new XHR({
		id_content : this.id_content,
		async:true,
		onFailure: function() {
				
			},
		onRequest: function() { 
				$(this.options.id_content).setHTML('<img src="fileadmin/templates/main/images/load.gif" />');
			}, 
		onSuccess: function() {
				$(this.options.id_content).setHTML(this.response.text);
				
			}
		});
		q.send("index.php?eID=tx_mzkobietagrupy_pi1",Object.toQueryString(send_object));
		return false;	
	}
});


