
//----------------------------------------------------------------------------------------------------------------------------
function setOptions(PC, AorB)
//Populate the OPTIONS array for the current table
{
//alert("Set Options:" + PC);
var options ="";
//alert(AorB)
if (AorB == "A")
	{	
	//Generate first column of values (half the amount of options)
	//alert("generating options from 0 to " + Math.round((eval("hw" + PC).length)/2))
	for (var i =0; i < Math.round((eval("hw" + PC).length)/2); i++)
	{
		options += '<INPUT Name="' + eval("hw" + PC + "[i]") + '" type="checkbox" hidefocus onClick="inspectBox(PCno)">' + eval("desc" + PC + "[i]") + ': £' + eval("price" + PC + '[i]')/100 + '<br>';

	//alert(AorB + options);
	}
}
	else
{	
	//Generate remaining column values (could be 1 less than half if odd number of options)
	//alert("generating options from " + Math.round((eval("hw" + PC).length)/2) + " to " + eval("hw" + PC).length)
	for (var i = Math.round((eval("hw" + PC).length)/2); i < eval("hw" + PC).length; i++)
	{
		options += '<INPUT Name="' + eval("hw" + PC + "[i]") + '" type="checkbox" hidefocus onClick="inspectBox(PCno)">' + eval("desc" + PC + "[i]") + ': £' + eval("price" + PC + '[i]')/100 + '<br>';

	//alert(AorB + options);
	}
}
	eval("document.all.OPTIONS" + AorB).innerHTML = options;
}



//*-----------------------------------------------------------------------------------------------------------------------------
function calcPrice (PC, WithVGA)
//PC = product number 1,2,3...99   WithVGA = marker to determine if current option is to be included in A or B price (or both)
{
var totPrice = 0
globOptions = ""
//alert("calcPrice for PC " + PC + " with build: " + WithVGA)

//Loop through all arrays for options
for (var i =0; i < eval("hw" + PC).length; i++)
	{	
		//Generate name of checkbox item eg "RAM"
		var thisHW = eval("hw" + PC + "[i]")
		//alert("2. " + thisHW)
		
		//See if corresponding option is for this BUILD eg A or B
		var thisBuild = eval("build" + PC + "[i]")
		//alert("3. " + thisBuild)
				
		//Extract the checked propery of the checkbox value
		var thisTicked = eval(thisHW + ".checked")
		//alert("4. Checked: " + thisTicked)
		
		//if the option of the nth element is checked and this product price should be
		//added to the current build (A or B) then add to running price total
		if ((thisTicked) && (thisBuild.indexOf(WithVGA) > -1))
			{
			//add that price to the base price
			totPrice += parseInt(eval("price" + PCno + "[i]"))
			//alert ("5. Total Price: " + totPrice)
			
			globOptions += thisHW + ":"
			
			 }
	}
	//remove trailing ":" (if any)
	globOptions = (globOptions == "") ? "" : globOptions.slice(0,globOptions.lastIndexOf(":"))

return totPrice
}