
<!--

var pix;

function load_images(who, num_images, num_slots, width, height)
{
    var i;

    pix = new Array (num_images+1);

    for (i = 1; i <= num_images; i++)
    {
	pix[i] = new Image (width, height);
	pix[i].src = 'images/' + who + '-' + i + '.jpg';
    }

    cmd = "switch_slide('" + who + "', " + num_images + "," + num_slots + "," + num_slots + ")";

    setTimeout (cmd, 2000);
}

function switch_slide (who, num_images, num_slots, last_shown)
{
    var imgdest;
    var imgsrc;

    self.status= ('switch_slide(' + who + ',' + num_images + ',' + num_slots + ')');

    // for each image slot available, move the image on its right to it
    for ( i = 1; i < num_slots; i++ )
    {
	var second = i + 1;
	imgdest = who + "-" + i;
	imgsrc = who + "-" + second;

	// first move what's in the image to the right to imgname
	self.status = ("Loop: " + imgdest + " = " + imgsrc);
	window.document.images[imgdest].src =
	    window.document.images[imgsrc].src;
    }

    // now select the next image to put in the last spot
    imgdest = who + "-" + num_slots;

    if (last_shown < num_images)
	{ next = last_shown + 1; }
    else
	{ next = 1; }

    self.status = (imgdest + " = next->" + next);
    window.document.images[imgdest].src = pix[next].src;

    cmd = "switch_slide('" + who + "'," + num_images + "," + num_slots + "," + next + ")";
    setTimeout (cmd, 2000);
}
//-->
