<!--

function dp(price) 
{
   string = "" + price;
   number = string.length - string.indexOf('.');
   if (string.indexOf('.') == -1)
      return string + '.00';
   if (number == 1)
      return string + '00';
   if (number == 2)
      return string + '0';
   if (number > 3)
      return string.substring(0,string.length-number+3);
return string;
}

function calculate()
{

var SubTotal, sum1,sum2;
WidthValue = new Array(3);
GrillValue = new Array(3);
CheckValue = new Array(3);
LowEValue = new Array(3);
TotalRow = new Array(3);
PriceWidth = new Array(3);


WidthValue[0]=document.patio_form.Width1.value;
WidthValue[1]=document.patio_form.Width2.value;
WidthValue[2]=document.patio_form.Width3.value;


for (i=0; i<3; i++) {
	switch (WidthValue[i]) {
		case 's0' : PriceWidth[i] = 0
		break
		case 's5' : PriceWidth[i]  = 398.26
		break
		case 's6' : PriceWidth[i]  = 447.69
		break
		case 's7' : PriceWidth[i]  = 496.88
		break
		case 's8' : PriceWidth[i]  = 598.07
		break
		default : PriceWidth[i]  = 0
		}
	}
//checked
if (document.patio_form.grills1.checked) {GrillValue[0] = 1} else{GrillValue[0] = 0};
if (document.patio_form.grills2.checked) {GrillValue[1] = 1} else{GrillValue[1] = 0};
if (document.patio_form.grills3.checked) {GrillValue[2] = 1} else{GrillValue[2] = 0};


LowEValue[0]=document.patio_form.argon1.value;
LowEValue[1]=document.patio_form.argon2.value;
LowEValue[2]=document.patio_form.argon3.value;

SubTotal = 0;
for (i=0; i<3; i++) {
	TotalRow[i] = 0;
	sum1 = 0;
	sum2 = 0;

	if (!(parseFloat(PriceWidth[i] == 0)))  {

	sum1 = GrillValue[i] * 0.3 * PriceWidth[i];
        	sum2 = LowEValue[i] * PriceWidth[i] *0.15;
	TotalRow[i] = PriceWidth[i] * 1.4 + sum1+ sum2;
   						}

	SubTotal = SubTotal + TotalRow[i];
        }

document.patio_form.subtotal.value = dp(parseFloat(SubTotal));

document.patio_form.tax.value = dp((document.patio_form.subtotal.value)*0.15);
document.patio_form.taxgst.value = dp((document.patio_form.subtotal.value)*0.07);
document.patio_form.taxpst.value = dp((document.patio_form.subtotal.value)*0.08);
document.patio_form.total.value = dp((document.patio_form.subtotal.value)*1.15);

}

function CheckNumeric()
{
   // Get ASCII value of key that user pressed
   var key = window.event.keyCode;

   // Was key that was pressed a numeric character (0-9)?
   if ( key > 47 && key < 58 )
      return; // if so, do nothing
   else
      window.event.returnValue = null; // otherwise, 
	                               // discard character
}


//-->
