/**
 * @author phillipa
 */

declarePackage("picknpay");
declarePackage("picknpay.schemes");
picknpay.schemes.Promotion = function() {
	var self;
	var currentPromotion = 1;
	
	function constructorFn(){
		self = this;
	}
	
	constructorFn.prototype.previous = function(totalPromotions, itemPrefix, clipId) {
		$(itemPrefix + clipId + '_' + currentPromotion).style.display = "none";
		$(itemPrefix + clipId + '_' + (currentPromotion-1)).style.display = "block";
		if (currentPromotion-1 == 1) {
			$('prev_page_' + clipId).style.display = "none";
		}
		if (currentPromotion-1 < totalPromotions) {
			$('next_page_' + clipId).style.display = "block";
		}
		currentPromotion--;
	}
	
	constructorFn.prototype.next = function(totalPromotions, itemPrefix, clipId) {		
		$(itemPrefix + clipId + '_' + currentPromotion).style.display = "none";
		$(itemPrefix + clipId + '_' + (currentPromotion+1)).style.display = "block";
		if (currentPromotion+1 > 1) {
			$('prev_page_' + clipId).style.display = "block";
		}
		if (currentPromotion+1 == totalPromotions) {
			$('next_page_' + clipId).style.display = "none";			
		}
		
		currentPromotion++;
	}
	
	return new constructorFn();	
}
