// Online Purchase

function calculate(form) {
	
	P1 = document.form1.IC202.value
	Q1 = document.form1.Q_IC202.value
	P1 = Number(P1)
	Q1 = Number(Q1)
	T1 = (P1 * Q1)

	document.form1.T_IC202.value = T1
//
	P2 = document.form1.IC202w.value
	Q2 = document.form1.Q_IC202w.value
	P2 = Number(P2)
	Q2 = Number(Q2)
	T2 = (P2 * Q2)

	document.form1.T_IC202w.value = T2
//
	P3 = document.form1.IC212.value
	Q3 = document.form1.Q_IC212.value
	P3 = Number(P3)
	Q3 = Number(Q3)
	T3 = (P3 * Q3)

	document.form1.T_IC212.value = T3
//	
	P4 = document.form1.IC212w.value
	Q4 = document.form1.Q_IC212w.value
	P4 = Number(P4)
	Q4 = Number(Q4)
	T4 = (P4 * Q4)

	document.form1.T_IC212w.value = T4
//
	P5 = document.form1.IC502w.value
	Q5 = document.form1.Q_IC502w.value
	P5 = Number(P5)
	Q5 = Number(Q5)
	T5 = (P5 * Q5)

	document.form1.T_IC502w.value = T5
//	
	P6 = document.form1.IC602.value
	Q6 = document.form1.Q_IC602.value
	P6 = Number(P6)
	Q6 = Number(Q6)
	T6 = (P6 * Q6)

	document.form1.T_IC602.value = T6

//Amount for the all item purchase
	 Amt = (T1 + T2 + T3 + T4 + T5 + T6)
     	 
	 document.form1.Amount1.value = Amt
	 
//Amount for the all item purchase + shipping
	
	Q = Q1 + Q2 + Q3 + Q4 + Q5 + Q6
	document.form1.T_Quantity.value = Q
	
	SC = document.form1.T_courier.value
	SM = document.form1.method[0].value
	SC = Number (SC)
	SC = (Q * SM)
	
	S1 = document.form1.priceshipping.value
	S1 = Number (S1)
	
	if (document.form1.priceshipping.value == 12){
		Amt2 = Amt + SC 
		}
	else {
		Amt2 = Amt + S1
		} 
	 
//	 
		
	
	document.form1.Amount2.value = Amt2
   


	 
}
//	submit
function mandatory(form) {

if (document.forms[0].name.value == "")
	{
	alert("Please fill in name/company name.")
	return false;
	}
	
if (document.forms[0].contact.value == "")
	{
	alert("Please fill in contact.")
	return false;
	}
	
if (document.forms[0].address.value == "")
	{
	alert("Please fill in your address.")
	return false;
	}

if (document.forms[0].pemail.value == "")
	{
	alert("Please fill in your e-mail address.")
	return false;
	}
	
if (document.forms[0].Amount1.value == "NaN")
	{
	alert("Invalid data.")
	return false;
	}	
		
if (document.forms[0].Amount2.value < 1)
	{
	alert("Please fill product quantity.")
	return false;
	}	
//	
if (document.forms[0].method[0].checked)
	{
	return true;
	}	
else if (document.forms[0].method[1].checked)
	{
	return true;
	}	
else if (document.forms[0].method[2].checked)
	{
	return true;
	}
else {
	alert("Please select a shipping method")
	return false;
	}
	
}

