////////////////////////////////////////////////////////////////////////
//
// Author: Nigel Hamilton
// T10.com
//
////////////////////////////////////////////////////////////////////////

current_page 	= 1; // set by set_current_page
last_page 		= current_page;
paginator		= new Object;

function load_paginator (image_name) {

	// load the arrows - left = 0, right = 11

	for (i = 0; i <= 11; i++) {
		image 	  = new Image(700, 18);
		image.src = './images/page' +  i + '.gif';
		paginator["page" + i] = image;
	}

}
 
function _show_page (page) {

	if (page != last_page) {

		//alert('about to show page ' + page);

		// swap the images - on both paginators
		document.paginator1.src = paginator["page" + page].src;
		document.paginator2.src = paginator["page" + page].src;
		last_page = page;
  	}

}

function set_current_page (page) {
	// called onload of the results page
	current_page = page;
}	

function show_default () {
	_show_page(current_page);
}

function show_selected (selected_page) {
	_show_page(selected_page);
}

function show_next() {
	next_page = last_page + 1;
	if (next_page > 10) { return; }
	_show_page(next_page);
}

function show_previous () {
	previous_page = last_page - 1;
	if (previous_page < 1) { return };
	_show_page(previous_page);
}
