var imagecount = 21;
var displaymax = 5;
var maximgpr;
var imageptr = 1;
var imgfile = new Array();
var imgname = new Array();
var imghref = new Array();
var detimgs = new Array();
var detalts = new Array();

imgfile[1] = 'images/thumbs/filmstrip/ebonised-lamp-table.jpg';
imgname[1] = 'Ebonised Lamp Table';
imghref[1] = 'product/ebonised-lamp-table.php';

imgfile[2] = 'images/thumbs/filmstrip/sideboard.jpg';
imgname[2] = 'Mahogany Sideboard';
imghref[2] = 'product/mahogany-sideboard.php';

imgfile[3] = 'images/thumbs/filmstrip/limed-oak-table.jpg';
imgname[3] = 'Round Limed Oak Lamp Table';
imghref[3] = 'product/round-limed-oak-lamp-table.php';

imgfile[4] = 'images/thumbs/filmstrip/chest.jpg';
imgname[4] = 'Mahogany Chest';
imghref[4] = 'product/mahogany-chest-and-mirror.php';

imgfile[5] = 'images/thumbs/filmstrip/pembroke-table-open.jpg';
imgname[5] = 'Pembroke Table';
imghref[5] = 'product/mahogany-pembroke-table.php';

imgfile[6] = 'images/thumbs/filmstrip/hepplewhite-foyer-table.jpg';
imgname[6] = 'Hepplewhite style Mahogany Foyer Table';
imghref[6] = 'product/hepplewhite-style-foyer-table.php';

imgfile[7] = 'images/thumbs/filmstrip/restored-chair.jpg';
imgname[7] = 'Restored Upholstered Chair';
imghref[7] = 'product/restored-upholstered-chair.php';

imgfile[8] = 'images/thumbs/filmstrip/centre-table.jpg';
imgname[8] = 'Mahogany Circular Centre Table';
imghref[8] = 'product/mahogany-circular-centre-table.php';

imgfile[9] = 'images/thumbs/filmstrip/chest-and-mirror.jpg';
imgname[9] = 'Mahogany Chest and Mirror';
imghref[9] = 'product/mahogany-chest-and-mirror.php';

imgfile[10] = 'images/thumbs/filmstrip/walnut-wine-table.jpg';
imgname[10] = 'Burr Walnut Wine Table';
imghref[10] = 'product/burr-walnut-wine-table.php';

imgfile[11] = 'images/thumbs/filmstrip/walnut-dining-table.jpg';
imgname[11] = 'Walnut Dining Table';
imghref[11] = 'product/large-walnut-dining-table.php';

imgfile[12] = 'images/thumbs/filmstrip/regency-writing-table.jpg'; 
imgname[12] = 'Regency Mahogany Writing Table';
imghref[12] = 'product/regency-mahogany-writing-table.php';

imgfile[13] = 'images/thumbs/filmstrip/mirror.jpg';
imgname[13] = 'Mahogany Franed Mirror';
imghref[13] = 'product/mahogany-chest-and-mirror.php';

imgfile[14] = 'images/thumbs/filmstrip/chippendale-breakfront-credenza.jpg';
imgname[14] = 'Chippendale Style Breakfront Credenza';
imghref[14] = 'product/chippendale-breakfront-credenza.php';

imgfile[15] = 'images/thumbs/filmstrip/demi-lune-console-table.jpg';
imgname[15] = 'Demi Lune Console Table';
imghref[15] = 'product/demi-lune-console-table.php';

imgfile[16] = 'images/thumbs/filmstrip/mahogany-china-cabinet.jpg';
imgname[16] = 'Mahogany China Cabinet';
imghref[16] = 'product/mahogany-china-cabinet.php';

imgfile[17] = 'images/thumbs/filmstrip/walnut-smokers-tables.jpg';
imgname[17] = 'Pair of Walnut Smokers Tables';
imghref[17] = 'product/walnut-smokers-tables.php';

imgfile[18] = 'images/thumbs/filmstrip/black-mirror.jpg';
imgname[18] = 'Ebonised Black Mirror Frame';
imghref[18] = 'product/black-mirror.php';

imgfile[19] = 'images/thumbs/filmstrip/steinway-grand-piano-open.jpg';
imgname[19] = 'Restored Steinway Baby Grand Piano';
imghref[19] = 'product/steinway-grand-piano.php';

imgfile[20] = 'images/thumbs/filmstrip/walnut-chest.jpg';
imgname[20] = 'Figured Walnut Chest';
imghref[20] = 'product/walnut-chest.php';

imgfile[21] = 'images/thumbs/filmstrip/walnut-mirror.jpg';
imgname[21] = 'Circular Walnut Mirror';
imghref[21] = 'product/walnut-circular-mirror.php';
/* 
imgfile[] = 'images/thumbs/filmstrip/***';
imgname[] = '***';
imghref[] = 'product/';
*/

function load () {
  maximgptr = imagecount - displaymax;
  getstartpoint(); 
	showthumbs();
}

function showthumbs () {
var pid;
var hid;
var ptr;

  ptr = imageptr;
  for (i = 1; i <= displaymax; i++) {
	  pid = 'thumbnail' + i.toString();
		hid = 'productpage' + i.toString(); 
		document.getElementById(pid).src = imgfile[ptr];
		document.getElementById(pid).alt = imgname[ptr]; 
		document.getElementById(hid).href = imghref[ptr]; 
		ptr++}

    if (imageptr > 1) {
			document.getElementById('dnbutton').src = 'furniture/dn_button.gif';
			document.getElementById('dnbutton').alt='Scroll images down'; }
    else {
			document.getElementById('dnbutton').src = 'furniture/blankbutton.gif';
			document.getElementById('dnbutton').alt=''; }
    if (imageptr < maximgptr + 1) {
			document.getElementById('upbutton').src = 'furniture/up_button.gif';
			document.getElementById('upbutton').alt='Scroll images up'; }
    else {
			document.getElementById('upbutton').src = 'furniture/blankbutton.gif';
			document.getElementById('upbutton').alt=''; }
	
		
}

function getstartpoint() {
var i = 0;
var j;
  i = Math.random();
	imageptr = Math.ceil(i * maximgptr);
	if (imageptr > maximgptr) imageptr = 1;
}

function steponimage (stepOn) {
  if (stepOn == true) {				 						    /* stepping down */
    if(imageptr < maximgptr +1) {
      imageptr++;
			/* if (imageptr > maximgptr) imageptr = 1;*/
      showthumbs (); }}
  else {							 												/* stepping up */
    if (imageptr > 1) {
      imageptr--;
      showthumbs ();	}}
}











