var Hcost = 0;
var Httl = 0;
var Ecost = 0;
var Ettl = 0;
var Mcost = 0;
var Mttl = 0;
var negEach = 0;
var size1=0;
var size2=0;
var size3=0;
var size4=0;
var size5=0;
var size6=0;
var size7=0;
var size8=0;
var size9=0;
var size10 = 0;
var allsize=0;
var cleanupI = 0;
var cleanthis = 0;
var E351K=0;
var E352K=0;
var boxsize1=0;
var boxsize2=0;
var boxsize3=0;
var boxsize4=0;
var boxsize5=0;
var boxsize6=0;
var boxsize7=0;
var boxsize8=0;
var boxsize9=0;
var boxsize10=0;
var ptest=0;
var Echeck = 0;
var yes1="";
var yes2="";
var yes3="";
var yes4="";
var yes5="";
var yes6="";
var yes7="";
var yes8="";
var yes9="";
var yes10="";
var shipping = 15.00;
var charge = 0;
function currency(anynum,width){
   anynum=eval(anynum)
   workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum
   if (workStr.indexOf(".")==-1){workStr+=".00"}
   dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0
   pStr=workStr.substr(workStr.indexOf("."))
   while (pStr.length<3){pStr+="0"}
   if (dNum>=1000) {
      dLen=dStr.length
      dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
     }
   if (dNum>=1000000){
      dLen=dStr.length
      dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen)
     }
   retval=dStr+pStr
   if (anynum < 0){
      retval=retval.substring(1,retval.length)
      retval="("+retval+")"
     }
   retval = "$"+retval
   while (retval.length<width){retval=" "+retval}
   return retval
  }
function modify(form){
  form.Eco1des.value = ""
  form.Eco2des.value = ""
  form.EcoPrintdes.value = ""
  form.EcoPrintdes2.value = ""
  form.EcoPrintdes3.value = ""
  form.extrasets.value = 0
  document.getElementById('nodust').checked=false;
  document.getElementById('nodust').style.display = "none";
  document.getElementById('spot').style.display = "none";
  document.getElementById('add4xglossy').style.display = "none";
  document.getElementById('ecooptions').style.display = "none";
  document.getElementById('minwarn').innerHTML = "";
  document.getElementById('optable').style.display = "none";
  document.getElementById('E1Kbox').checked=false;
  document.getElementById('E2Kbox').checked=false;
  document.getElementById('Check10').checked=false;
  document.getElementById('Check11').checked=false;
  document.getElementById('Check12').checked=false;
  document.getElementById('nodust').checked=false;
  document.getElementById('nodust').style.display = "none";
  document.getElementById('spot').style.display = "none";
  document.getElementById('Deach').innerHTML = 0  ;
  document.getElementById('Dtotal').innerHTML = 0  ;
  var i = 1;
   for (i=1;i<10;i++){
   document.getElementById('Desc'+i).innerHTML = "";
   document.getElementById('Check'+i).checked=false;
   document.getElementById('Check'+i).style.display = "none";
   }
  yes1="";
  yes2="";
  yes3="";
  yes4="";
  yes5="";
  yes6="";
  yes7="";
  yes8="";
  yes9="";
  document.getElementById('prices1').style.display = "none";
  cleanthis=0;
  Ecost = 0;
  Ettl = 0;
  if (form.originaltype.value == "O35mm"){dislist(0);}
  if (form.originaltype.value == "Omed67"){dislist(1);}
  if (form.originaltype.value == "Olarge"){dislist(2);}
  if (form.originaltype.value == "OPrint"){dislist(3);}
  if (form.originaltype.value == "NONE"){dislist(4);}
  multiply(form)
  Options(form)
  }
function dislist(i){
  document.sform.scansize.options.length=0;
  switch(i){
    case 0:
    document.sform.scansize.options[0] =new Option('Select one','NONE','selected');
    document.sform.scansize.options[1] =new Option('REFERENCE SCAN','35Eco');
    document.sform.scansize.options[2] =new Option('WORK SCAN','film135N');
    document.sform.scansize.options[3] =new Option('PRO SCAN','film135I');
    document.sform.scansize.options[4] =new Option('PRO SCAN from X-Pan (24x65mm frame size)','film135X');
    break;
    case 1:
    document.sform.scansize.options[0] =new Option('Select one','NONE','selected');
    document.sform.scansize.options[1] =new Option('REFERENCE SCAN (medium format up to 6x7 cm film)','MedEco');
    document.sform.scansize.options[2] =new Option('PRO SCAN from 6 x 4.5 cm','film645I');
    document.sform.scansize.options[3] =new Option('PRO SCAN from 6 x 6 cm ','film66I');
    document.sform.scansize.options[4] =new Option('PRO SCAN from 6 x 7 cm ','film67I');
    document.sform.scansize.options[5] =new Option('PRO SCAN from 6 x 8 cm ','film68I');
    document.sform.scansize.options[6] =new Option('PRO SCAN from 6 x 9 cm ','film69I');
    break;
    case 2:
    document.sform.scansize.options[0] =new Option('Select one','NONE','selected');
    document.sform.scansize.options[1] =new Option('PRO SCAN from 6 x 17 cm panoramic','film617I');
    document.sform.scansize.options[2] =new Option('PRO SCAN from 4 x 5 inch sheet film','film4x5I');
    document.sform.scansize.options[3] =new Option('FLAT SCAN from 8x10 inch sheet film','8Xfilm');
    document.sform.scansize.options[4] =new Option('FLAT SCAN from X-Ray or MRI','filmXray');
    break;
    case 3:
    document.sform.scansize.options[0] =new Option('Select one','NONE','selected');
    document.sform.scansize.options[1] =new Option('FLAT SCAN from Prints up to 11 x 14 inches','printscan');
    break;
    case 4:
    document.sform.scansize.options[0] =new Option('Select Type of Original First','NONE','selected');
    break;
    }
  }
