/***********
** linenPC 4 x 6
***********/
var linen_4_4_6DayTurn = new Array();
linen_4_4_6DayTurn[500] = 125;
linen_4_4_6DayTurn[1000] = 150;
linen_4_4_6DayTurn[2500] = 235;
linen_4_4_6DayTurn[5000] = 300;
linen_4_4_6DayTurn[10000] = 450;

/***********
** linenPC 5 x 7
***********/
var linen_5_4_6DayTurn = new Array();
linen_5_4_6DayTurn[500] = 215;
linen_5_4_6DayTurn[1000] = 250;
linen_5_4_6DayTurn[2500] = 325;
linen_5_4_6DayTurn[5000] = 450;
linen_5_4_6DayTurn[10000] = 820;

/***********
** linenPC 8.5 x 5.5
***********/
var linen_8_4_6DayTurn = new Array();
linen_8_4_6DayTurn[500] = 220;
linen_8_4_6DayTurn[1000] = 275;
linen_8_4_6DayTurn[2500] = 335;
linen_8_4_6DayTurn[5000] = 450;
linen_8_4_6DayTurn[10000] = 850;


/***********
** linenPC 4 x 6 : Delivery Method
***********/
var linen_4_ups3Day 	=	 new Array()	;
linen_4_ups3Day[500] 	=	31	;
linen_4_ups3Day[1000] 	=	51	;
linen_4_ups3Day[2500] 	=	90	;
linen_4_ups3Day[5000] 	=	179	;
linen_4_ups3Day[10000] 	=	360	;
var linen_4_ups2Day 	=	 new Array()	;
linen_4_ups2Day[500] 	=	39	;
linen_4_ups2Day[1000] 	=	67	;
linen_4_ups2Day[2500] 	=	122	;
linen_4_ups2Day[5000] 	=	246	;
linen_4_ups2Day[10000] 	=	492	;;
var linen_4_ups1Day 	=	 new Array()	;
linen_4_ups1Day[500] 	=	93	;
linen_4_ups1Day[1000] 	=	138	;
linen_4_ups1Day[2500] 	=	210	;
linen_4_ups1Day[5000] 	=	420	;
linen_4_ups1Day[10000] 	=	840	;

/***********			
** linenPC 8.5 x 5.5 : Delivery Method			
***********/			
var linen_8_ups3Day 	=	 new Array()	;
linen_8_ups3Day[500] 	=	40	;
linen_8_ups3Day[1000] 	=	90	;
linen_8_ups3Day[2500] 	=	202	;
linen_8_ups3Day[5000] 	=	304	;
linen_8_ups3Day[10000] 	=	604	;
	;
var linen_8_ups2Day 	=	 new Array()	;
linen_8_ups2Day[500] 	=	52	;
linen_8_ups2Day[1000] 	=	124	;
linen_8_ups2Day[2500] 	=	276	;
linen_8_ups2Day[5000] 	=	412	;
linen_8_ups2Day[10000] 	=	826	;

var linen_8_ups1Day 	=	 new Array()	;
linen_8_ups1Day[500] 	=	138	;
linen_8_ups1Day[1000] 	=	207	;
linen_8_ups1Day[2500] 	=	465	;
linen_8_ups1Day[5000] 	=	675	;;
linen_8_ups1Day[10000] 	=	1425	;



/***********
** uncoatedPC 4 x 6
***********/
var uncoatedPC_4_4_6DayTurn = new Array();
uncoatedPC_4_4_6DayTurn[250] = 85;
uncoatedPC_4_4_6DayTurn[500] = 115;
uncoatedPC_4_4_6DayTurn[1000] = 150;
uncoatedPC_4_4_6DayTurn[2500] = 270;
uncoatedPC_4_4_6DayTurn[5000] = 400;
uncoatedPC_4_4_6DayTurn[10000] = 720;

/***********
** uncoatedPC 5 x 7
***********/
var uncoatedPC_5_4_6DayTurn = new Array();
uncoatedPC_5_4_6DayTurn[250] = 170;
uncoatedPC_5_4_6DayTurn[500] = 200;
uncoatedPC_5_4_6DayTurn[1000] = 245;
uncoatedPC_5_4_6DayTurn[2500] = 405;
uncoatedPC_5_4_6DayTurn[5000] = 600;
uncoatedPC_5_4_6DayTurn[10000] = 1230;

