function CalcSuper()
{
	var total = document.getElementById('total');
	var L1 = document.getElementById('L1').value;
	var L2 = document.getElementById('L2').value;
	var L3 = document.getElementById('L3').value;
	var L4 = document.getElementById('L4').value;
	var L5 = document.getElementById('L5').value;
	var L6 = document.getElementById('L6').value;
	var L7 = document.getElementById('L7').value;
	var L8 = document.getElementById('L8').value;
	var L9 = document.getElementById('L9').value;
	var L10 = document.getElementById('L10').value;
	var L11 = document.getElementById('L11').value;
	var L12 = document.getElementById('L12').value;
	var P1 = document.getElementById('P1').value;
	var P2 = document.getElementById('P2').value;
	var P3 = document.getElementById('P3').value;
	var temp = 0;
	var roomtotal = 0;
	var areatotal = 0;
	var TVQ = 0;
	var TPS = 0;
	var dofeet = false;
	var costInstall = 4.0;
	var costCoulis = 0.25;
	var costGlue = 0.50;
	
	// Metres or feet
	// temp *= 0.092903;
	// temp *= 10.7639;
	if (document.getElementById('R1').checked)
	{
		dofeet = false;
		// temp *= 0.092903;
		costInstall = 43.00;
		costCoulis = 2.69;
		costGlue = 5.40;
	} 
	else
	{
		dofeet = true;
		// temp *= 10.7639;
		costInstall = 4.0;
		costCoulis = 0.25;
		costGlue = 0.50;
	}
	document.form1.AP1.value = costGlue.toFixed(2);
	document.form1.CP1.value = costCoulis.toFixed(2);
	document.form1.IP1.value = costInstall.toFixed(2);
	
	if (IsNumeric(L1) && IsNumeric(L2))
	{
		temp = parseFloat(L1) * parseFloat(L2);
		roomtotal = temp;
		document.form1.T1.value = temp;
	}
	if (IsNumeric(L3) && IsNumeric(L4))
	{
		temp = parseFloat(L3) * parseFloat(L4);
		roomtotal += temp;
		document.form1.T1.value = roomtotal;
	}
	if (document.form1.C1.checked)
	{
		temp = document.form1.T1.value * 1.1;
		document.form1.T1.value = temp.toFixed(3);
	}
	else
	{
		document.form1.T1.value = roomtotal;
	}
	if (IsNumeric(P1))
	{
		temp = parseFloat(document.form1.T1.value) * parseFloat(P1);
		document.form1.S1.value = temp.toFixed(2);
	}

	// Room 2
	roomtotal = 0;
	if (IsNumeric(L5) && IsNumeric(L6))
	{
		temp = parseFloat(L5) * parseFloat(L6);
		roomtotal = temp;
		document.form1.T2.value = roomtotal;
	}
	if (IsNumeric(L7) && IsNumeric(L8))
	{
		temp = parseFloat(L7) * parseFloat(L8);
		roomtotal += temp;
		document.form1.T2.value = roomtotal;
	}
	if (document.form1.C2.checked)
	{
		temp = document.form1.T2.value * 1.1;
		document.form1.T2.value = temp.toFixed(3);
	}
	else
	{
		document.form1.T2.value = roomtotal;
	}
	if (IsNumeric(P2))
	{
		temp = parseFloat(document.form1.T2.value) * parseFloat(P2);
		document.form1.S2.value = temp.toFixed(2);
	}

	// Room 3
	roomtotal = 0;
	if (IsNumeric(L9) && IsNumeric(L10))
	{
		temp = parseFloat(L9) * parseFloat(L10);
		roomtotal = temp;
		document.form1.T3.value = roomtotal;
	}
	if (IsNumeric(L11) && IsNumeric(L12))
	{
		temp = parseFloat(L11) * parseFloat(L12);
		roomtotal += temp;
		document.form1.T3.value = roomtotal;
	}
	if (document.form1.C3.checked)
	{
		temp = document.form1.T3.value * 1.1;
		document.form1.T3.value = temp.toFixed(3);
	}
	else
	{
		document.form1.T3.value = roomtotal;
	}
	if (IsNumeric(P3))
	{
		temp = parseFloat(document.form1.T3.value) * parseFloat(P3);
		document.form1.S3.value = temp.toFixed(2);
	}
	
	areatotal = parseFloat(document.form1.T1.value) + parseFloat(document.form1.T2.value) + parseFloat(document.form1.T3.value);
	total.innerHTML = areatotal;
	document.form1.A1.value = areatotal.toFixed(2);
	document.form1.AT1.value = (areatotal * costGlue).toFixed(2);
	document.form1.CO1.value = areatotal.toFixed(2);
	document.form1.CT1.value = (areatotal * costCoulis).toFixed(2);
	document.form1.MT1.value = (parseFloat(document.form1.S1.value) + parseFloat(document.form1.S2.value) + parseFloat(document.form1.S3.value) + parseFloat(document.form1.AT1.value) + parseFloat(document.form1.CT1.value)).toFixed(2);
	document.form1.I1.value = areatotal.toFixed(2);
	document.form1.IT1.value = (areatotal * costInstall).toFixed(2);
	temp = parseFloat(document.form1.MT1.value) + parseFloat(document.form1.IT1.value);
	TPS = temp * 0.05;
	document.form1.TPS.value = TPS.toFixed(2);
	temp += TPS;
	TVQ = temp * 0.075;
	document.form1.TVQ.value = TVQ.toFixed(2);
	temp += TVQ;
	document.form1.GTotal.value = temp.toFixed(2);
}

function IsNumeric(strString)
   //  check for valid numeric strings	
{
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

