var EC_LithoCalc={flag_form:true,opts:false,skus:false,area:0,selectedArea:0,widthText:0,heightText:0,weights:false,extra:false,prices:false,printRate:0,currentSku:"",currentName:"",currentTitle:"",formContents:"",sizeID:0,timer:0,selWeight:0,localText:false,shipOpts:false,shipRates:[],shipTimes:[],foldRate:0,names:false,titles:false,shipVals:false,foldingOpts:false,formContents:"",international:1,country_code:'<select id="country_code" name="country_code" class="textInput" onchange="EC_LithoCalc.updatePrice()"><option value="CA">Canada</option><option value="MX">Mexico</option><option value="US" selected>United States</option></select>',handling_fee:0,order_action:"",green:false,folding:true,setFoldingOpts:function(){this.foldingOpts=new Hash();this.foldingOpts.set(127,new Hash());this.foldingOpts.get(127).set("name","Tri-Fold (8.5 x 11)");this.foldingOpts.get(127).set("price","0.00");this.foldingOpts.get(127).set("setup","0.00");this.foldingOpts.set(134,new Hash());this.foldingOpts.get(134).set("name","Double-Parallel (8.5 x 14)");this.foldingOpts.get(134).set("price","0.00");this.foldingOpts.get(134).set("setup","0.00");},additional:true,additionalOpts:false,setAdditionalOpts:function(){this.additionalOpts=new Hash();this.additionalOpts.set("custom_perforation",new Hash());this.additionalOpts.get("custom_perforation").set(149,new Hash());this.additionalOpts.get("custom_perforation").get(149).set("name","No Perf");this.additionalOpts.get("custom_perforation").get(149).set("price","0.00");this.additionalOpts.get("custom_perforation").get(149).set("setup","0.00");this.additionalOpts.get("custom_perforation").set(152,new Hash());this.additionalOpts.get("custom_perforation").get(152).set("name","Perforated Reply Panel");this.additionalOpts.get("custom_perforation").get(152).set("price","10.00");this.additionalOpts.get("custom_perforation").get(152).set("setup","10.00");},setOpts:function(){this.opts=[];this.opts.product=[];this.opts.product[20]="Letter Size Package";this.opts.coating=[];this.opts.color=[];this.opts.folding=[];this.opts.paper=[];this.opts.size=[];this.opts.turnaround=[];this.opts.turnaround[161]="2-3 Day";this.opts.color[8]="1/0 (Black Front Side)";this.opts.turnaround[91]="3-5 Day";this.opts.paper[96]="24# Offset w/#10 Large-Window Security-Tint Envelope & #9 Window Courtesy Reply Security-Tint Envelope";this.opts.turnaround[92]="5-7 Day";this.opts.color[11]="1/1 (Black Both Sides)";this.opts.color[13]="4/0 (Full Color Front Side)";this.opts.coating[6]="No Coating";this.opts.folding[127]="Tri-Fold (8.5 x 11)";this.opts.color[15]="4/1 (Full Color Front / B&W Back)";this.opts.color[16]="4/4 (Full Color Both Sides)";this.opts.folding[134]="Double-Parallel (8.5 x 14)";this.opts.size[56]="8.5 X 11";this.opts.size[60]="8.5 X 14";},setSkus:function(){this.skus=new Hash();this.addSKU([20,"56",96,8,6,91],475);this.addSKU([20,"56",96,11,6,91],474);this.addSKU([20,"56",96,13,6,91],473);this.addSKU([20,"56",96,15,6,91],472);this.addSKU([20,"56",96,16,6,91],471);this.addSKU([20,"60",96,8,6,91],480);this.addSKU([20,"60",96,11,6,91],479);this.addSKU([20,"60",96,13,6,91],478);this.addSKU([20,"60",96,15,6,91],477);this.addSKU([20,"60",96,16,6,91],476);},setWeights:function(){this.weights=[];this.weights[475]=0;this.weights[474]=0;this.weights[473]=0;this.weights[472]=0;this.weights[471]=0;this.weights[480]=0;this.weights[479]=0;this.weights[478]=0;this.weights[477]=0;this.weights[476]=0;},setPrices:function(){this.prices=new Hash();this.prices.set(475,new Hash());this.prices.get(475).set(1000,new Hash());this.prices.get(475).get(1000).set("i",2758);this.prices.get(475).get(1000).set("p",259);this.prices.get(475).set(2000,new Hash());this.prices.get(475).get(2000).set("i",2759);this.prices.get(475).get(2000).set("p",489);this.prices.get(475).set(3000,new Hash());this.prices.get(475).get(3000).set("i",2760);this.prices.get(475).get(3000).set("p",729);this.prices.get(475).set(4000,new Hash());this.prices.get(475).get(4000).set("i",2761);this.prices.get(475).get(4000).set("p",969);this.prices.get(475).set(5000,new Hash());this.prices.get(475).get(5000).set("i",2762);this.prices.get(475).get(5000).set("p",1195);this.prices.get(475).set(6000,new Hash());this.prices.get(475).get(6000).set("i",2763);this.prices.get(475).get(6000).set("p",1435);this.prices.get(475).set(7000,new Hash());this.prices.get(475).get(7000).set("i",2764);this.prices.get(475).get(7000).set("p",1669);this.prices.get(475).set(8000,new Hash());this.prices.get(475).get(8000).set("i",2765);this.prices.get(475).get(8000).set("p",1889);this.prices.get(475).set(9000,new Hash());this.prices.get(475).get(9000).set("i",2766);this.prices.get(475).get(9000).set("p",2125);this.prices.get(475).set(10000,new Hash());this.prices.get(475).get(10000).set("i",2767);this.prices.get(475).get(10000).set("p",2335);this.prices.get(475).set(15000,new Hash());this.prices.get(475).get(15000).set("i",2768);this.prices.get(475).get(15000).set("p",3465);this.prices.get(475).set(20000,new Hash());this.prices.get(475).get(20000).set("i",2769);this.prices.get(475).get(20000).set("p",4575);this.prices.get(475).set(25000,new Hash());this.prices.get(475).get(25000).set("i",2770);this.prices.get(475).get(25000).set("p",5715);this.prices.set(474,new Hash());this.prices.get(474).set(1000,new Hash());this.prices.get(474).get(1000).set("i",2771);this.prices.get(474).get(1000).set("p",279);this.prices.get(474).set(2000,new Hash());this.prices.get(474).get(2000).set("i",2772);this.prices.get(474).get(2000).set("p",529);this.prices.get(474).set(3000,new Hash());this.prices.get(474).get(3000).set("i",2773);this.prices.get(474).get(3000).set("p",789);this.prices.get(474).set(4000,new Hash());this.prices.get(474).get(4000).set("i",2774);this.prices.get(474).get(4000).set("p",1049);this.prices.get(474).set(5000,new Hash());this.prices.get(474).get(5000).set("i",2775);this.prices.get(474).get(5000).set("p",1299);this.prices.get(474).set(6000,new Hash());this.prices.get(474).get(6000).set("i",2776);this.prices.get(474).get(6000).set("p",1559);this.prices.get(474).set(7000,new Hash());this.prices.get(474).get(7000).set("i",2777);this.prices.get(474).get(7000).set("p",1815);this.prices.get(474).set(8000,new Hash());this.prices.get(474).get(8000).set("i",2778);this.prices.get(474).get(8000).set("p",2049);this.prices.get(474).set(9000,new Hash());this.prices.get(474).get(9000).set("i",2779);this.prices.get(474).get(9000).set("p",2309);this.prices.get(474).set(10000,new Hash());this.prices.get(474).get(10000).set("i",2780);this.prices.get(474).get(10000).set("p",2535);this.prices.get(474).set(15000,new Hash());this.prices.get(474).get(15000).set("i",2781);this.prices.get(474).get(15000).set("p",3759);this.prices.get(474).set(20000,new Hash());this.prices.get(474).get(20000).set("i",2782);this.prices.get(474).get(20000).set("p",4955);this.prices.get(474).set(25000,new Hash());this.prices.get(474).get(25000).set("i",2783);this.prices.get(474).get(25000).set("p",6189);this.prices.set(473,new Hash());this.prices.get(473).set(1000,new Hash());this.prices.get(473).get(1000).set("i",2784);this.prices.get(473).get(1000).set("p",315);this.prices.get(473).set(2000,new Hash());this.prices.get(473).get(2000).set("i",2785);this.prices.get(473).get(2000).set("p",589);this.prices.get(473).set(3000,new Hash());this.prices.get(473).get(3000).set("i",2786);this.prices.get(473).get(3000).set("p",879);this.prices.get(473).set(4000,new Hash());this.prices.get(473).get(4000).set("i",2787);this.prices.get(473).get(4000).set("p",1169);this.prices.get(473).set(5000,new Hash());this.prices.get(473).get(5000).set("i",2788);this.prices.get(473).get(5000).set("p",1439);this.prices.get(473).set(6000,new Hash());this.prices.get(473).get(6000).set("i",2789);this.prices.get(473).get(6000).set("p",1729);this.prices.get(473).set(7000,new Hash());this.prices.get(473).get(7000).set("i",2790);this.prices.get(473).get(7000).set("p",2015);this.prices.get(473).set(8000,new Hash());this.prices.get(473).get(8000).set("i",2791);this.prices.get(473).get(8000).set("p",2275);this.prices.get(473).set(9000,new Hash());this.prices.get(473).get(9000).set("i",2792);this.prices.get(473).get(9000).set("p",2559);this.prices.get(473).set(10000,new Hash());this.prices.get(473).get(10000).set("i",2793);this.prices.get(473).get(10000).set("p",2809);this.prices.get(473).set(15000,new Hash());this.prices.get(473).get(15000).set("i",2794);this.prices.get(473).get(15000).set("p",4159);this.prices.get(473).set(20000,new Hash());this.prices.get(473).get(20000).set("i",2795);this.prices.get(473).get(20000).set("p",5475);this.prices.get(473).set(25000,new Hash());this.prices.get(473).get(25000).set("i",2796);this.prices.get(473).get(25000).set("p",6839);this.prices.set(472,new Hash());this.prices.get(472).set(1000,new Hash());this.prices.get(472).get(1000).set("i",2797);this.prices.get(472).get(1000).set("p",335);this.prices.get(472).set(2000,new Hash());this.prices.get(472).get(2000).set("i",2798);this.prices.get(472).get(2000).set("p",625);this.prices.get(472).set(3000,new Hash());this.prices.get(472).get(3000).set("i",2799);this.prices.get(472).get(3000).set("p",929);this.prices.get(472).set(4000,new Hash());this.prices.get(472).get(4000).set("i",2800);this.prices.get(472).get(4000).set("p",1239);this.prices.get(472).set(5000,new Hash());this.prices.get(472).get(5000).set("i",2801);this.prices.get(472).get(5000).set("p",1529);this.prices.get(472).set(6000,new Hash());this.prices.get(472).get(6000).set("i",2802);this.prices.get(472).get(6000).set("p",1835);this.prices.get(472).set(7000,new Hash());this.prices.get(472).get(7000).set("i",2803);this.prices.get(472).get(7000).set("p",2139);this.prices.get(472).set(8000,new Hash());this.prices.get(472).get(8000).set("i",2804);this.prices.get(472).get(8000).set("p",2415);this.prices.get(472).set(9000,new Hash());this.prices.get(472).get(9000).set("i",2805);this.prices.get(472).get(9000).set("p",2715);this.prices.get(472).set(10000,new Hash());this.prices.get(472).get(10000).set("i",2806);this.prices.get(472).get(10000).set("p",2979);this.prices.get(472).set(15000,new Hash());this.prices.get(472).get(15000).set("i",2807);this.prices.get(472).get(15000).set("p",4405);this.prices.get(472).set(20000,new Hash());this.prices.get(472).get(20000).set("i",2808);this.prices.get(472).get(20000).set("p",5795);this.prices.get(472).set(25000,new Hash());this.prices.get(472).get(25000).set("i",2809);this.prices.get(472).get(25000).set("p",7239);this.prices.set(471,new Hash());this.prices.get(471).set(1000,new Hash());this.prices.get(471).get(1000).set("i",2810);this.prices.get(471).get(1000).set("p",395);this.prices.get(471).set(2000,new Hash());this.prices.get(471).get(2000).set("i",2811);this.prices.get(471).get(2000).set("p",735);this.prices.get(471).set(3000,new Hash());this.prices.get(471).get(3000).set("i",2812);this.prices.get(471).get(3000).set("p",1095);this.prices.get(471).set(4000,new Hash());this.prices.get(471).get(4000).set("i",2813);this.prices.get(471).get(4000).set("p",1459);this.prices.get(471).set(5000,new Hash());this.prices.get(471).get(5000).set("i",2814);this.prices.get(471).get(5000).set("p",1795);this.prices.get(471).set(6000,new Hash());this.prices.get(471).get(6000).set("i",2815);this.prices.get(471).get(6000).set("p",2149);this.prices.get(471).set(7000,new Hash());this.prices.get(471).get(7000).set("i",2816);this.prices.get(471).get(7000).set("p",2509);this.prices.get(471).set(8000,new Hash());this.prices.get(471).get(8000).set("i",2817);this.prices.get(471).get(8000).set("p",2829);this.prices.get(471).set(9000,new Hash());this.prices.get(471).get(9000).set("i",2818);this.prices.get(471).get(9000).set("p",3179);this.prices.get(471).set(10000,new Hash());this.prices.get(471).get(10000).set("i",2819);this.prices.get(471).get(10000).set("p",3479);this.prices.get(471).set(15000,new Hash());this.prices.get(471).get(15000).set("i",2820);this.prices.get(471).get(15000).set("p",5139);this.prices.get(471).set(20000,new Hash());this.prices.get(471).get(20000).set("i",2821);this.prices.get(471).get(20000).set("p",6755);this.prices.get(471).set(25000,new Hash());this.prices.get(471).get(25000).set("i",2822);this.prices.get(471).get(25000).set("p",8439);this.prices.set(480,new Hash());this.prices.get(480).set(1000,new Hash());this.prices.get(480).get(1000).set("i",2823);this.prices.get(480).get(1000).set("p",289);this.prices.get(480).set(2000,new Hash());this.prices.get(480).get(2000).set("i",2824);this.prices.get(480).get(2000).set("p",549);this.prices.get(480).set(3000,new Hash());this.prices.get(480).get(3000).set("i",2825);this.prices.get(480).get(3000).set("p",819);this.prices.get(480).set(4000,new Hash());this.prices.get(480).get(4000).set("i",2826);this.prices.get(480).get(4000).set("p",1089);this.prices.get(480).set(5000,new Hash());this.prices.get(480).get(5000).set("i",2827);this.prices.get(480).get(5000).set("p",1339);this.prices.get(480).set(6000,new Hash());this.prices.get(480).get(6000).set("i",2828);this.prices.get(480).get(6000).set("p",1609);this.prices.get(480).set(7000,new Hash());this.prices.get(480).get(7000).set("i",2829);this.prices.get(480).get(7000).set("p",1875);this.prices.get(480).set(8000,new Hash());this.prices.get(480).get(8000).set("i",2830);this.prices.get(480).get(8000).set("p",2119);this.prices.get(480).set(9000,new Hash());this.prices.get(480).get(9000).set("i",2831);this.prices.get(480).get(9000).set("p",2379);this.prices.get(480).set(10000,new Hash());this.prices.get(480).get(10000).set("i",2832);this.prices.get(480).get(10000).set("p",2615);this.prices.get(480).set(15000,new Hash());this.prices.get(480).get(15000).set("i",2833);this.prices.get(480).get(15000).set("p",3875);this.prices.get(480).set(20000,new Hash());this.prices.get(480).get(20000).set("i",2834);this.prices.get(480).get(20000).set("p",5105);this.prices.get(480).set(25000,new Hash());this.prices.get(480).get(25000).set("i",2835);this.prices.get(480).get(25000).set("p",6379);this.prices.set(479,new Hash());this.prices.get(479).set(1000,new Hash());this.prices.get(479).get(1000).set("i",2836);this.prices.get(479).get(1000).set("p",339);this.prices.get(479).set(2000,new Hash());this.prices.get(479).get(2000).set("i",2837);this.prices.get(479).get(2000).set("p",629);this.prices.get(479).set(3000,new Hash());this.prices.get(479).get(3000).set("i",2838);this.prices.get(479).get(3000).set("p",945);this.prices.get(479).set(4000,new Hash());this.prices.get(479).get(4000).set("i",2839);this.prices.get(479).get(4000).set("p",1259);this.prices.get(479).set(5000,new Hash());this.prices.get(479).get(5000).set("i",2840);this.prices.get(479).get(5000).set("p",1549);this.prices.get(479).set(6000,new Hash());this.prices.get(479).get(6000).set("i",2841);this.prices.get(479).get(6000).set("p",1859);this.prices.get(479).set(7000,new Hash());this.prices.get(479).get(7000).set("i",2842);this.prices.get(479).get(7000).set("p",2169);this.prices.get(479).set(8000,new Hash());this.prices.get(479).get(8000).set("i",2843);this.prices.get(479).get(8000).set("p",2445);this.prices.get(479).set(9000,new Hash());this.prices.get(479).get(9000).set("i",2844);this.prices.get(479).get(9000).set("p",2749);this.prices.get(479).set(10000,new Hash());this.prices.get(479).get(10000).set("i",2845);this.prices.get(479).get(10000).set("p",3015);this.prices.get(479).set(15000,new Hash());this.prices.get(479).get(15000).set("i",2846);this.prices.get(479).get(15000).set("p",4459);this.prices.get(479).set(20000,new Hash());this.prices.get(479).get(20000).set("i",2847);this.prices.get(479).get(20000).set("p",5865);this.prices.get(479).set(25000,new Hash());this.prices.get(479).get(25000).set("i",2848);this.prices.get(479).get(25000).set("p",7329);this.prices.set(478,new Hash());this.prices.get(478).set(1000,new Hash());this.prices.get(478).get(1000).set("i",2849);this.prices.get(478).get(1000).set("p",399);this.prices.get(478).set(2000,new Hash());this.prices.get(478).get(2000).set("i",2850);this.prices.get(478).get(2000).set("p",749);this.prices.get(478).set(3000,new Hash());this.prices.get(478).get(3000).set("i",2851);this.prices.get(478).get(3000).set("p",1119);this.prices.get(478).set(4000,new Hash());this.prices.get(478).get(4000).set("i",2852);this.prices.get(478).get(4000).set("p",1489);this.prices.get(478).set(5000,new Hash());this.prices.get(478).get(5000).set("i",2853);this.prices.get(478).get(5000).set("p",1835);this.prices.get(478).set(6000,new Hash());this.prices.get(478).get(6000).set("i",2854);this.prices.get(478).get(6000).set("p",2199);this.prices.get(478).set(7000,new Hash());this.prices.get(478).get(7000).set("i",2855);this.prices.get(478).get(7000).set("p",2569);this.prices.get(478).set(8000,new Hash());this.prices.get(478).get(8000).set("i",2856);this.prices.get(478).get(8000).set("p",2889);this.prices.get(478).set(9000,new Hash());this.prices.get(478).get(9000).set("i",2857);this.prices.get(478).get(9000).set("p",3249);this.prices.get(478).set(10000,new Hash());this.prices.get(478).get(10000).set("i",2858);this.prices.get(478).get(10000).set("p",3559);this.prices.get(478).set(15000,new Hash());this.prices.get(478).get(15000).set("i",2859);this.prices.get(478).get(15000).set("p",5259);this.prices.get(478).set(20000,new Hash());this.prices.get(478).get(20000).set("i",2860);this.prices.get(478).get(20000).set("p",6905);this.prices.get(478).set(25000,new Hash());this.prices.get(478).get(25000).set("i",2861);this.prices.get(478).get(25000).set("p",8629);this.prices.set(477,new Hash());this.prices.get(477).set(1000,new Hash());this.prices.get(477).get(1000).set("i",2862);this.prices.get(477).get(1000).set("p",445);this.prices.get(477).set(2000,new Hash());this.prices.get(477).get(2000).set("i",2863);this.prices.get(477).get(2000).set("p",819);this.prices.get(477).set(3000,new Hash());this.prices.get(477).get(3000).set("i",2864);this.prices.get(477).get(3000).set("p",1229);this.prices.get(477).set(4000,new Hash());this.prices.get(477).get(4000).set("i",2865);this.prices.get(477).get(4000).set("p",1635);this.prices.get(477).set(5000,new Hash());this.prices.get(477).get(5000).set("i",2866);this.prices.get(477).get(5000).set("p",2009);this.prices.get(477).set(6000,new Hash());this.prices.get(477).get(6000).set("i",2867);this.prices.get(477).get(6000).set("p",2409);this.prices.get(477).set(7000,new Hash());this.prices.get(477).get(7000).set("i",2868);this.prices.get(477).get(7000).set("p",2809);this.prices.get(477).set(8000,new Hash());this.prices.get(477).get(8000).set("i",2869);this.prices.get(477).get(8000).set("p",3169);this.prices.get(477).set(9000,new Hash());this.prices.get(477).get(9000).set("i",2870);this.prices.get(477).get(9000).set("p",3559);this.prices.get(477).set(10000,new Hash());this.prices.get(477).get(10000).set("i",2871);this.prices.get(477).get(10000).set("p",3895);this.prices.get(477).set(15000,new Hash());this.prices.get(477).get(15000).set("i",2872);this.prices.get(477).get(15000).set("p",5749);this.prices.get(477).set(20000,new Hash());this.prices.get(477).get(20000).set("i",2873);this.prices.get(477).get(20000).set("p",7545);this.prices.get(477).set(25000,new Hash());this.prices.get(477).get(25000).set("i",2874);this.prices.get(477).get(25000).set("p",9429);this.prices.set(476,new Hash());this.prices.get(476).set(1000,new Hash());this.prices.get(476).get(1000).set("i",2875);this.prices.get(476).get(1000).set("p",565);this.prices.get(476).set(2000,new Hash());this.prices.get(476).get(2000).set("i",2876);this.prices.get(476).get(2000).set("p",1039);this.prices.get(476).set(3000,new Hash());this.prices.get(476).get(3000).set("i",2877);this.prices.get(476).get(3000).set("p",1549);this.prices.get(476).set(4000,new Hash());this.prices.get(476).get(4000).set("i",2878);this.prices.get(476).get(4000).set("p",2069);this.prices.get(476).set(5000,new Hash());this.prices.get(476).get(5000).set("i",2879);this.prices.get(476).get(5000).set("p",2539);this.prices.get(476).set(6000,new Hash());this.prices.get(476).get(6000).set("i",2880);this.prices.get(476).get(6000).set("p",3049);this.prices.get(476).set(7000,new Hash());this.prices.get(476).get(7000).set("i",2881);this.prices.get(476).get(7000).set("p",3549);this.prices.get(476).set(8000,new Hash());this.prices.get(476).get(8000).set("i",2882);this.prices.get(476).get(8000).set("p",3989);this.prices.get(476).set(9000,new Hash());this.prices.get(476).get(9000).set("i",2883);this.prices.get(476).get(9000).set("p",4489);this.prices.get(476).set(10000,new Hash());this.prices.get(476).get(10000).set("i",2884);this.prices.get(476).get(10000).set("p",4899);this.prices.get(476).set(15000,new Hash());this.prices.get(476).get(15000).set("i",2885);this.prices.get(476).get(15000).set("p",7225);this.prices.get(476).set(20000,new Hash());this.prices.get(476).get(20000).set("i",2886);this.prices.get(476).get(20000).set("p",9465);this.prices.get(476).set(25000,new Hash());this.prices.get(476).get(25000).set("i",2887);this.prices.get(476).get(25000).set("p",11829);},init:function(){if($("myForm")){this.order_action=$("myForm").action;$("myForm").addEvent("submit",function(a){if(EC_LithoCalc.flag_form){new Event(a).stop();}});}this.setLocalVars();this.setOpts();this.setSkus();this.setWeights();this.setPrices();this.setFoldingOpts();this.setAdditionalOpts();if(window.EC_Mailing){EC_Mailing.init();}this.updateForm();},setLocalVars:function(){this.localText=[];this.localText.titleText="Pricing Calculator";this.localText.headingText="Select A Product";this.localText.priceText="Printing Total";this.localText.productText="Product";this.localText.sizeText="Size";this.localText.trimSizeText="Custom Trim Size (Not Required)";this.localText.widthText="Width";this.localText.heightText="Height";this.localText.paperText="Paper";this.localText.colorText="Color";this.localText.coatingText="Coating";this.localText.pageText="Pages";this.localText.turnaroundText="Turnaround";this.localText.foldingText="Folding";this.localText.quantityText="Quantity";this.localText.orderText="Place Order";this.localText.estimateText="Print Estimate";this.localText.chooseText="Choose Here...";this.localText.shippingText="Estimate Shipping";this.localText.zipcodeText="Zip / Postal Code";this.localText.countrycodeText="Country";this.localText.ratesText="Get Rates";this.localText.shipmethodText="Ship Method";this.localText.shiprateText="Shipping Rate";this.localText.shiptimeText="Shipping Time";this.localText.pleaseclickText="<p>Please Click &quot;Get Rates&quot;</p>";this.localText.ziperrorText="Please Enter A 5 Digit Zip Code.";this.localText.pleasewaitText="Please Wait";this.localText.custom_perforationText="Perforation";this.names=[];this.titles=[];this.names=["product","size","paper","color","coating","turnaround"];this.titles=[this.localText.productText,this.localText.sizeText,this.localText.paperText,this.localText.colorText,this.localText.coatingText,this.localText.turnaroundText];shipOpts=new Hash({"03":"UPS Ground","12":"UPS 3 Day Select","02":"UPS 2nd Day","01":"UPS Next Day",WC:"Will Call",FR:"Freight",DL:"Delivery",RO:"Recycle Overages"});},createForm:function(a){this.formContents='<h3 class="formTitle">'+this.localText.titleText+"</h3>";this.formContents+="<table>";this.formContents+=calcFI_TPL("",'<h4 class="formHeading">'+this.localText.headingText+"</h4>","");this.formContents+=a;this.formContents+="</table>";this.formContents+='<input type="hidden" name="price_id" value="" />';this.formContents+='<input type="hidden" name="quote" value="" />';this.formContents+='<input type="hidden" id="totals" name="totals" value="" />';$("myForm").setHTML(this.formContents);if(window.datePickerController){datePickerController.create();}},createSelect:function(h,d,f,g,b){if(window.EC_Mailing&&d=="quantity"){f="EC_Mailing.setQuantity();"+f;}var a='<select id="'+d+'" name="'+d+'" onchange="'+f+'">';if(d=="quantity"){a+=this.createQuantityOptions(g);}else{if(d=="folding"&&this.folding==true){a+=this.createFoldingOptions(g);}else{if(b){a+=this.createOptions(g,true);}else{a+=this.createOptions(g);}}}a+="</select>";var e="";var c="";if(this.green==true&&d=="paper"){c=calcFI_TPL("","","","greenBadgeTD");}return c+calcFI_TPL(h,a,d,e);},createSizeInput:function(f,c,d){var e=(c=="width")?this.widthText:this.heightText;var b=[];if($(c+"Fract")){b[$(c+"Fract").selectedIndex]=" selected";}var a="";return calcFI_TPL(f,a,c);},createTrimSizeInput:function(e,b,c){var d=this.opts.size[this.sizeID];if($(b)){d=$(b).getValue();}var a='<input type="text" id="'+b+'" name="'+b+'" value="'+d+'" onblur="'+c+'" class="textInput" />';return calcFI_TPL(e,a,b);},createOptions:function(e,g){var j,f,h;var k=[];var l="";var c="";var d="";k=e.keys();h=k.length;for(f=0;f<h;f++){j=k[f];if(!isNaN(j)){d=($(this.currentName)&&j==$(this.currentName).getValue())?" selected":"";if(this.currentName=="size"&&f==0){this.sizeID=j;}if(!g){}var b=(g)?this.additionalOpts.get(this.currentName).get(j).get("name"):this.opts[this.currentName][j];l+='<option value="'+j+'"'+d+">"+b+"</option>";}}return l;},createQuantityOptions:function(e){var b;var c="";var f="";var d="";if(e.length>0){e.each(function(g){if(!isNaN(g)){d=($("quantity")&&g==$("quantity").getValue())?" selected":"";c+='<option value="'+g+'"'+d+">"+g+"</option>";}});}return c;},createFoldingOptions:function(e){var a="";var b="";var c=false;if($("paper")){var d=$("paper").options[$("paper").selectedIndex].text;if(d.indexOf("Cover")!=-1){c=true;}}e.each(function(g,f){($("folding")&&f==$("folding").getValue())?b=" selected":b="";if(c){if(g.get("name").indexOf("Cover")!=-1||g.get("name").indexOf("None")!=-1){a+='<option value="'+f+'"'+b+">"+g.get("name")+"</option>";}}else{if(g.get("name").indexOf("Cover")==-1){a+='<option value="'+f+'"'+b+">"+g.get("name")+"</option>";}}});return a;},updateForm:function(){var e=0;var c;var g;this.formContents="";this.currentSku=this.skus;var b=false;for(var e=0;e<this.names.length;e++){this.currentName=this.names[e];this.currentTitle=this.titles[e];if(this.currentName=="width"||this.currentName=="height"){this.formContents+=this.createSizeInput(this.currentTitle,this.currentName,"EC_LithoCalc.updateForm()");if(this.currentName=="width"){continue;}}else{g=(this.currentName=="size")?"EC_LithoCalc.resetTrimSize();":"";this.formContents+=this.createSelect(this.currentTitle,this.currentName,g+"EC_LithoCalc.updateForm()",this.currentSku);if(this.currentName=="size"){this.formContents+=this.createTrimSizeInput(this.localText.trimSizeText,"trim_size","EC_LithoCalc.updateTrimSize()");}}var d=0;var h="";this.currentSku.each(function(i,a){d++;if(d==1){h=a;}});if(this.currentName=="height"){var f=this.currentSku.keys();f.sort(EC_Base.sortNumber);f.reverse();f.each(function(a){if(EC_LithoCalc.area<=a){h=a.toString();EC_LithoCalc.selectedArea=a;}});}if($(this.currentName)&&this.currentSku.hasKey($(this.currentName).getValue())){this.currentSku=this.currentSku.get($(this.currentName).getValue());}else{if(this.currentSku.hasKey(h)){this.currentSku=this.currentSku.get(h);}else{break;}}}if(this.currentSku>0){this.setupQuantities();}else{this.createForm(this.formContents);}},updateArea:function(){if($("width")&&$("height")){this.widthText=Math.floor(Number($("width").getValue())).toString();this.heightText=Math.floor(Number($("height").getValue())).toString();if(this.widthText=="NaN"){this.widthText=0;}if(this.heightText=="NaN"){this.heightText=0;}var a=Math.floor(Number($("width").getValue()))+Number($("widthFract").getValue());var b=Math.floor(Number($("height").getValue()))+Number($("heightFract").getValue());if(isNaN(a)){a=$("width").value=0;$("widthFract").selectedIndex=0;}if(isNaN(b)){b=$("height").value=0;$("heightFract").selectedIndex=0;}if(a<this.opts.min_width&&a>0){alert("The minimum width is "+this.opts.min_width);return;}if(b<this.opts.min_height&&b>0){alert("The minimum height is "+this.opts.min_height);return;}if(a>this.opts.max_width){alert("The maximum width is "+this.opts.max_width);return;}if(b>this.opts.max_height){alert("The maximum height is "+this.opts.max_height);return;}this.area=a*b;}},updateTrimSize:function(){if($("trim_size")){var e=$("trim_size").getValue();e=e.replace(/([^0-9. Xx])/g,"");var d=$("size").options[$("size").selectedIndex].text;d=d.replace(/([^0-9. Xx])/g,"");var a=Number(e.replace(/(\d[.]*\d{0,4})([ Xx]+)(\d[.]*\d{0,4})(.*)/,"$1"));var c=Number(e.replace(/(\d[.]*\d{0,4})([ Xx]+)(\d[.]*\d{0,4})(.*)/,"$3"));var f=Number(d.replace(/(\d[.]*\d{0,4})([ Xx]+)(\d[.]*\d{0,4})(.*)/,"$1"));var b=Number(d.replace(/(\d[.]*\d{0,4})([ Xx]+)(\d[.]*\d{0,4})(.*)/,"$3"));a=(a>f)?f:a;c=(c>b)?b:c;$("trim_size").value=a+" X "+c;}},resetTrimSize:function(){if($("trim_size")){$("trim_size").value=$("size").options[$("size").selectedIndex].text;}},setupQuantities:function(){var a=0;var c=0;if(this.folding){this.formContents+=this.createSelect(this.localText.foldingText,"folding","EC_LithoCalc.updatePrice()",this.foldingOpts);}if(this.additional){this.additionalOpts.each(function(g,f){EC_LithoCalc.currentName=f;EC_LithoCalc.formContents+=EC_LithoCalc.createSelect(EC_LithoCalc.localText[f+"Text"],f,"EC_LithoCalc.updatePrice()",g,true);});}var e=this.prices.get(this.currentSku).keys();e.sort(this.numOrdA);this.formContents+=this.createSelect(this.localText.quantityText,"quantity","EC_LithoCalc.updatePrice()",e);if($("quantity")){var d=$("quantity").getValue();if(this.prices.get(this.currentSku).hasKey(d)){c=this.prices.get(this.currentSku).get(d).get("p");}}else{var b=this.prices.get(this.currentSku).keys();c=this.prices.get(this.currentSku).get(b[0]).get("p");}if(window.EC_Mailing){this.formContents+=EC_Mailing.updateForm();}else{this.formContents+=calcHR_TPL();}this.formContents+=calcTotalFI_TPL(this.localText.priceText,'<div id="printRate" class="price">'+EC_Base.moneyFormat(c)+"</div>","");if(window.EC_Mailing){this.formContents+=EC_Mailing.totalsForm();}else{this.formContents+=calcHR_TPL();}this.formContents+=calcFI_TPL("",calcBTN_TPL(this.localText.orderText,"EC_LithoCalc.placeOrder()"),"");this.formContents+=calcFI_TPL("",calcBTN_TPL(this.localText.estimateText,"EC_LithoCalc.printEstimate()"),"");if(!window.EC_Mailing){this.formContents+=this.setupShipping();}else{this.formContents+=postageWarning();}this.createForm(this.formContents);this.updatePrice();},updateFolding:function(){var d=$("myForm");var c=$("folding").getValue();if(c==undefined){var f=this.foldingOpts.keys();c=f[0];}var b=this.foldingOpts.get(c).get("price");var a=this.foldingOpts.get(c).get("setup");var e=($("quantity").options)?$("quantity").options[$("quantity").selectedIndex].text:$("quantity").getValue();var g=parseInt(e)/1000;this.foldRate=(Number(b)*g)+Number(a);},updatePrice:function(){this.foldRate=0;if($("folding")&&this.folding==true){this.updateFolding();}if($("quantity")){this.currentSku=this.skus;for(var c=0;c<this.names.length;c++){this.currentName=this.names[c];if($(this.currentName)&&this.currentName!="width"&&this.currentName!="height"){this.currentSku=this.currentSku.get($(this.currentName).value);}if($(this.currentName)&&this.currentName=="height"){this.currentSku=this.skus.get($("product").value).get(this.selectedArea);}}var a=this.prices.get(this.currentSku).get($("quantity").value).get("p");if(this.additional){this.additionalOpts.each(function(h,f){if($(f)){var g=Number(EC_LithoCalc.additionalOpts.get(f).get($(f).value).get("price"));var e=Number(EC_LithoCalc.additionalOpts.get(f).get($(f).value).get("setup"));a+=g*($("quantity").value/1000)+e;}});}this.printRate=a+this.foldRate;$("printRate").setHTML(EC_Base.moneyFormat(this.printRate));if(window.EC_Mailing){EC_Mailing.updatePrice();}if($("zipcode")){var d=$("zipcode").getValue();if(d.length==5){this.getShipRates();}}var b={print:this.printRate,folding:this.foldRate,shipping:this.shipRates};if(window.EC_Mailing){b.setup=Number($("setupRate").getText().replace(/([^0-9.])/,""));b.inkjet=Number($("inkjetRate").getText().replace(/([^0-9.])/,""));b.tabbing=Number($("tabbingRate").getText().replace(/([^0-9.])/,""));b.postage=Number($("postageRate").getText().replace(/([^0-9.])/,""));if($("listRate")){b.list=Number($("listRate").getText().replace(/([^0-9.])/,""));}b.total=Number($("totalRate").getText().replace(/([^0-9.])/,""));}if($("totals")){$("totals").value=Json.toString(b);}else{EC_LithoSku.updatePrice.delay(100);}}},printEstimate:function(){if(this.order_action==""){alert("This feature is not available right now. Please try again later.");return;}$("myForm").action=estimateURL;$("myForm").target="estimatepopup";estimatePopup($("myForm").target);setTimeout(function(){$("myForm").submit();},100);},placeOrder:function(){$("myForm").target="_self";if(this.order_action!=""){$("myForm").action=this.order_action;}if(this.currentSku!=null){var a=this.prices.get(this.currentSku).get($("quantity").getValue()).get("i");}else{var c=this.prices.keys();var a=this.prices.get(c[0]).get($("quantity").getValue()).get("i");}var b=$("myForm");b.price_id.value=a;this.flag_form=false;b.submit();},addSKU:function(f,g){var d;var e;var c;var b=f.length;f.each(function(h,a){if(a>0){c=c.get(f[a-1]);}else{c=EC_LithoCalc.skus;}if(!c.hasKey(h)){c.set(h,new Hash());}if(a==b-1){c.set(h,g);}});},setupShipping:function(){var a=calcHR_TPL();a+=calcFI_TPL("",'<h4 class="formHeading">'+this.localText.shippingText+"</h4>","");if(this.international==1){a+=calcFI_TPL(this.localText.countrycodeText,this.country_code,"");}else{a+=this.country_code;}a+=calcFI_TPL(this.localText.zipcodeText,'<input type="text" class="zipTI" id="zipcode" name="zipcode" onkeyup="EC_LithoCalc.checkEnter(event, \'EC_LithoCalc.getShipRates()\')" /><input id="getRatesBTN" type="button" class="rateBTN" value="'+this.localText.ratesText+'" onclick="EC_LithoCalc.getShipRates()" />',"");a+=calcShipGrid_TPL("<br />");return a;},shipSelect:function(){},getShipRates:function(){if(!this.currentSku){this.updateForm();}var b=$("getRatesBTN");var c=$("zipcode").getValue();if(b.disabled){return;}var e=$("country_code").getValue();if((c.length!=5||isNaN(c))&&e=="US"){alert(this.localText.ziperrorText);return;}b.value=this.localText.pleasewaitText;b.disabled=true;this.timer=setTimeout("EC_LithoCalc.stopRates()",10000);this.selWeight=Math.ceil((Number($("quantity").getValue())/1000)*this.weights[this.currentSku]);var a="/ws/shipping/getRates/zip/"+c+"/country/"+e+"/weight/"+this.selWeight+"/handling_fee/"+this.handling_fee;var d=new Ajax(a,{method:"get",onSuccess:function(g){EC_LithoCalc.shipRates=Json.evaluate(g);EC_LithoCalc.stopRates();EC_LithoCalc.changeShipRates();if(EC_LithoCalc.shipRates.error){alert(EC_LithoCalc.shipRates.error);}if($("totals")){var f=Json.evaluate($("totals").getValue());f.shipping=EC_LithoCalc.shipRates;$("totals").value=Json.toString(f);}}}).request();},stopRates:function(){var a=$("getRatesBTN");a.value=this.localText.ratesText;a.disabled=false;clearTimeout(this.timer);},changeShipRates:function(){var a=" checked";$$("input[name=shipMethod]").each(function(b){if(b.checked!=false){a=b.value.toString();}});$("shipGrid").setHTML("<br />"+this.shipGrid(a));},shipGrid:function(e){var b='<table width="100%">';var c="";var d=$("country_code").getValue();var a=false;if($("delivery")&&$("delivery_zipcode")&&$("delivery_countrycode")){if($("delivery").getValue()==1&&($("delivery_zipcode").getValue()==$("zipcode").getValue()||$("delivery_zipcode").getValue()=="ANY")&&d==$("delivery_countrycode").getValue()){a=true;}}shipOpts.each(function(h,f){if(!h.match(/Recycle/)){var g=EC_LithoCalc.shipRates[f.toString()];if(e==f.toString()){e=" checked";}if(g!==false&&!isNaN(g)){g=EC_Base.moneyFormat(g);}if(g!==false){if(f!="DL"||(f=="DL"&&a==true)){b+='<tr><td class="ship_desc"><input type="radio" name="shipMethod" value="'+f.toString()+'"'+e+" />";b+=h+'</td><td class="ship_price">'+g+"</td></tr>";}if(e==" checked"){e="";}}}});b+="</table>";return b;},checkEnter:function(event,func){event=new Event(event);if(event.key=="enter"){if(func){eval(func);}event.stop();this.flag_form=true;}},numOrdA:function(d,c){return(d-c);},numOrdD:function(d,c){return(c-d);},debug:function(c,b){var a="";if(b){a=EC_Base.dumpObj(c,true);}else{a=c;}$("calcDebug").setHTML(a+"<br />=======================================<br /><br />");}};window.addEvent("domready",function(){EC_LithoCalc.init();});
