<!--
//----- 07-24-03, 07-26-03
//----- 08-08-03
//----- objshow.js
//----- An object version of showit
//-----

//----- Start code here...
//----- Move/split the string data into the arrays...
// var theItems = new Array();
// var theDesc  = new Array();
// theItems     = myData.split(",");
// theDesc      = myDesc.split(",");

var n        = theItems.length;
var whichItem = 0;

//----- Some previous variables...
var contentType = 0;			// Image type is 0
var biggestTerm = 0;			// Not used
var arSt        = 0;
var arFin       = 0;

//----- Load all images into cache...
preLoadImages(n);

//----- Initiaize the prototype object
new Panel("",0,0,0);

//----- Attach these instance methods to the object
Panel.prototype.describe = showDescription;
Panel.prototype.display  = getNextImage;

//----- Create new objects... 3 panels in this instance
//----- NOTE: start and count are usually the same, but don't have to be 
//----- Can reference from page as p1.display(), etc ...

arSt   = 0;
arFin  = p1count - 1;
var p1 = new Panel("leftPanel", arSt, arFin, arSt);
// var p1 = new Panel("leftPanel", 0, 3, 0);	// Panel one or left panel

arSt   = p1count;
arFin  = p1count + p2count - 1;
var p2 = new Panel("midPanel", arSt, arFin, arSt); 
// var p2 = new Panel("midPanel", 4, 6, 4);

arSt   = p1count + p2count;
arFin  = p1count + p2count + p3count - 1;
var p3 = new Panel("rightPanel", arSt, arFin, arSt);
// var p3 = new Panel("rightPanel", 7, 10, 7);


//----- Start of function area...
//----- Define constructor method for class Panel
function Panel(myPanel, start, finish, myIcount)
{
	this.myPanel  = myPanel;	// Panel name
	this.start    = start;		// start location in array
	this.finish   = finish;		// last location of this pic group
	this.myIcount = myIcount;	// local counter for rotations
}


function getNextImage(onload)
{
//----- Check for boundries in the image array
	if (!onload)
	{
		if ( (this.myIcount + 1) > this.finish)
		{
			this.myIcount = this.start;
		}
		else this.myIcount++;
	}

	whichItem = this.myIcount;

//----- This displays the image in the assigned panel
	document[this.myPanel].src = theItems[whichItem];	
}

function preLoadImages(max)
{
//----- Load the prefetch buffer... or basically the image cache
//----- NOTE: By specifying a size, they display *MUCH* faster!
        var preBuffer   = new Array();

        for (var i = 0; i < max; i++)
        {
                preBuffer[i]     = new Image(myWidth, myHeight);
                preBuffer[i].src = theItems[i];
        }
}

function setDisplayType(myPanel)
{
//----- Write into the doc so that you have the matching choice..
	if (!myPanel)
	{
		myPanel = "myImages";
	}
        var textType  = '<input type="text" name="myDisplay" value="" size="'+ biggestTerm + '">';
        var imageType = '<img name="' + myPanel + '" border="0" width="' + myWidth + '" height="' + myHeight + '">';

        (contentType) ? document.write(textType) : document.write(imageType);
}


function showDescription()
{
//----- Show current state for description...
	whichItem = this.myIcount;

//----- Write output into an "input" window
	document.game[this.myPanel].value = theDesc[whichItem];
}

//-->
