var javaPager;

if( ! javaPager ) { javaPager = {} }

javaPager
{
	this._currentRecord 	= 0;
	this._EOF 				= true;
	this._totalRecords		= 0;
	this._recordset			= null;
}

javaPager.prepare = function ( totalRec, data )
{
	_totalRecords 	= totalRec;
	_recordset		= data;
	_currentRecord 	= 0;
	
	if( _totalRecords > _currentRecord )
	{
		_EOF = false;
	}
}

javaPager.moveNext = function()
{
	_currentRecord++;

	if( _currentRecord >= _totalRecords )
	{
		_EOF = true;
	}
	else
	{
		_EOF = false;
	}
}

javaPager.movePrevious = function()
{
	if( _currentRecord != 0 )
	{
		_currentRecord--;
		_EOF = false;
	}
}

javaPager.moveFirst = function()
{
	_currentRecord = 0;
	_EOF = false;
	
	if( _currentRecord == _totalRecords )
	{
		_EOF = true;
	}
}

javaPager.moveLast = function()
{
	_currentRecord 	= _totalRecords - 1;
	_EOF 			= true;
}

javaPager.iterateNext = function()
{
	if( _currentRecord >= _totalRecords - 1 )
	{
		this.moveFirst();
	}
	else
	{
		this.moveNext();
	}
	
	this.loadImage();
}

javaPager.iteratePrevious = function()
{
	if( _currentRecord == 0 )
	{
		this.moveLast();
	}
	else
	{
		this.movePrevious();
	}
	
	this.loadImage();
}

javaPager.loadImage = function ()
{	
	var image	= _recordset[ _currentRecord ];
		
	document.productPicture.src = image.src;
}