function validateSelection(id, prodName, price, weightOunces)
{
	obj = document.getElementById(id);
	A = obj.getElementsByTagName('select');

	for (i=0; i<A.length; i++)
	{
		if (A[i].value == 'null') 
		{
			alert ('Please select an item from each drop-down menu for this catalog item before adding it to your cart');
			A[i].focus();
			return false;
		}
	}
	preparePPVars(id, prodName, price, weightOunces);
}

function preparePPVars (id, prodName, price, weightOunces)
{
	obj = document.getElementById(id);
	var sku = obj.id.replace('item', '')
	
	A = obj.getElementsByTagName('select');
	var str = '';

	var color = '';
	var size = '';
	var quant = '';
	
	for (i=0; i<A.length; i++)
	{
		if (A[i].id.indexOf('Color')> -1)
		{
			color = A[i].value
		}
		
		if (A[i].id.indexOf('SizePrice')> -1)
		{
			SizePrice = A[i].value
			colonPos = SizePrice.indexOf(':');
			size = SizePrice.substring(0,colonPos)
			// price = SizePrice.substring(colonPos+1)
		}

		if (A[i].id.indexOf('Quantity') > -1)
		{
			quant = A[i].value
		}
	}
	
	preparePPform(sku, quant, color, size);
}

function preparePPform(sku, quant, color, size)
{	
	obj = document.getElementById('sku');
    obj.value = sku;
	
	obj = document.getElementById('quantity');
    obj.value = quant

	obj = document.getElementById('color');
    obj.value = color

	obj = document.getElementById('size');
    obj.value = size

	obj = document.getElementById('frmCAddToart');
	obj.submit();
}
