/* ORDER page cleverness */
function ImageOption()
{
	this.imgObjects = Array();
	this.optObjects = Array();
	this.imgSelected = Array();
	this.imgUnselected = Array();
	this.selectedID = '';
}

function addImage(imageID, optionID, unselectedSRC, selectedSRC, selected)
{
	var imgObject = document.getElementById(imageID);
	var optObject = document.getElementById(optionID);
	if (imgObject && optObject)
	{
		imgObject.imageOption = this;
		optObject.imageOption = this;
		this.imgObjects[ this.imgObjects.length ] = imgObject;
		this.optObjects[ this.optObjects.length ] = optObject;
		this.imgSelected[ this.imgSelected.length ] = selectedSRC;
		this.imgUnselected[ this.imgUnselected.length ] = unselectedSRC;
		imgObject.onmousedown = function() { this.imageOption.select(imageID); }
		imgObject.style.cursor = 'hand';
		imgObject.style.cursor = 'pointer';
		optObject.style.display = 'none';
		if (selected) this.select(imageID);
	}
}
ImageOption.prototype.addImage = addImage;

function select(imageID)
{
	this.selectedID = imageID;
	var i;
	for (i in this.imgObjects)
	{
		var imgObj = this.imgObjects[i];
		var optObj = this.optObjects[i];

		if (imgObj.id == imageID)
		{
			optObj.checked = true;
			imgObj.src = this.imgSelected[i];
		}
		else
		{
			optObj.checked = false;
			imgObj.src = this.imgUnselected[i];
		}
	}
}
ImageOption.prototype.select = select;