/***********
** uncoatedPC 8.5 x 5.5
***********/
var uncoatedPC_8_4_6DayTurn = new Array();
uncoatedPC_8_4_6DayTurn[250] = 180;
uncoatedPC_8_4_6DayTurn[500] = 225;
uncoatedPC_8_4_6DayTurn[1000] = 300;
uncoatedPC_8_4_6DayTurn[2500] = 425;
uncoatedPC_8_4_6DayTurn[5000] = 650;
uncoatedPC_8_4_6DayTurn[10000] = 1300;

/***********
** uncoatedPC 4 x 6 : Delivery Method
***********/
var uncoatedPC_4_ups3Day 	=	 new Array()	;
uncoatedPC_4_ups3Day[250] 	=	25	;
uncoatedPC_4_ups3Day[500] 	=	31	;
uncoatedPC_4_ups3Day[1000] 	=	51	;
uncoatedPC_4_ups3Day[2500] 	=	90	;
uncoatedPC_4_ups3Day[5000] 	=	179	;
uncoatedPC_4_ups3Day[10000] 	=	360	;

var uncoatedPC_4_ups2Day 	=	 new Array()	;
uncoatedPC_4_ups2Day[250] 	=	30	;
uncoatedPC_4_ups2Day[500] 	=	39.	;
uncoatedPC_4_ups2Day[1000] 	=	67	;
uncoatedPC_4_ups2Day[2500] 	=	122	;
uncoatedPC_4_ups2Day[5000] 	=	246	;
uncoatedPC_4_ups2Day[10000] 	=	492	;

var uncoatedPC_4_ups1Day 	=	 new Array()	;
uncoatedPC_4_ups1Day[250] 	=	73	;
uncoatedPC_4_ups1Day[500] 	=	93	;
uncoatedPC_4_ups1Day[1000] 	=	138	;
uncoatedPC_4_ups1Day[2500] 	=	210	;
uncoatedPC_4_ups1Day[5000] 	=	420	;
uncoatedPC_4_ups1Day[10000] 	=	840	;

			
/***********			
** uncoatedPC 8.5 x 5.5 : Delivery Method			
***********/			
var uncoatedPC_8_ups3Day 	=	 new Array()	;
uncoatedPC_8_ups3Day[250] 	=	30	;
uncoatedPC_8_ups3Day[500] 	=	40	;
uncoatedPC_8_ups3Day[1000] 	=	90	;
uncoatedPC_8_ups3Day[2500] 	=	202	;
uncoatedPC_8_ups3Day[5000] 	=	304	;
uncoatedPC_8_ups3Day[10000] 	=	604	;

var uncoatedPC_8_ups2Day 	=	 new Array()	;
uncoatedPC_8_ups3Day[250] 	=	40	;
uncoatedPC_8_ups2Day[500] 	=	52	;
uncoatedPC_8_ups2Day[1000] 	=	124	;
uncoatedPC_8_ups2Day[2500] 	=	276	;
uncoatedPC_8_ups2Day[5000] 	=	412	;
uncoatedPC_8_ups2Day[10000] 	=	826	;

var uncoatedPC_8_ups1Day 	=	 new Array()	;
uncoatedPC_8_ups1Day[250] 	=	100	;
uncoatedPC_8_ups1Day[500] 	=	138	;
uncoatedPC_8_ups1Day[1000] 	=	207	;
uncoatedPC_8_ups1Day[2500] 	=	465	;
uncoatedPC_8_ups1Day[5000] 	=	675	;
uncoatedPC_8_ups1Day[10000] 	=	1425	;
;

/***********
** turnAround
***********/
/***********
** regularRunPC 4 x 6
***********/
var p_4_4_6DayTurn = new Array();
p_4_4_6DayTurn[250] = 75;
p_4_4_6DayTurn[500] = 85;
p_4_4_6DayTurn[1000] = 100;
p_4_4_6DayTurn[2500] = 175;
p_4_4_6DayTurn[5000] = 275;
p_4_4_6DayTurn[10000] = 375;


/***********
** regularRunPC 5 x 7
***********/
var p_5_4_6DayTurn = new Array();
p_5_4_6DayTurn[250] = 85;
p_5_4_6DayTurn[500] = 100;
p_5_4_6DayTurn[1000] = 150;
p_5_4_6DayTurn[2500] = 200;
p_5_4_6DayTurn[5000] = 300;
p_5_4_6DayTurn[10000] = 545;


/***********
** regularRunPC 8.5 x 5.5
***********/
var p_8_4_6DayTurn = new Array();
p_8_4_6DayTurn[250] = 125;
p_8_4_6DayTurn[500] = 165;
p_8_4_6DayTurn[1000] = 200;
p_8_4_6DayTurn[2500] = 250;
p_8_4_6DayTurn[5000] = 400;
p_8_4_6DayTurn[10000] = 750;


