function initFromXML(xml)
{
	this.title = getNodeData(xml,'title',0);
	this.thumbPath = getNodeData(xml,'thumbPath',0);
	this.largeImagePath = getNodeData(xml,'largeImagePath',0);
	this.type = getNodeData(xml,'type',0);
	this.toyclass = getNodeData(xml,'toyclass',0);
	this.price = getNodeData(xml, 'price',0);
	this.limited_edition = getNodeData(xml, 'limited_edition',0);
	this.sizes = getNodeData(xml, 'sizes',0);
	this.numericPrice = getNodeData(xml, 'numeric_price',0);
	this.paypal_item_code= getNodeData(xml, 'paypal_item_code',0);
	this.year = getNodeData(xml, 'year',0);
	this.series = getNodeData(xml, 'series', 0);
	this.description = getNodeData(xml, 'description',0);
	this.is_trademarked = getNodeData(xml, 'is_trademarked',0);
}

function GridImage(xml)
{
	this.title = getNodeData(xml,'title',0);
	this.thumbPath = getNodeData(xml,'thumbPath',0);
	this.largeImagePath = getNodeData(xml,'largeImagePath',0);
	this.type = getNodeData(xml,'type',0);
	this.toyclass = getNodeData(xml,'toyclass',0);
	this.price = getNodeData(xml, 'price',0);
	this.limited_edition = getNodeData(xml, 'limited_edition',0);
	this.sizes = getNodeData(xml, 'sizes',0);
	this.numericPrice = getNodeData(xml, 'numeric_price',0);
	this.paypal_item_code= getNodeData(xml, 'paypal_item_code',0);
	this.year = getNodeData(xml, 'year',0);
	this.series = getNodeData(xml, 'series', 0);
	this.description = getNodeData(xml, 'description',0);
	this.is_trademarked = getNodeData(xml, 'is_trademarked',0);

	this.initFromXML = initFromXML;
}

function GridAddImage(theImage, index)
{
	this.gridImages[index] = theImage;
}

function GridRender()
{
	for (var i = 0; i < this.size; i++)
	{
		document.getElementById(this.sizeString + (i+1)).src = this.gridImages[i].thumbPath;
		document.getElementById(this.sizeString + (i+1)).alt = this.gridImages[i].title;
	}
}

function Grid(gridSize)
{
	this.size = gridSize;
	this.gridImages = new Array(gridSize);
	
	if (gridSize == 9)
	{
		this.sizeString = "nine_";
	}
	else if (gridSize == 16)
	{
		this.sizeString = "sixteen_";
	}
	else if (gridSize == 25)
	{
		this.sizeString = "twenty_five_";
	}
	else if (gridSize == 2)
	{
		this.sizeString = "two_";
	}
	else if (gridSize == 4)
	{
		this.sizeString = "four_";
	}
	else if (gridSize == 36)
	{
		this.sizeString = "thirty_six_";
	}
	else if (gridSize == 100)
	{
		this.sizeString = "one_hundred_";
	}
	this.AddImage = GridAddImage;
	this.Render = GridRender;
}
