var Sum = 190; // The Initial amount  //
var Amt = 0;
var Index = 0;

SumArray = new Array(190); // The prices of products that are selected by default when the page opens //
SelectedIndexes = Array(0); // The selected Indexes of all Radio Buttons //

IndexValues = Array();
// The following arrays contain the Code of the products //
IndexValues[0] = Array('QLS-1','QLS-2','TLSA-1','TLSA-2','IPC','BOX1','BOX2'); 

PricesArray = new Array();
// The following arrays contain the Prices of all the products //
PricesArray[0] = new Array(190,220,255,280,40,140,180);

function CreateModelNumber(RadioIndex, SelectedIndex)
{
	if(SelectedIndex == 0)
	{
		Code = 'QLS-1';
		Sum = 190;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}
	
	if(SelectedIndex == 1)
	{
		Code = 'QLS-2';
		Sum = 220;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}

	if(SelectedIndex == 2)
	{
		Code = 'TLSA-1';
		Sum = 255;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}
	
	if(SelectedIndex == 3)
	{
		Code = 'TLSA-2';
		Sum = 280;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}
	if(SelectedIndex == 4)
	{
		Code = 'IPC';
		Sum = 40;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}

	if(SelectedIndex == 5)
	{
		Code = 'BOX1';
		Sum = 140;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}
	
	if(SelectedIndex == 6)
	{
		Code = 'BOX2';
		Sum = 180;
		Q = document.form1.qty.selectedIndex+1;
		Amt = Sum*Q;
	}
	
	SelectedIndexes[RadioIndex] = SelectedIndex;

	code=''; //The value that is always selected //
	for (i=1;i<1;i++) // This loop generates the code according to the selected Radios //
	{
		Code = IndexValues[i][SelectedIndexes[i]];
	}

	document.getElementById('ModelNumber').innerHTML = Code; // Write the generated Code to the Table at the end of the page //
	document.getElementById('BasicPrice').innerHTML = Sum; // Write the Sum to the Table at the end of the page //
	document.getElementById('OrderQuantity').innerHTML = Q; // Write the Quantity to the Table at the end of the page //
	document.getElementById('OrderTotal').innerHTML = Amt; // Write the Entended Price to the Table at the end of the page //

	document.getElementById('ModelConfig').value = Code; // Set the value of hidden field 'ModelConfig' to the generated Code //

	document.forms.form1.PricePerModel.value = Sum; // Set the value of hidden field 'PricePerModel' to Price Per Model //
	document.forms.form1.hdnQuantity.value = Q; // Set the value of hidden field 'hdnQuantity' to the Quantity //
}

function calculateTotal() // This function is called when the Quantity is changed //
{
	Q = document.form1.qty.selectedIndex+1;
	Amt = Sum*Q;
	
	document.getElementById('BasicPrice').innerHTML = Sum;
	document.getElementById('OrderQuantity').innerHTML = Q;
	document.getElementById('OrderTotal').innerHTML = Amt;

	document.forms.form1.PricePerModel.value = Sum;
	document.forms.form1.hdnQuantity.value = Q;
}

window.onload = function()
{
	code='QLS-1';	
	
	document.getElementById('ModelNumber').innerHTML= Code;
	document.getElementById('ModelConfig').value = Code;
	document.forms.form1.PricePerModel.value = 190;
	document.forms.form1.hdnQuantity.value = 1;
}
