
var lastOption = -1;
var lastProduct = -1;

var lastOptionHover = -1;
var lastProductHover = -1;
var lastProductHoverBGC;

var colorProductSelected = "#ac7d9e";
var colorProductHover = "#ffd3f6";
var colorProductNeutral = "#e3b6d5";

function pickOption(id)
{
	var zz;
	
	// Revert the last one changed
	if( lastOption > -1 )
	{
		zz = document.getElementById("option" + lastOption);
		//zz.style.borderWidth = "0px";
		//zz.style.padding = "5px";
		//zz.style.backgroundColor = "transparent";
		zz.className = "optionneutral";
	}

	// Change the new one
	zz = document.getElementById("option" + id);
	//zz.style.borderWidth = "2px";
	//zz.style.borderColor = "black";
	//zz.style.borderStyle = "solid";
	//zz.style.padding = "3px";
	//zz.style.backgroundColor = "#ac7d9e";
	zz.className = "optionselected";
	
	// Set that this was changed
	lastOption = id;
}

function pickProduct(id)
{
	var zz;
	
	// Revert the last one changed
	if( lastProduct > -1 )
	{
		zz = document.getElementById("product" + lastProduct);
		//zz.style.borderWidth = "0px";
		//zz.style.padding = "2px";
		zz.style.backgroundColor = colorProductNeutral;
	}

	// Change the new one
	zz = document.getElementById("product" + id);
	//zz.style.borderWidth = "2px";
	//zz.style.borderColor = "black";
	//zz.style.borderStyle = "solid";
	//zz.style.padding = "0px";
	zz.style.backgroundColor = colorProductSelected;
	
	// Set that this was changed
	lastProduct = id;
}

function hoverOption(id)
{
	var zz;
	
	// Revert the last one changed
	if( lastOptionHover > -1 )
	{
		zz = document.getElementById("option" + lastOptionHover);
		zz.className = "optionneutral";
		
		if( lastOptionHover == lastOption )
		{
			pickOption(lastOption);
		}
	}

	// Change the new one
	if( id > -1 )
	{
		zz = document.getElementById("option" + id);
		zz.className = "optionhover";
	}
	
	// Set that this was changed
	lastOptionHover = id;
}

function hoverProduct(id)
{
	var zz;
	
	// Revert the last one changed
	if( lastProductHover > -1 )
	{
		zz = document.getElementById("product" + lastProductHover);
		zz.style.backgroundColor = colorProductNeutral;
		
		if( lastProductHover == lastProduct )
		{
			pickProduct(lastProduct);
		}
	}

	// Change the new one
	if( id > -1 )
	{
		zz = document.getElementById("product" + id);
		zz.style.backgroundColor = colorProductHover;
	}
	
	// Set that this was changed
	lastProductHover = id;	
}

function addToCartOptReq()
{
	// Check for a product choice
	if( lastProduct <= -1 )
	{
		alert("Please choose a product.");
		return;
	}
	
	if( lastOption <= -1 )
	{
		alert("Please choose an option.");
		return;
	}
	
	window.location = "cart.php?act=add&prod=" + lastProduct + "&opt=" + lastOption + "&cid=" + cid;
}

function addToCart()
{
	// Check for a product choice
	if( lastProduct <= -1 )
	{
		alert("Please choose a product.");
		return;
	}

	window.location = "cart.php?act=add&prod=" + lastProduct + "&cid=" + cid;
}