function setlist(form){
  var i = 1;
  for (i=1;i<10;i++){
    document.getElementById('Desc'+i).innerHTML = "";
    document.getElementById('Check'+i).checked=false;
    document.getElementById('Check'+i).style.display = "none";
    }
  document.getElementById('E1Kbox').checked=false;
  document.getElementById('E2Kbox').checked=false;
  document.getElementById('nodust').checked=false;
  document.getElementById('minwarn').style.display = "none";
  document.getElementById('nodust').style.display = "none";
  document.getElementById('spot').style.display = "none";
  document.getElementById('Deach').innerHTML = 0  ;
  document.getElementById('Dtotal').innerHTML = 0  ;
  document.getElementById('Check10').checked=false;
  document.getElementById('Check11').checked=false;
  document.getElementById('Check12').checked=false;
  document.getElementById('customscan').checked=false;
  document.getElementById('custinst').style.display = "none";
  document.getElementById('prices1').style.display = "none";
  form.custominfo.value = "";
  form.sets4x6.value = 1;
  form.sets5x7.value = 1;
  form.sets8x10.value = 1;
  size1=0;
  size2=0;
  size3=0;
  size4=0;
  size5=0;
  size6=0;
  size7=0;
  size8=0;
  size9=0;
  yes1="";
  yes2="";
  yes3="";
  yes4="";
  yes5="";
  yes6="";
  yes7="";
  yes8="";
  yes9="";
  cleanthis=0;
  Ecost = 0;
  Ettl = 0;
  Echeck = 0;
  charge = 0;
  Options(form)
  multiply(form)
  }
