/**
 * Cache class for the pagination.
 * @constructor
 */
function PageCache() {
	
	//create and init cache
	var _cache = new Array();
	for(var i = 0; i < 20; i++) {
		_cache[i] = undefined;
	}
	 
	this.hasPage = function(page) {
		return _cache[page-1] !== undefined;
	};
	
	/**
	 * Cache a page
	 * @param {Number} page
	 * @param {String} html
	 */
	this.put = function(page, html) {
		_cache[page-1] = html;
	};
	
	/**
	 * Get a cached page, or undefined if it does not exist
	 * @param {String} page 
	 * @type String
	 */
	this.html = function(page) {
		return _cache[page-1];
	};
	
	/**
	 * Remove a cached page
	 * @param {Number} page
	 */
	this.remove = function(page) {
		_cache[page-1] = undefined;
	};
	
	/**
	 * Erase the cache
	 */
	this.removeAll = function() {
		this.removeAfter(0);
	};
	
	/**
	 * Erase the cache for all pages after a certain page 
	 * @param {Number} page
	 */
	this.removeAfter = function(page) {
		for(var i = page; i < _cache.length; i++) {
			_cache[i] = undefined;
		}
	};
 
};