/***********
** Delivery Method
***********/
/***********
** regularRunPC 4 x 6: Delivery Method
***********/
var p_4_ups3Day 	=	 new Array()	;
p_4_ups3Day[250] 	=	25	;
p_4_ups3Day[500] 	=	31.1	;
p_4_ups3Day[1000] 	=	51.62	;
p_4_ups3Day[2500] 	=	90	;
p_4_ups3Day[5000] 	=	179.96	;
p_4_ups3Day[10000] 	=	360	;

var p_4_ups2Day 	=	 new Array()	;
p_4_ups2Day[250] 	=	30	;
p_4_ups2Day[500] 	=	39.68	;
p_4_ups2Day[1000] 	=	67.78	;
p_4_ups2Day[2500] 	=	122.98	;
p_4_ups2Day[5000] 	=	246	;
p_4_ups2Day[10000] 	=	492	;

var p_4_ups1Day 	=	 new Array()	;
p_4_ups1Day[250] 	=	82	;
p_4_ups1Day[500] 	=	93	;
p_4_ups1Day[1000] 	=	138	;
p_4_ups1Day[2500] 	=	210	;
p_4_ups1Day[5000] 	=	420	;
p_4_ups1Day[10000] 	=	840	;

/***********			
** regularRunPC 8.5 x 5.5: Delivery Method			
***********/			
var p_8_ups3Day 	=	 new Array()	;
p_8_ups3Day[250] 	=	45	;
p_8_ups3Day[500] 	=	54	;
p_8_ups3Day[1000] 	=	86	;
p_8_ups3Day[2500] 	=	198	;
p_8_ups3Day[5000] 	=	304	;
p_8_ups3Day[10000] 	=	604	;
var p_8_ups2Day 	=	 new Array()	;
p_8_ups2Day[250] 	=	60	;
p_8_ups2Day[500] 	=	70	;
p_8_ups2Day[1000] 	=	118	;
p_8_ups2Day[2500] 	=	276	;
p_8_ups2Day[5000] 	=	412	;
p_8_ups2Day[10000] 	=	826	;

			
var p_8_ups1Day 	=	 new Array()	;
p_8_ups1Day[250] 	=	100	;
p_8_ups1Day[500] 	=	126	;
p_8_ups1Day[1000] 	=	207	;
p_8_ups1Day[2500] 	=	465	;
p_8_ups1Day[5000] 	=	675	;
p_8_ups1Day[10000] 	=	1425	;

var ship_4_ground =	 new Array();
ship_4_ground[250] 	=	8	;
ship_4_ground[500] 	=	10	;
ship_4_ground[1000] 	=	12	;
ship_4_ground[2500] 	=	18	;
ship_4_ground[5000] 	=	36	;
ship_4_ground[10000] 	=	70	;

var ship_5_ground =	 new Array();
ship_5_ground[250] 	=	10	;
ship_5_ground[500] 	=	12	;
ship_5_ground[1000] 	=	15	;
ship_5_ground[2500] 	=	23	;
ship_5_ground[5000] 	=	42	;
ship_5_ground[10000] 	=	85	;

var ship_8_ground =	 new Array();
ship_8_ground[250] 	=	14	;
ship_8_ground[500] 	=	16	;
ship_8_ground[1000] 	=	20	;
ship_8_ground[2500] 	=	25	;
ship_8_ground[5000] 	=	45	;
ship_8_ground[10000] 	=	90	;