function multiply(form){
  scanchoice=form.scansize.selectedIndex;
  var PRE = "<span  class='prelabel'>"
    if (form.scansize.options[scanchoice].value=="35Eco"){
      form.Sclass.value = "Reference Scans - 35mm"
      form.scansource.value = "35mm Slides or Film Strips"
      animatedcollapse.hide('optable')
      animatedcollapse.show('ecooptions')
      document.getElementById('E1label').innerHTML = PRE + "1000ppi JPEG scans from 35mm film</span> <span class ='details'>$.49 each</span>";
      document.getElementById('E2label').innerHTML = PRE + "2000ppi JPEG scans from 35mm film</span> <span class ='details'>$.89 each</span>";
      size1=.06;
      size2=.15;
      e35(form);
      }
    if (form.scansize.options[scanchoice].value=="MedEco"){
      form.Sclass.value = "Reference Scans - Medium Format"
      form.scansource.value = "Medium Format Film"
      animatedcollapse.hide('optable')
      animatedcollapse.show('ecooptions')
      document.getElementById('E1label').innerHTML = PRE + "1000ppi JPEG scans from medium format film</span> <span class ='details'>$.98 each</span>";
      document.getElementById('E2label').innerHTML = PRE + "2000ppi JPEG scans from medium format film</span> <span class ='details'>$1.78 each</span>";
      size1=.10;
      size2=.25;
      eMed(form);
      }
    SC35I =["film135I"," 8000ppi 16-bit - single frame, unmounted film ~10700 x 7400 pixels"," 8000ppi 8-bit - single frame, unmounted film ~10700 x 7400 pixels"," 6300ppi 16-bit - single frame, unmounted film ~8400 x 5800 pixels"," 6300ppi 8-bit - single frame, unmounted film ~8400 x 5800 pixels"," 5000ppi 16-bit - mounted slides or strips of 6 or less ~6600 x 4700 pixels"," 5000ppi 8-bit (~90mb) from mounted slides or strips of 6 or less"," JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG - resampled to 500 pixels in the long dimension"];
    SC35X =["film135X"," 6300ppi 16-bit - single frame, unmounted film ~16000 x 5800 pixels"," 6300ppi 8-bit single frame, unmounted film ~16000 x 5800 pixels","  3000ppi 16-bit single frame, unmounted film ~7600 x 2800 pixels"," 3000ppi 8-bit single frame, unmounted film ~7600 x 2800 pixels"," 6300ppi 8-bit saved as JPEG","3000ppi 8-bit saved as JPEG"," JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG - resampled to 500 pixels in the long dimension"];
    SC64I =["film645I"," 3200ppi 16-bit - single frame, unmounted film ~7100 x 5200 pixels"," 3200ppi 8-bit single frame, unmounted film ~7100 x 5200 pixels","3200ppi 8-bit JPEG format scan","JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC66I =["film66I"," 3200ppi 16-bit - single frame, unmounted film ~7100 x 7100 pixels"," 3200ppi 8-bit single frame, unmounted film ~7100 x 7100 pixels"," 3200ppi 8-bit JPEG format scan","JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC67I =["film67I"," 3200ppi 16-bit - single frame, unmounted film ~7100 x 8600 pixels"," 3200ppi 8-bit single frame, unmounted film ~7100 x 8600 pixels"," 3200ppi 8-bit JPEG format scan","JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC68I =["film68I"," 3200ppi 16-bit - single frame, unmounted film ~7100 x 9700 pixels"," 3200ppi 8-bit single frame, unmounted film ~7100 x 9700 pixels"," 3200ppi 8-bit JPEG format scan"," JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC69I =["film69I"," 3200ppi 16-bit - single frame, unmounted film ~7100 x 11200 pixels"," 3200ppi 8-bit single frame, unmounted film ~7100 x 11200 pixels"," 3200ppi 8-bit JPEG format scan"," JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC61I =["film617I"," 3200ppi 16-bit - single frame, unmounted film ~7100 x 21400 pixels"," 3200ppi 8-bit single frame, unmounted film ~7100 x 21400 pixels"," 3200ppi 8-bit JPEG format scan"," JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC45I =["film4x5I"," 2040ppi 16-bit ~7400 x 9400 pixels TIFF format"," 2040ppi 8-bit ~7400 x 9400 pixels TIFF format"," 2040ppi 8-bit ~7400 x 9400 pixels JPEG format"," 1200ppi 16-bit ~5500 x 4400 pixels TIFF format"," 1200ppi 8-bit ~5500 x 4400 pixels TIFF format"," 1200ppi 8-bit ~5500 x 4400 pixels JPEG format"," JPEG - resampled to 2000 pixels in the long dimension"," JPEG - resampled to 1000 pixels in the long dimension"," JPEG resampled to 500 pixels in the long dimension"];
    SC81M =["8Xfilm"," 600ppi 8-bit TIFF format ~6000 x 4800 pixels"," 300ppi 8-bit TIFF format ~2400 x 3000 pixels"," 600ppi 8-bit JPEG format ~6000 x 4800 pixels"," 300ppi 8-bit JPEG format ~2400 x 3000 pixels"];
    SCPRI =["printscan"," TIFF - 40mb scan, color corrected, dust removal"," TIFF - 14mb scan, color corrected, dust removal"," JPEG - 8mb scan, color corrected, dust removal"," JPEG - 4mb scan, color corrected, dust removal"," JPEG - sized to 1024 x 768 pixels for screen display"," JPEG - 980 x 720 pixels, optimized for PowerPoint"," JPEG - 640 x 480 pixels under 50kb for email"];
    SCXRA =["filmXray"," TIFF - 150dpi (13mb) scan"," JPEG - 150dpi (13mb) scan"," JPEG - sized to 1024 x 768 pixels for screen display"," JPEG - 980 x 720 pixels, optimized for PowerPoint"," JPEG - 640 x 480 pixels under 50kb for email"];
    SC35N =["film135N"," TIFF - 4000ppi - mounted slides or film strips ~5300 x 3500 pixels"," TIFF - 2000ppi - mounted slides or film strips ~2600 x 1700 pixels"," JPEG - 4000ppi  - mounted slides or film strips ~5300 x 3500 pixels"," JPEG - 2000ppi mounted slides or film strips ~2600 x 1700 pixels"," JPEG - sized to 1024 x 768 pixels for screen display"," JPEG - 980 x 720 pixels, optimized for PowerPoint"," JPEG - 640 x 480 pixels under 50kb for email"];
    SI35I =["film135I",450,225,280,140,180,90,6,1.5,.5];
    SI35X =["film135X",560,280,130,65,56,28,6,1.5,.5];
    SI64I =["film645I",220,110,27,6,1.5,.5];
    SI66I =["film66I",295,148,30,6,1.5,.5];
    SI67I =["film67I",360,180,36,6,1.5,.5];
    SI68I =["film68I",410,205,40,6,1.5,.5];
    SI69I =["film69I",470,235,60,6,1.5,.5];
    SI61I =["film617I",890,445,80,6,1.5,.5];
    SI45I =["film4x5I",410,205,140,70,50,20,6,1.5,.5];
    SI81M =["8Xfilm",87,22,15,8];
    SIPRI =["printscan",40,14,8,3,1,.5,.05];
    SIXRA =["filmXray",13,3,1,.5,.05];
    SI35N =["film135N",55,14,12,5,1,.5,.05];
    YE35I =["film135I","8000ppi 16-bit TIFF format","8000ppi 8-bit TIFF format","6300ppi 16-bit TIFF format","6300ppi 8-bit TIFF format","5000ppi 16-bit TIFF format","5000ppi 8-bit TIFF format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG - 500 pixel long dimension"];
    YE35X =["film135X","6300ppi 16-bit TIFF format","6300ppi 8-bit TIFF format","3000ppi 16-bit TIFF format","3000ppi 8-bit TIFF format","6300ppi 8-bit JPEG","3000ppi 8-bit JPEG","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG - 500 pixel long dimension"];
    YE64I =["film645I","3200ppi 16-bit TIFF format","3200ppi 8-bit TIFF format","3200ppi 8-bit JPEG format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG 500 pixel long dimension"];
    YE66I =["film66I","3200ppi 16-bit TIFF format","3200ppi 8-bit TIFF format","3200ppi 8-bit JPEG format","JPEG - 2000 pixel dimension","JPEG - 1000 pixel long dimension","JPEG 500 pixel long dimension"];
    YE67I =["film67I","3200ppi 16-bit TIFF format","3200ppi 8-bit TIFF format","3200ppi 8-bit JPEG format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG 500 pixel long dimension"];
    YE68I =["film68I","3200ppi 16-bit TIFF format","3200ppi 8-bit TIFF format","3200ppi 8-bit JPEG format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG 500 pixel long dimension"];
    YE69I =["film69I","3200ppi 16-bit TIFF format","3200ppi 8-bit TIFF format","3200ppi 8-bit JPEG format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG - 500 pixel long dimension"];
    YE61I =["film617I","3200ppi 16-bit TIFF format","3200ppi 8-bit TIFF format","3200ppi 8-bit JPEG format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG 500 pixel long dimension"];
    YE45I =["film4x5I","2040ppi 16-bit  TIFF format","2040ppi 8-bit  TIFF format","2040ppi 8-bit JPEG format","1200ppi 16-bit TIFF format","1200ppi 8-bit TIFF format","2040ppi 8-bit JPEG format","1200ppi 8-bit JPEG format","JPEG - 2000 pixel long dimension","JPEG - 1000 pixel long dimension","JPEG 500 pixel long dimension"];
    YE81M =["8Xfilm","600ppi 8-bit  TIFF format","300ppi 8-bit  TIFF format","600ppi 8-bit JPEG format","300ppi 8-bit JPEG format"];
    YEPRI =["printscan","TIFF - 40mb scan","TIFF - 14mb scan","JPEG - 8mb scan","JPEG - 4mb scan","JPEG - 1024 x 768 for screen display","JPEG - 980 x 720 for PowerPoint","JPEG - 640 x 480 under 50kb for email"];
    YEXRA =["filmXray","TIFF - 150dpi (13mb) scan","JPEG - 150dpi (13mb) scan","JPEG - sized to 1024 x 768 pixels","JPEG - 980 x 720 for PowerPoint","JPEG - 640 x 480 under 50kb for email"];
    YE35N =["film135N","4000ppi TIFF format","2000ppi TIFF format","4000ppi JPEG format","2000ppi JPEG format","1024 x 768 pixel JPEG format","PowerPoint optimized JPEG format","640 x 480 JPEG format for email"];
    MI35I =["film135I","Pro Scans","35mm Film","","",10.50,12.50]
    MI35X =["film135X","Pro Scans","35mm Film","","",12.50,12.50]
    MI64X =["film645I","Pro Scans","6x4.5 cm Film","","",12.50,10];
    MI66I =["film66I","Pro Scans","6 x 6 cm Film","","",12.50,10];
    MI67I =["film67I","Pro Scans","6 x 7 cm Film","","",12.50,10];
    MI68I =["film68I","Pro Scans","6 x 8 cm Film","","",12.50,12];
    MI69I =["film69I","Pro Scans","6 x 9 cm Film","","",12.50,12];
    MI61I =["film617I","Pro Scans","6 x 17 cm Film","","",17.50,15.00];
    MI45I =["film4x5I","Pro Scans","4 x 5 Inch Sheet Film","","",15,15];
    MI81M =["8Xfilm","Flat Scans","8 x 10 Inch Sheet Film","","",10,25];
    MIPRI =["printscan","Flat Scans","Prints (up to 11x14 inches)","none","none",0,0];
    MIXRA =["filmXray","Flat Scans","X-Ray Sheet Film","none","none",0,0];
    MI35N =["film135N","Work Scans","35mm Slides","none","none",0,0];
    SCRIP =["size descriptions",SC35I,SC35X,SC64I,SC66I,SC67I,SC68I,SC69I,SC61I,SC45I,SC81M,SCPRI,SCXRA,SC35N];
    SIZES =["scan sizes",SI35I,SI35X,SI64I,SI66I,SI67I,SI68I,SI69I,SI61I,SI45I,SI81M,SIPRI,SIXRA,SI35N];
    YESES =["form desctiptions",YE35I,YE35X,YE64I,YE66I,YE67I,YE68I,YE69I,YE61I,YE45I,YE81M,YEPRI,YEXRA,YE35N];
    MISC = ["Miscelaneous fields",MI35I,MI35X,MI64X,MI66I,MI67I,MI68I,MI69I,MI61I,MI45I,MI81M,MIPRI,MIXRA,MI35N];
    for (o=1;o<SCRIP.length;o++){
      if (form.scansize.options[scanchoice].value==SCRIP[o][0]){
        animatedcollapse.hide('optable')
        animatedcollapse.show('optable')
        var showboxes = (SCRIP[o].length - 1);
        var u=1;
        for (u=1;u<showboxes+1;u++){
          document.getElementById('Desc'+u).innerHTML = SCRIP[o][u];
          }
        size1=SIZES[o][1];
        size2=SIZES[o][2];
        size3=SIZES[o][3];
        size4=SIZES[o][4];
        size5=SIZES[o][5];
        size6=SIZES[o][6];
        size7=SIZES[o][7];
        size8=SIZES[o][8];
        size9=SIZES[o][9];
        yes1=YESES[o][1];
        yes2=YESES[o][2];
        yes3=YESES[o][3];
        yes4=YESES[o][4];
        yes5=YESES[o][5];
        yes6=YESES[o][6];
        yes7=YESES[o][7];
        yes8=YESES[o][8];
        yes9=YESES[o][9];
        form.Sclass.value = MISC[o][1];
        form.scansource.value = MISC[o][2];
        document.getElementById('nodust').style.display = MISC[o][3];
        document.getElementById('spot').style.display = MISC[o][4];
        cleanthis=MISC[o][5];
        Ecost = (MISC[o][6] + cleanupI) ;
        Ettl = (form.Eqty.value * Ecost) ;
        document.getElementById('prices1').style.display = "";
        if (form.scansize.options[scanchoice].value=="printscan"){
          Gmultiply(form)
          }
        if (form.scansize.options[scanchoice].value=="filmXray"){
          Xmultiply(form)
          }
        if (form.scansize.options[scanchoice].value=="film135N") {
          Amultiply(form)
          }
        Options(form)
        }
      }
    var i = 1;
    for (i=1;i<showboxes+1;i++){
      document.getElementById('Check'+i).style.display = "";
      }
  }
function GoEco(form){
  if (form.scansize.options[scanchoice].value=="35Eco"){
    e35(form)
    }
  if (form.scansize.options[scanchoice].value=="MedEco"){
    eMed(form)
    }
  Options(form)
  }
// 35mm Reference scnning calculation
function e35(form){
  E351K = 0;
  E352K = 0;
  Ecost = 0;
  Ettl = 0;
  extracharge = 0;
  boxsize1 = 0;
  boxsize2 = 0;
  E35Print = 0;
  form.allformats.value = "";
  form.Eco1des.value = "";
  form.E1each.value = "";
  form.E1tot.value = "";
  form.Eco2des.value = "";
  form.E2each.value = "";
  form.E2tot.value = "";
  form.EcoPrintdes.value = "";
  form.EcoPrintdes2.value = "";
  form.EcoPrintdes3.value = "";
  form.P4Each.value = "";
  form.P5Each.value = "";
  form.P8Each.value = "";
  form.EPTot.value = "";
  document.getElementById('adformattxt').style.display = "none";
  document.getElementById('formatcharge').style.display = "none";
  document.getElementById('minwarn').innerHTML = "";
  if (form.Eqty.value < 20){
    document.getElementById('minwarn').style.display = "";
    document.getElementById('minwarn').innerHTML = "There is a 20 scan minimum! You can order less, but the price will remain at the minimum.";
    }
  document.getElementById('351kcost').innerHTML = " "
  var MustPrint = 0
  if (form.E1Kbox.checked){
    MustPrint = 1;
    form.Eco1des.value = "Reference 1k JPEG scans";
    form.E1each.value = "$0.49 each";
    E351K = 9.8;
    boxsize1 = (size1 * form.Eqty.value);
    if (form.Eqty.value > 19){
      document.getElementById('minwarn').innerHTML = "";
      E351K = (form.Eqty.value * .49);
      }
    form.E1tot.value = currency(E351K);
    document.getElementById('351kcost').innerHTML = currency(E351K);
    }
  document.getElementById('352kcost').innerHTML = " "
  if (form.E2Kbox.checked){
    MustPrint = 1;
    form.Eco2des.value = "Reference 2k JPEG scans";
    form.E2each.value = "$0.89 each";
    E352K = 17.8;
    boxsize2 = (size2 * form.Eqty.value);
    if (form.Eqty.value > 19){
      document.getElementById('minwarn').innerHTML = "";
      E352K = (form.Eqty.value * .89);
      }
    form.E2tot.value = currency(E352K);
    document.getElementById('352kcost').innerHTML = currency(E352K);
    boxsize2=(size2 * form.Eqty.value);
    }
  Ettl = E351K + E352K ;
  Total(form)
  }
// Medium format Reference scanning
function eMed(form) {
  E351K = 0;
  E352K = 0;
  Ecost = 0;
  Ettl = 0;
  extracharge = 0;
  boxsize1 = 0;
  boxsize2 = 0;
  E35Print = 0;
  form.allformats.value = "";
  form.Eco1des.value = "";
  form.E1each.value = "";
  form.E1tot.value = "" ;
  form.Eco2des.value = "";
  form.E2each.value = "";
  form.E2tot.value = "" ;
  form.EcoPrintdes.value = "";
  form.EcoPrintdes2.value = "";
  form.EcoPrintdes3.value = "";
  form.P4Each.value = "";
  form.P5Each.value = "";
  form.P8Each.value = "";
  form.EPTot.value = "";
  document.getElementById('adformattxt').style.display = "none";
  document.getElementById('formatcharge').style.display = "none";
  if (form.Eqty.value < 10){
    document.getElementById('minwarn').style.display = "";
    document.getElementById('minwarn').innerHTML = "There is a 10 scan minimum! You can order less, but the price will remain at the minimum.";
    }
  document.getElementById('351kcost').innerHTML = " "
  var MustPrint = 0;
  if (form.E1Kbox.checked){
    MustPrint = 1;
    form.Eco1des.value = "Reference 1k JPEG scans";
    form.E1each.value = "$0.98 each";
    E351K = 8.90;
    boxsize1 = (size1 * form.Eqty.value);
    if (form.Eqty.value > 9){
      document.getElementById('minwarn').innerHTML = "";
      E351K = (form.Eqty.value * .98);
      }
    form.E1tot.value = currency(E351K);
    document.getElementById('351kcost').innerHTML = currency(E351K);
    }
  document.getElementById('352kcost').innerHTML = " "
  if (form.E2Kbox.checked){
    MustPrint = 1 ;
    form.Eco2des.value = "Reference 2k JPEG scans";
    form.E2each.value = "$1.78 each";
    E352K = 17.8;
    boxsize2 = (size2 * form.Eqty.value);
    if (form.Eqty.value > 9){
      document.getElementById('minwarn').innerHTML = "";
      E352K = (form.Eqty.value * 1.78);
      }
    boxsize2 = size2 * form.Eqty.value;
    form.E2tot.value = currency(E352K);
    document.getElementById('352kcost').innerHTML = currency(E352K);
    }
  Ettl = E351K + E352K ;
  Total(form)
  }
// 35mm Nikon scnning calculation:
function Amultiply(form){
  if (form.Eqty.value > 499){
    Ecost = (1.25);
    Ettl = (form.Eqty.value * 1.25);
    }
  if (form.Eqty.value < 500){
    Ecost = (Math.round((1.35-((form.Eqty.value - 300)*.0005))*100)/100);
    Ettl = (form.Eqty.value * (Math.round((1.35-((form.Eqty.value - 300)*.0005))*100)/100));
    }
  if (form.Eqty.value < 300){
    Ecost = (Math.round((1.45-((form.Eqty.value - 200)*.001))*100)/100);
    Ettl = (form.Eqty.value * (Math.round((1.45-((form.Eqty.value - 200)*.001))*100)/100));
    }
  if (form.Eqty.value < 200){
    Ecost = (Math.round((1.70-((form.Eqty.value - 100)*.0025))*100)/100);
    Ettl = (form.Eqty.value * (Math.round((1.70-((form.Eqty.value - 100)*.0025))*100)/100));
    }
  if (form.Eqty.value < 100){
    Ecost = (Math.round((2.45-((form.Eqty.value - 25)*.01))*100)/100);
    Ettl = (form.Eqty.value * (Math.round((2.45-((form.Eqty.value - 25)*.01))*100)/100));
    }
  if (form.Eqty.value < 25){
    Ecost = (Math.round((2.75-((form.Eqty.value - 10)*.02))*100)/100);
    Ettl = (form.Eqty.value * (Math.round((2.75-((form.Eqty.value - 10)*.02))*100)/100));
    }
  if (form.Eqty.value < 11){
    Ecost = (Math.round((4.75-(form.Eqty.value/5))*100)/100);
    Ettl = (form.Eqty.value * (Math.round((4.75-(form.Eqty.value/5))*100)/100));
    }
  if (form.Eqty.value < 6){
    Ecost = 3.75;
    Ettl = 18.75;
    }
  if (form.Eqty.value < 5){
    Ecost = 4.00 ;
    Ettl = 16.00;
    }
  if (form.Eqty.value < 4){
    Ecost = 4.25;
    Ettl = 12.75;
    }
  if (form.Eqty.value < 3){
    Ecost = 6.00;
    Ettl = 12.00;
    }
  if (form.Eqty.value < 2){
    Ecost = 12.00;
    Ettl = 12.00 ;
    }
  }
// Print scanning calculation
function Gmultiply(form){
  if (form.Eqty.value > 49){
    Ecost =(2.00);
    Ettl = (form.Eqty.value * (Ecost));
    }
  if (form.Eqty.value < 50){
    Ecost = (4.00-(form.Eqty.value/25));
    Ettl = (form.Eqty.value * (Ecost));
    }
  if (form.Eqty.value < 2){
    Ecost = 4.00;
    Ettl = 4.00;
    }
  }
// X-ray calculation		 
function Xmultiply(form){
  if (form.Eqty.value > 49){
    Ecost =6.25;
    Ettl = (form.Eqty.value * (Ecost));
    }
  if (form.Eqty.value < 50){
    Ecost = (11.25-((10 * form.Eqty.value)/100));
    Ettl = (form.Eqty.value * (Ecost));
    }
  if (form.Eqty.value < 3){
    Ecost = 11.25;
    Ettl = 22.50;
    }
  if (form.Eqty.value < 2){
    Ecost = 12.50;
    Ettl = 12.50;
    }
  }
function customS(form){
  if (form.customscan.checked){
    animatedcollapse.show('custinst');
    yes10 = form.custominfo.value ;
    }
  else {
    animatedcollapse.hide('custinst');
    form.custominfo.value = "";
    yes10 = "";
    }
  Options(form);
  }
function Options(form){
//  form.Eco1des.value = "";
//  form.E1each.value = "";
//  form.E1tot.value = "" ;
//  form.Eco2des.value = "";
//  form.E2each.value = "";
//  form.E2tot.value = "";
//  form.EcoPrintdes.value = "";
//  form.EcoPrintdes2.value = "";
//  form.EcoPrintdes3.value = "";
  form.P4Each.value = "";
  form.P5Each.value = "";
  form.P8Each.value = "";
  form.EPTot.value = ""
  var checksummary = "";
  form.allformats.value = "";
  document.getElementById('adformattxt').style.display = "none";
  document.getElementById('formatcharge').style.display = "none";
  document.getElementById('Deach').innerHTML = currency(Ecost);
  document.getElementById('Dtotal').innerHTML = currency(Ettl);
  var O = ["","output1","output2","output3","output4","output5","output6","output7","output8","output9","output10"];
  var F = ["","checked1","checked2","checked3","checked4","checked5","checked6","checked7","checked8","checked9","customscan"];
  var Z = ["",size1,size2,size3,size4,size5,size6,size7,size8,size9,size10];
  var Y = ["",yes1,yes2,yes3,yes4,yes5,yes6,yes7,yes8,yes9,yes10];
  var i = 1;
  charge = 0;
  var sizes = 0;
  for (i=1;i<11;i++){
    form[O[i]].value =  "";
    if (form[F[i]].checked){
      charge = charge + 1;
      sizes = sizes + (form.Eqty.value * Z[i]);
      form[O[i]].value = Y[i];
      }
    allsize = (Math.round((sizes)*1000)/1000)
    }
  Echeck = 0
  if (form.E1Kbox.checked==true || form.E2Kbox.checked==true){
  Echeck = 1;}
  charge = (charge+Echeck - 1)
  extracharge = 0
  if (charge > 0){
    document.getElementById('adformattxt').style.display = "";
    document.getElementById('formatcharge').style.display = "";
    }
  form.filecharge.value = ""
  form.fileeach.value = ""
  form.adform.value = ""
  if (charge > 0){
    extracharge = ((charge) * .1 * form.Eqty.value);
    form.filecharge.value = currency(extracharge);
    form.fileeach.value = "$.10 each per addt'l format"
    form.adform.value = (Math.round(extracharge * 10))
    document.getElementById('formatcharge').innerHTML = currency(extracharge)
    }
  Total(form)
  }
function Total(form) {
  var E46Print = 0;
  var E57Print = 0;
  var E81Print = 0;
  form.EcoPrintdes.value = "";
  form.EcoPrintdes2.value = "";
  form.EcoPrintdes3.value = "";
  document.getElementById('printcharge').innerHTML = " ";
  document.getElementById('printcostlabel').style.display = "none";
  if (form.Check10.checked){
    E46Print = (form.Eqty.value * form.sets4x6.value * .89);
    form.EcoPrintdes.value = "Include " + form.sets4x6.value + " set(s) of 4x6 Glossy Prints" ;
    form.P4Each.value = "$0.89 each";
    form.P4tpr.value = (form.Eqty.value * form.sets4x6.value);
    form.p4cost.value = currency(E46Print);
    }
  else {
    form.sets4x6.value = 1
    form.P4Each.value = "";
    form.P4tpr.value = "";
    form.p4cost.value = "";
    }
  if (form.Check11.checked){
    E57Print = (form.Eqty.value * form.sets5x7.value * 3.5);
    form.EcoPrintdes2.value = "Include " + form.sets5x7.value + " set(s) of 5x7 Glossy Prints" ;
    form.P5Each.value = "$3.50 each";
    form.P5tpr.value = (form.Eqty.value * form.sets5x7.value);
    form.p5cost.value = currency(E57Print);
    }
  else {
    form.sets5x7.value = 1
    form.P5Each.value = "";
    form.P5tpr.value = "";
    form.p5cost.value = "";
    }
  if (form.Check12.checked){
    E81Print = (form.Eqty.value * form.sets8x10.value * 6.50);
    form.EcoPrintdes3.value = "Include " + form.sets8x10.value + " set(s) of 8x10 Glossy Prints" ;
    form.P8Each.value = "$6.50 each";
    form.P8tpr.value = (form.Eqty.value * form.sets8x10.value);
    form.p8cost.value = currency(E81Print);
    }
  else {
    form.sets8x10.value = 1
    form.P8Each.value = "";
    form.P8tpr.value = "";
    form.p8cost.value = "";
    }
  if (form.Check10.checked || form.Check11.checked || form.Check12.checked){
    document.getElementById('printcharge').style.display = "" ;
    document.getElementById('printcharge').innerHTML = currency(E46Print + E57Print + E81Print);
    document.getElementById('printcostlabel').style.display = "";
    form.EPTot.value = currency(E46Print + E57Print + E81Print);
    }
  if (form.E1Kbox.checked || form.E2Kbox.checked){
    allsize = (Math.round((boxsize1+boxsize2)*1000)/1000)
    }
  if (charge == -1){
    animatedcollapse.hide('add4xglossy')
    }
  if (charge == 0){
    animatedcollapse.show('add4xglossy')
    }
  if (charge > 0){
    document.getElementById('add4xglossy').style.display = "";
    }
  if (Ettl + extracharge < 12){
    document.getElementById('addsetcharge').innerHTML = currency(2.00);
    smalldisk = 2;
    document.getElementById('firstdiskcost').innerHTML = "$2.00";
    freedisk = "first disk = $2.00";
    }
  else{
    document.getElementById('addsetcharge').innerHTML = currency(0);
    smalldisk = 0;
    document.getElementById('firstdiskcost').innerHTML = "$0.00";
    freedisk = "first disk n/c";
    }
  if (form.disk[0].checked){
    disksize = 640;
    diskkind = "CDR";
    }
  if (form.disk[1].checked){
    disksize = 4100;
    diskkind = "DVD";
    }
  Ndisks = (Math.round((allsize / disksize)+.5))
  document.getElementById('firstdiskcost').style.display = "none"
  document.getElementById('exdiskwarn').style.display = "none"
  if (Ndisks > 1){
    document.getElementById('firstdiskcost').style.display = ""
    document.getElementById('exdiskwarn').style.display = ""
    diskkind = diskkind + "s";
    }
  form.Peach.value = currency(Ecost)
  form.SSprice.value = currency(Ettl)
  form.disktype.value = "Burned to "+ Ndisks + " " + diskkind
  more = (Ndisks * form.extrasets.value)
  form.sets.value = ""
  document.getElementById('adctitle').style.display = "none"
  document.getElementById('addsetcharge').style.display = "none"
  if (form.extrasets.value > 0){
    document.getElementById('adctitle').style.display = ""
    document.getElementById('addsetcharge').style.display = ""
    form.sets.value = (form.extrasets.value + " extra sets of disks.")
    }
  extramediacharge = (((Ndisks - 1) * 2) + smalldisk)
  extradiskcharge = (Ndisks * form.extrasets.value * 2)
  form.Diskqty.value = currency(((Ndisks - 1) * 2) + smalldisk)
  if (Ettl + extracharge < 12){freenot = "";}
  else{freenot = " + " + ((((Ndisks - 1) * 2) + smalldisk)/2) + " @ $2.00";}
  document.getElementById('numberdisks').innerHTML = ('Approximately ' + allsize + ' Mb should require ' + Ndisks + ' ' + diskkind)
  form.payDisk.value = "First disk is n/c"
  if (Ndisks > 1){
    form.payDisk.value = freedisk + freenot
    }
  form.moresets.value = ""
  form.extraDcost.value = ""
  if (((((Ndisks - 1 + more) * 2) + smalldisk)/2)>0){
    form.moresets.value = more + " extra disks @ $2.00 each"
    form.extraDcost.value = currency(extradiskcharge)
    document.getElementById('firstdiskcost').innerHTML = currency(((Ndisks - 1) * 2) + smalldisk)
    }
  grostax=0
  document.getElementById('taxtag').style.display = "none"
  document.getElementById('nmtax').style.display = "none"
  if (form.tax.checked){
    document.getElementById('taxtag').style.display = ""
    document.getElementById('nmtax').style.display = ""
    grostax=(Math.round ((Ettl + extracharge + extradiskcharge + shipping) * (.07000)*100)/100)
    }
  document.getElementById('nmtax').innerHTML = currency(grostax)
  form.taxes.value = currency(grostax)
  document.getElementById('addsetcharge').innerHTML = currency(extradiskcharge)
  document.getElementById('shipcharge').innerHTML = currency(shipping)
  document.getElementById('ordertotal').innerHTML = currency(Ettl + extracharge + E46Print + E57Print + E81Print + extramediacharge + extradiskcharge + shipping + grostax)
  form.formailtotal.value = currency(Ettl + extracharge + E46Print + E57Print + E81Print + extramediacharge + extradiskcharge + shipping + grostax)
  }
function cleandust(form){
  if (form.nodust.checked){
    cleanupI = cleanthis;
    form.dusted.value="with dust removal";
    }
  else{
    cleanupI = 0;
    form.dusted.value ="no dust removal";
    }
  if (form.scansize.options[scanchoice].value=="35Eco" || form.scansize.options[scanchoice].value=="MedEco" || form.scansize.options[scanchoice].value=="film135N"){
    cleanupI = 0;
    form.dusted.value ="";
    }
  multiply(form)
  }
function extradisk(form){
  if (isNaN(form.extrasets.value)){
    alert("Number of extra disks must be a numeric (0-999) value")
    }
  if (isNaN(form.extrasets.value)){
    (form.extrasets.value) = 0
    }
  Options(form)
  }
function ship(form){
  shipchoice=form.shipselect.selectedIndex;
  if (form.shipselect.options[shipchoice].value=="shipNone"){
    shipping = 0.00;
    form.shipcost.value = "$0.00";
    form.howship.value = "No shipping requested on this order.";
    }
  if (form.shipselect.options[shipchoice].value=="shipPM"){
    shipping = 6.00;
    form.shipcost.value = "$6.00";
    form.howship.value = "Shipped via Priority Mail.";
    }
  if (form.shipselect.options[shipchoice].value=="shipFX3"){
    shipping = 15.00;
    form.shipcost.value = "$15.00";
    form.howship.value = "Shipped via Fed Ex Express Saver.";
    }
  if (form.shipselect.options[shipchoice].value=="shipFX2"){
    shipping = 20.00;
    form.shipcost.value = "$20.00";
    form.howship.value = "Shipped via Fed Ex 2-Day.";
    }
  if (form.shipselect.options[shipchoice].value=="shipFXN"){
    shipping = 30.00;
    form.shipcost.value = "$30.00";
    form.howship.value = "Shipped via Fed Ex Next Day.";
    }
  if (form.shipselect.options[shipchoice].value=="shipFXP"){
    shipping = 35.00;
    form.shipcost.value = "$35.00";
    form.howship.value = "Shipped via Fed Ex Next Morning.";
    }
  Options(form)
  }
function sameAs(form){
  if (form.same.checked){
    (form.ccname.value) = (form.fname.value);
    (form.ccadd.value) = (form.address.value);
    (form.ccadd2.value) = (form.address2.value);
    (form.cczip.value) = (form.zip.value);
    (form.cccity.value) = (form.city.value);
    (form.ccstate.value) = (form.state.value);
    }
  else{
    (form.ccname.value) = "";
    (form.ccadd.value) = "";
    (form.ccadd2.value) = "";
    (form.cczip.value) = "";
    (form.cccity.value) = "";
    (form.ccstate.value) = "";
    }
  }
function checkCCNumber(form){
  cardnumber=form.ccnumber.value;
  form.ccnumber.value=cardnumber.replace(/[^\d]/g, '');
  if (form.ccnumber.value.length > 19)
    return (false);
  sum = 0; mul = 1; l = form.ccnumber.value.length;
  for (i = 0; i < l; i++){
    digit = form.ccnumber.value.substring(l-i-1,l-i);
    tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
    }
  if ((sum % 10) == 0){
    var m="";
    var n="";
    for(i=0;i<5;i++){
      m=form.ccnumber.value.charAt(l-i);
      n=m+n
      }
    return (true);
    }
  else
    alert ("The Credit Card number checks as invalid. \n\nPlease double check the number and correct it if necessary.");
  }
function emailCheck (form) {
  var emailStr=form.email.value
  var emailPat=/^(.+)@(.+)$/
  var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
  var validChars="\[^\\s" + specialChars + "\]"
  var quotedUser="(\"[^\"]*\")"
  var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
  var atom=validChars + '+'
  var word="(" + atom + "|" + quotedUser + ")"
  var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
  var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
  var matchArray=emailStr.match(emailPat)
  if (matchArray==null) {
    alert("The email address seems incorrect (check @ and .'s)\n\nThis must be corrected to produce a form.\n\n(format: username@host.domain)")
    return false
    }
  var user=matchArray[1]
  var domain=matchArray[2]
  if (user.match(userPat)==null) {
    alert("The email username doesn't seem to be valid.\n\nThis must be corrected to produce a form.\n\n(format: username@host.domain)")
    return false
    }
  var IPArray=domain.match(ipDomainPat)
  if (IPArray!=null) {
    for (var i=1;i<=4;i++) {
      if (IPArray[i]>255) {
        alert("Destination IP address is invalid!")
        return false
        }
      }
    return true
    }
  var domainArray=domain.match(domainPat)
  if (domainArray==null) {
    alert("The domain name doesn't seem to be valid.\n\nThis must be corrected to produce a form.\n\n(format: username@host.domain)")
    return false
    }
  var atomPat=new RegExp(atom,"g")
  var domArr=domain.match(atomPat)
  var len=domArr.length
  if (domArr[domArr.length-1].length<2 ||
  domArr[domArr.length-1].length>3) {
    alert("The email address must end in a three-letter domain, or two letter country.\n\nThis must be corrected to produce a form.\n\n(format: username@host.domain)")
    return false
    }
  if (len<2) {
    var errStr="The email address is missing a hostname!\n\nThis must be corrected to produce a form.\n\n(format: username@host.domain)"
    alert(errStr)
    return false
    }
  return true;
  }
function checkForm(form){
  var errors = 0
  var req1 = ""
  var req2 = ""
  var req3 = ""
  var check1 = ""
  var check2 = ""
  if (form.email.value == ""){
    req1="\nThe contact email is MISSING - please correct. \n";
    errors = errors + 1;
    }
  if (form.phone.value == ""){
    req2="\nThe contact phone number is MISSING - please correct. \n";
    errors = errors + 1;
    }
  if (form.fname.value == ""){
    req3="\nThe 'ship to' name is MISSING - please correct.  \n";
    errors = errors + 1;
    }
  if (form.ccnumber.value != ""){
    cardnumber=form.ccnumber.value;
    form.ccnumber.value=cardnumber.replace(/[^\d]/g, '');
    if (form.ccnumber.value.length > 19)
      return (false);
    sum = 0; mul = 1; l = form.ccnumber.value.length;
    for (i = 0; i < l; i++){
      digit = form.ccnumber.value.substring(l-i-1,l-i);
      tproduct = parseInt(digit ,10)*mul;
      if (tproduct >= 10)
        sum += (tproduct % 10) + 1;
      else
        sum += tproduct;
      if (mul == 1)
        mul++;
      else
        mul--;
      }
    if ((sum % 10) == 0){
      var m="";
      var n="";
      for(i=0;i<5;i++)
      {m=form.ccnumber.value.charAt(l-i);
      n=m+n}
      errors = errors + 0
      }
    else{
      errors = errors + 1;
      check1 = "\nThe Credit Card number checks as invalid. \nPlease double check the number and correct it if necessary.\n";
      }
    }
  if(form.ccnumber.value !=""){
    var isnow = new Date();
    expdate = new Date();
    expdate.setMonth(form.expmo.value - 1);
    expdate.setYear(form.expyr.value);
    if (expdate >= isnow){
      errors = errors + 0
      }
    else {
      errors = errors + 1;
      check2 = "\nThe credit card expiration date can not be in the past.  \nPlease correct and re-submit form.\n"
      }
    }
  if (errors != 0){
    alert("THE ORDER FORM HAS PROBLEMS. \nThese must be corrected to continue:  \n" +  req1 + req2 + req3 + check1 + check2);
    return false;
    }
  }
