
function RECalc()
{
	form = document.bulkpay;
	form2 = document.reqpay;
	
	D=eval(form.day.value);
	M=eval(form.month.value);
	Y=eval(form.year.value);
	
	/*
	PD=3.90;
	PS1=2.50;
	PS6=2.25;
	PS11=2.00;
	PS16=1.70;
	PS20=1.40;
	Discounted prices for 2007 - 15% off - no quantity discount
	*/
	
	Disc="2Connect";
	PP=5.15;
	PS=2.58;
	PT=1.57;
	
	T=form.Prod.value;	
	Q=form.pack.value;
	N=form.quant.value;
	Car=form.carrier.value;
	Code=form.ccicode.value;	
	
	P=0.00;
	
	if (Q=="Pallets") P=PP;
	if (Q=="Supersacks") P=PS;
	if (Q=="Truckloads") P=PT;
	
	P2007=P*0.85;
	if (Code==Disc) P2007=P*0.75;

	
/*
	if (Q=="Supersacks" & (N>=1 & N<=5)) P=PS1;
	if (Q=="Supersacks" & (N>=6 & N<=10)) P=PS6;
	if (Q=="Supersacks" & (N>=11 & N<=15)) P=PS11;
	if (Q=="Supersacks" & (N>=16 & N<=19)) P=PS16;
	if (Q=="Supersacks" & (N>=20)) P=PS20;
	if (Q=="Drums") P=PD;
	
	if (((M <= 3) & (Y == 2006)) | ((M == 4) & (Y == 2006)) & (D <= 15)) P=0.99;
*/

	if (N=="0") P2007="0";
	form.price.value="$" + fix(P2007);
	
	PW=0;
	if (Q=="Pallets") PW=270;
	if (Q=="Supersacks") PW=1300;
	if (Q=="Truckloads") PW=26000;
	
	if (N=="0") LB="0";
	LB=PW*N;
	form.pounds.value=LB;
		
	C=P2007*LB;

	form.cost.value="$" + fix(C);
	form2.x_amount.value = fix(C);
	
/*
		if (T=="SG300") 
			 {form.cost.value="Call Us"; form.pounds.value="N.A."; form.price.value="N.A."; form2.x_amount.value = "0.00";};
*/

	form2.x_description.value = N +" -  " + PW + " lb. " +Q +" "+T + " Ship by: " + Car;
	form2.x_invoice_num.value = "none";
	
}

function fix(num) {
string = "" + num;
if (string.indexOf('.') == -1)
return string + '.00';
separation = string.length - string.indexOf('.');
if (separation > 3)
return string.substring(0,string.length-separation+3);
 else if (separation == 2)
 return string + '0';
return string;
}

