
BPE.JsonDataPager = RedSquare.DataPager.extend
({
 	constructor: function(data, linkPrevious, linkNext, container, options)
	{
		this.base(data, linkPrevious, linkNext, options);
		
		this.container = container;
		this.FADE_DURATION = 500;
	},
	
	display: function()
	{
		this.displayLinks();
		
		// get the record for the id at the current data index
		new Ajax.Request
		(
			"/get_content_item_js.cfm?objectID=" + this.data[this.index] + "&dt=" + (new Date()).valueOf(),
			{
				onComplete: this.onRequestComplete.bind(this)
			}
		);
	},
	
	displayNext: function()
	{
		this.elementBinder.process(this.record);	
	},
	
	onRequestComplete: function(request)
	{
		try 
		{
			this.record = eval("(" + request.responseText + ")");
		
			this.displayNext(); 
			/*new Effect.BlindUp
			(
			 	this.container, 
				{ 
					duration: 0.4,
					
					
					afterFinish: 
						function(effect) 
						{ 
							
							this.displayNext(); 
							new Effect.BlindDown
							(
								this.container,
								{
									duration: 0.4
								}
							)
						}
						.bind(this) 
				}
			);*/		
		}
		catch(err) 
		{
			// do nothing. (maybe hide the panel altogether?)
		}
	}
});