
/*************************************************************
Copyright 1998 - 2009, Internet Business Images, LLC. All rights reserved.
This notice applies to this script and to all other elements of this web site. 
Title 17 of the United States Code reserves all aspects of copyright to the 
copyright owner.  It is a violation of federal law to copy, reuse, republish, or
to make derivative works without the written permission of the copyright holder.  
Any change to the structure or content of this web site or any element therof 
is considered to be a derivative work.  In addition to civil remedies for 
violation, certain specified acts including removal of any copyright notice
such as the one above are Federal Crimes under subsection 506 of Title 17. 
*************************************************************/
function RECalc()
{
	form = document.orderpay;
	form2 = document.reqpay;
	
	Disc="DIST08";
	
	var T=form.Samptype.value;	
	Q=form.pack.value;
	N=form.quant.value;
	S=form.size.value;
	Code=form.ccicode.value;	
		
	PW=0;
	P=0.00;
	P2009=0.00;
	
	if (T=="XL150")
	{
	PQ=33.27;
	PG=21.32;
	PB=9.97;
	if (Q=="Quarts") P=PQ;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;
	
	if (Q=="Quarts") PW=0.75;
	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=30.00;
	}


/* Screened Products */	

	else
	if (T=="XL150(+270)")
	{
	PG=40.7451;
	PB=22.1355;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;

	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=33.00;
	}
	else
	if (T=="XL150(-270)")
	{
	PG=44.6667;
	PB=22.4920;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;

	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=33.00;
	}
	else
	if (T=="XL150(+230)")
	{
	PG=32.9020;
	PB=21.42248;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;

	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=33.00;
	}
	else
	if (T=="XL150(-230)")
	{
	PG=36.8236;
	PB=21.77898;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;

	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=33.00;
	}
	else
	if (T=="XL150(+200)")
	{
	PG=31.3334;
	PB=20.70945;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;

	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=33.00;
	}
	else
	if (T=="XL150(-200)")
	{
	PG=35.2550;
	PB=21.06598;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	if (Code==Disc) P2009=P*0.75;
	if (Code!=Disc) P2009=P*0.85;

	if (Q=="Gallons") PW=3.00;
	if (Q=="Boxes") PW=33.00;
	}
	
/* End Screened Products */
	
	
	
	 else
	 if (T=="W300")
	{
	PQ=23.2314;
	PG=17.8353;
	PB=10.4541;
	if (Q=="Quarts") P=PQ;
	if (Q=="Gallons") P=PG;
	if (Q=="Boxes") P=PB;
	
	 P2009=P*0.85;
	
	if (Q=="Quarts") PW=1.50;
	if (Q=="Gallons") PW=5.50;
	if (Q=="Boxes") PW=42.00;
	}
	
		else
			if (T=="TG75")
			{
			PQ=12.9118;
			PG=9.4824;
			PB=5.7833;
			if (Q=="Quarts") P=PQ;
			if (Q=="Gallons") P=PG;
			if (Q=="Boxes") P=PB;
			
			 P2009=P*0.85;
			
			if (Q=="Quarts") PW=2.00;
			if (Q=="Gallons") PW=6.00;
			if (Q=="Boxes") PW=40.00;
			}
		else
			if (T=="MG150")
			{
			PQ=12.9118;
			PG=8.6981;
			PB=5.4892;
			if (Q=="Quarts") P=PQ;
			if (Q=="Gallons") P=PG;
			if (Q=="Boxes") P=PB;
			
			 P2009=P*0.85;
			 
			if (Q=="Quarts") PW=2.00;
			if (Q=="Gallons") PW=6.00;
			if (Q=="Boxes") PW=40.00;
			}
	else
			if (T=="SG300")
			{
			PQ=12.9118;
			PG=7.7177;
			PB=4.5186;
			if (Q=="Quarts") P=PQ;
			if (Q=="Gallons") P=PG;
			if (Q=="Boxes") P=PB;
			
			 P2009=P*0.85;
			
			if (Q=="Quarts") PW=2.00;
			if (Q=="Gallons") PW=6.00;
			if (Q=="Boxes") PW=40.00;
			}
	else
			if (T=="SG500")
			{
			PQ=12.9118;
			PG=7.3255;
			PB=4.3715;
			if (Q=="Quarts") P=PQ;
			if (Q=="Gallons") P=PG;
			if (Q=="Boxes") P=PB;
			
			 P2009=P*0.85;
			
			if (Q=="Quarts") PW=2.00;
			if (Q=="Gallons") PW=6.00;
			if (Q=="Boxes") PW=40.00;
			}
	
		else
			if (T=="VEAX10")
			{
			PQ=57.39;
			PG=52.53;
			PB=34.38;
			if (Q=="Quarts") P=PQ;
			if (Q=="Gallons") P=PG;
			if (Q=="Boxes") P=PB;
			
			 P2009=P*0.85;
			
			if (Q=="Quarts") PW=0.50;
			if (Q=="Gallons") PW=1.40;
			if (Q=="Boxes") PW=10.00;
			}
			
				else
					if (T=="SWARCO")
					{
					PP=4.32777;
					if (Q=="Pails") P=PP;
					
					if (Q=="Pails") PW=50;
					
					 P2009=P*0.85;
					}			
		
	if (N=="0") {P="0.00"; LB="0";}

	LB=PW*N;
	form.pounds.value=fix(LB);
	
	form.price.value="$" + fix4(P2009);
	
	if ((T!="SWARCO") & (Q=="Pails")) {form.price.value="N.A."; form.pounds.value="N.A.";} 
	if ((T=="SWARCO") & (Q!="Pails")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	if (T!="SWARCO") {form.size.value=""; S="";} 
	
	if ((T=="XL150(+270)") & (Q=="Quarts")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	if ((T=="XL150(-270)") & (Q=="Quarts")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	if ((T=="XL150(+230)") & (Q=="Quarts")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	if ((T=="XL150(-230)") & (Q=="Quarts")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	if ((T=="XL150(+200)") & (Q=="Quarts")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	if ((T=="XL150(-200)") & (Q=="Quarts")) {form.price.value="N.A.";	form.pounds.value="N.A.";}
	
	
	C=P2009*LB;

	form.cost.value="$" + fix(C);
	form2.x_amount.value = fix(C);
		
	form2.x_description.value = N +" "+ Q +" "+T +" " +S;
	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;
}

function fix4(num) {
string = "" + num;
if (string.indexOf('.') == -1)
return string + '.00';
separation = string.length - string.indexOf('.');
if (separation > 5)
return string.substring(0,string.length-separation+5);
 else if (separation == 2)
 return string + '00';
return string;
}