function calc(product){
	f = document.add;
	totalDiv = document.getElementById("subTotal");
	shippingDiv = document.getElementById("shipping");
	//turnaround = f.turnaround.options[f.turnaround.selectedIndex].value;
	pcSize = f.pcSize.options[f.pcSize.selectedIndex].value;
	runsize = f.runsize.options[f.runsize.selectedIndex].value;
	delivery = f.delivery.options[f.delivery.selectedIndex].value;
	stock = f.stock.options[f.stock.selectedIndex].value;
	if(stock == "Recycled 100lb Linen Cover")
		stock = "linen";
	else if(stock == "Recycled 100lb Uncoated Cover")
		stock = "uncoatedPC";
	else if(stock != "")
		stock = "p";
	shippingCost =0;
	total = 0;
 if(runsize != "" && pcSize != "" && stock != ""){
	 //alert(runsize+" "+pcSize+" "+stock)
	 if(pcSize == "4 x 6"){		 
		 total = eval(stock+"_4_4_6DayTurn[runsize]");
	 }else if(pcSize == "5 x 7"){
		 total = eval(stock+"_5_4_6DayTurn[runsize]");
	 }else if(pcSize == "8.5 x 5.5"){
		 total = eval(stock+"_8_4_6DayTurn[runsize]");
	 }
 }
if(runsize != "" && delivery != "" && pcSize != "" && stock != ""){
   if(pcSize == "4 x 6" || pcSize == "5 x 7"){ //same prices for shipping
	  if(delivery == "UPS 3 DAY SELECT")
		 shippingCost = eval(stock+"_4_ups3Day[runsize]");
	  else if(delivery == "UPS 2nd DAY AIR")
	  	 shippingCost = eval(stock+"_4_ups2Day[runsize]");
	  else if(delivery == "UPS NEXT DAY AIR")
	  	 shippingCost = eval(stock+"_4_ups1Day[runsize]");
		 
	  if(delivery == "UPS GROUND"){
		 if(pcSize == "4 x 6") 
	     	shippingCost = eval("ship_4_ground[runsize]");
		 else if(pcSize == "5 x 7") 
	     	shippingCost = eval("ship_5_ground[runsize]");
	  }
   }else if(pcSize == "8.5 x 5.5"){
      if(delivery == "UPS 3 DAY SELECT")
		 shippingCost = eval(stock+"_8_ups3Day[runsize]");
	  else if(delivery == "UPS 2nd DAY AIR")
	  	 shippingCost = eval(stock+"_8_ups2Day[runsize]");
	  else if(delivery == "UPS NEXT DAY AIR")
	  	 shippingCost = eval(stock+"_8_ups1Day[runsize]");
 	  else if(delivery == "UPS GROUND") 
	  	shippingCost = eval("ship_8_ground[runsize]");
   }
    if( delivery=="Pick Up")
		shippingCost = 0;  

}else if(delivery == "" || delivery=="Pick Up")
	  shippingCost = 0;
  
f.total.value = total;
total += shippingCost;
//totalDiv.innerHTML = "Subtotal: $"+total;
totalDiv.innerHTML = "Price: <span style=\"color:#003300\">$"+total+"</span>";
f.shippingCost.value = shippingCost;
shippingDiv.innerHTML = "Shipping Cost: $"+shippingCost;
}

function changeOption(obj){
var chosen = obj.options[obj.selectedIndex].value;
f = document.add;
//alert(chosen+"="+f.runsize.options.length);

if(f.coating.options.length !=1 && (chosen == "Recycled 100lb Linen Cover" || chosen=="Recycled 100lb Uncoated Cover")){	
f.coating.options.length=0;
f.coating.options[0]=new Option("No Coating Available", "No Coating", true, false);
//new Option(text, value, defaultSelected, selected)
}else if(f.coating.options.length !=4){
f.coating.options.length=0;
f.coating.options[0]=new Option("---Select Type Of Coating---","", true, false);
f.coating.options[1]=new Option("UV Coating on BOTH Sides","UV Coating on BOTH Sides",false, false);
f.coating.options[2]=new Option("UV Coating on FRONT only","UV Coating on FRONT only",false, false);
f.coating.options[3]=new Option("Matte Finish", "Matte Finish", false, false);
}

if(chosen == "Recycled 100lb Linen Cover" && f.runsize.options.length != 6){
	f.runsize.options.length=0;
	f.runsize.options[0]=new Option("----Select Run Size----", "", true, false);
	f.runsize.options[1]=new Option("500", "500", false, false);	
	f.runsize.options[2]=new Option("1,000", "1000", false, false);
	f.runsize.options[3]=new Option("2,500", "2500", false, false);	
	f.runsize.options[4]=new Option("5,000", "5000", false, false);	
	f.runsize.options[5]=new Option("10,000", "10000", false, false);
}else if(chosen != "Recycled 100lb Linen Cover" && f.runsize.options.length!=7){
	f.runsize.options.length=0;
	f.runsize.options[0]=new Option("----Select Run Size----", "", true, false);
	f.runsize.options[1]=new Option("250", "250", false, false);
	f.runsize.options[2]=new Option("500", "500", false, false);	
	f.runsize.options[3]=new Option("1,000", "1000", false, false);
	f.runsize.options[4]=new Option("2,500", "2500", false, false);	
	f.runsize.options[5]=new Option("5,000", "5000", false, false);	
	f.runsize.options[6]=new Option("10,000", "10000", false, false);	
}
calc();
}
