function ProduseVandute(divname, boxWidth, totalBox, catid, zone, initial_promo_nr)
{
	this.divname = divname;
	this.boxWidth = boxWidth+14;
	this.catid = catid;
	this.zone = zone;
	this.initial_promo_nr = initial_promo_nr;

	this.nextBox = 4;
	this.currentBox = 3;
	this.boxRotationSpeed =  1000;
	this.boxNumbers = totalBox/this.boxWidth;

	this.rotate = function(action)
	{
		if (this.initial_promo_nr < 3)
			return;
			
		if( action == "inc" ) this.currentBox++;
		else this.currentBox--;
	
		if(this.currentBox > this.boxNumbers) { this.currentBox--; return; }
		if(this.currentBox < 3) { this.currentBox = 3; return; }
	
		$('#'+this.divname).animate({"left": ((action == "inc") ? "-=" : "+=") + this.boxWidth + "px"}, this.boxRotationSpeed);
	
		if(this.currentBox  == this.nextBox)
		{
			var IDs = "";
			$('#'+this.divname).children().each(function(){ IDs+=this.id+"-"; });
			IDs = IDs.slice(0,-1);
			
			var self = this;
	
			/*$.ajax({
				url : "/get_promo_product?cId="+IDs+"&zone="+this.zone+"&catid="+this.catid,
				success: function(html){
					if(html.length <= 1000) self.boxNumbers = self.nextBox-1;
					else {$('#'+self.divname).append(html);}
				}
			});*/
			
			/*if (self.currentBox > 3) {
				 self.boxNumbers = self.nextBox-1;
			}*/
			
			this.nextBox++;
		}
	}
}


