function Qimg(queue_length, id, query)
{
	this.queue = [];
	this.queue_length = Utils.setParam(queue_length, 7);
	this.id           = Utils.setParam(id, "#qimg_pro");
	this.query        = Utils.setParam(query, "#qimg_pro a");
    this.showspeed = Browser.isIE6 ? "" : "slow";
	var all = $(this.query);
    $(this.id + "_left").bind("click", this, this.leftClick);
	$(this.id + "_right").bind("click", this, this.rightClick);
	var item;
	this.all = [];
    this.left = 0;
	this.right = all.length > this.queue_length ? this.queue_length : all.length;

	for (var i = 0; i <  all.length;i++)
	{
		item = this.all[i] = $(all.get(i));
		item.hide();
		if (i < this.queue_length)
		{
			item.show();
            this.queue.push(item);
		}
	}
}

Qimg.prototype.leftClick = function (obj)
{
	var self = obj.data;
    if (self.left <= 0)
    {
		self.left = 0;
		return;
    }
    var item = self.all[--self.left];
	self.queue.unshift(item);
	item.show(self.showspeed);

	self.right--;
    var item = self.queue.pop();
	item.hide(self.showspeed);
}

Qimg.prototype.rightClick = function (obj)
{
    var self = obj.data;
    if (self.right >= self.all.length)
    {
		self.right = self.all.length;
		return;
    }
    var item = self.queue.shift();
	item.hide(self.showspeed);
    self.left++;

	var item = self.all[self.right++];
    self.queue.push(item);
	item.show(self.showspeed);
}