function oiloz()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
        Oz=document.ozform.gals.value *
               (128 / document.ozform.ratio.value)
        document.ozform.ozoil.value=Math.round(Oz * 10)/ 10
}

function oiloz2()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
 if (document.zzform.gunits(0).checked==true)
  {
                      Oz=document.zzform.gas.value *
               (128 / document.zzform.mxrat.value)
        document.zzform.ozoil2.value=Math.round(Oz * 10)/ 10
                     Ioz=document.zzform.gas.value *
               (133.233 / document.zzform.mxrat.value)
        document.zzform.iozoil.value=Math.round(Ioz * 10)/ 10
                      Ml=document.zzform.gas.value *
               (3785.4 / document.zzform.mxrat.value)
        document.zzform.mloil.value=Math.round(Ml)
  }
  else
     {
      if (document.zzform.gunits(1).checked==true)
        {
                      Oz=document.zzform.gas.value *
               (153.722 / document.zzform.mxrat.value)
        document.zzform.ozoil2.value=Math.round(Oz * 10)/ 10
                      Ioz=document.zzform.gas.value *
               (160 / document.zzform.mxrat.value)
        document.zzform.iozoil.value=Math.round(Ioz * 10)/ 10
                      Ml=document.zzform.gas.value *
               (4546 / document.zzform.mxrat.value)
        document.zzform.mloil.value=Math.round(Ml)           
         }
       else
           {
            if (document.zzform.gunits(2).checked==true)
               {
                          Oz=document.zzform.gas.value *
                   (33.81402 / document.zzform.mxrat.value)
            document.zzform.ozoil2.value=Math.round(Oz * 10)/ 10
                     Ioz=document.zzform.gas.value *
               (35.195 / document.zzform.mxrat.value)
        document.zzform.iozoil.value=Math.round(Ioz * 10)/ 10
                          Ml=document.zzform.gas.value *
                   (1000 / document.zzform.mxrat.value)
            document.zzform.mloil.value=Math.round(Ml)
                }
            }
      }    
}

function stripBad(string) {
    for (var i=0, output='', valid="eE-0123456789."; i<string.length; i++)
       if (valid.indexOf(string.charAt(i)) != -1)
          output += string.charAt(i)
    return output;
}
function resetanswer() {
  document.ozform.ozoil.value = "";
}


function gasgal()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
        Gal=document.galform.gals.value * 
               document.galform.ratioa.value *
               ((1 / document.galform.ratiob.value) - (1 / document.galform.ratioa.value))
               document.galform.galgas.value=Math.round(Gal * 10)/ 10
}
function oiladd()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
        oznow=document.addozform.gala.value * 128
             iratiob= 1 / document.addozform.ratiob.value
             iratioa= 1 / document.addozform.ratioa.value
             dratio= iratiob - iratioa  
             Ozadd=oznow * dratio
             document.addozform.ozoil.value=Math.round(Ozadd * 10)/ 10
}
function displ()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
        Answ=document.myform2.xvar.value * 
             document.myform2.yvar.value *
             (document.myform2.zvar.value / 12) * 62.5
        Bnsw=document.myform2.xvar.value * 
             document.myform2.yvar.value *
             (document.myform2.zvar.value / 12) * 64
        document.myform2.fans.value=Math.round(Answ)
        document.myform2.sans.value=Math.round(Bnsw)
}
function draft()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
        Answ=(document.myform3.zvar.value / 
             (document.myform3.xvar.value *
              document.myform3.yvar.value * 62.5)) * 12
        Bnsw=(document.myform3.zvar.value / 
             (document.myform3.xvar.value *
              document.myform3.yvar.value * 64)) * 12     
        document.myform3.fans.value=Math.round(Answ * 10) / 10
        document.myform3.sans.value=Math.round(Bnsw * 10) / 10
}
function hullspd()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
        Answ= 1.34 * Math.sqrt(document.myform4.yvar.value)
        Bnsw= 1.1508 * Answ
        Cnsw= 1.852  * Answ  
        document.myform4.fans.value=Math.round(Answ * 10) / 10
        document.myform4.sans.value=Math.round(Bnsw * 10) / 10
        document.myform4.tans.value=Math.round(Cnsw * 10) / 10
}
function transit()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
  if (document.ttform.dunits(0).checked==true && document.ttform.sunits(0).checked==true)
 {
  tothrs = document.ttform.dist.value / document.ttform.speed.value
  totdays = Math.floor (tothrs / document.ttform.hruway.value)
  pthrs = Math.floor ((tothrs  - (totdays * document.ttform.hruway.value))) 
  ptmins = Math.round (60 * ((tothrs - (totdays * document.ttform.hruway.value)) - pthrs))
  document.ttform.thours.value = Math.round (tothrs * 10) / 10
  document.ttform.tdays.value = totdays
  document.ttform.phrs.value = pthrs
  document.ttform.pmins.value=ptmins
  }
   else
   {
     if (document.ttform.dunits(1).checked==true &&          document.ttform.sunits(1).checked==true)
   {
       tothrs = document.ttform.dist.value / document.ttform.speed.value
       totdays = Math.floor (tothrs / document.ttform.hruway.value)
       pthrs = Math.floor ((tothrs  - (totdays * document.ttform.hruway.value)))
       ptmins = Math.round (60 * ((tothrs - (totdays * document.ttform.hruway.value)) - pthrs))
       document.ttform.thours.value = Math.round (tothrs * 10) / 10
       document.ttform.tdays.value = totdays
       document.ttform.phrs.value = pthrs
       document.ttform.pmins.value=ptmins
    }
   else
   {
     if (document.ttform.dunits(0).checked==true &&          document.ttform.sunits(1).checked==true)
   {
       smph = document.ttform.speed.value * 1.1508
       tothrs = document.ttform.dist.value / smph
       totdays = Math.floor (tothrs / document.ttform.hruway.value)
       pthrs = Math.floor ((tothrs  - (totdays * document.ttform.hruway.value)))
       ptmins = Math.round (60 * ((tothrs - (totdays * document.ttform.hruway.value)) - pthrs))
       document.ttform.thours.value = Math.round (tothrs * 10) / 10
       document.ttform.tdays.value = totdays
       document.ttform.phrs.value = pthrs
       document.ttform.pmins.value=ptmins 
    }
        else
       {
        if (document.ttform.dunits(1).checked==true &&                      document.ttform.sunits(0).checked==true)
       {
          dmiles = document.ttform.dist.value * 1.15078
       tothrs = dmiles / document.ttform.speed.value
       totdays = Math.floor (tothrs / document.ttform.hruway.value)
       pthrs = Math.floor ((tothrs  - (totdays * document.ttform.hruway.value)))
       ptmins = Math.round (60 * ((tothrs - (totdays * document.ttform.hruway.value)) - pthrs))
       document.ttform.thours.value = Math.round (tothrs * 10) / 10
       document.ttform.tdays.value = totdays
       document.ttform.phrs.value = pthrs
       document.ttform.pmins.value=ptmins
       }
      }
    }
  }
}
function range()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
// convert liters to gallons
  if (document.rrform.dunits(1).checked==true)
   {
     vgal = .26417 * document.rrform.tank.value
    }
    else
      {
        vgal = document.rrform.tank.value
       }
// convert liters/hr to gallons/hr
  if (document.rrform.funits(1).checked==true)
   {
     vgph = .26417 * document.rrform.usage.value
    }
    else
      {
        vgph = document.rrform.usage.value
       }
// convert SM/liter to SM/gallon
  if (document.rrform.funits(3).checked==true)
   {
     vsmg = 3.7854 * document.rrform.usage.value
    }
    else
      {
        vsmg = document.rrform.usage.value
       }
// convert NM/liter to NM/gallon
  if (document.rrform.funits(5).checked==true)
   {
     vnmg = 3.7854 * document.rrform.usage.value
    }
    else
      {
        vnmg = document.rrform.usage.value
       }
// ......mph and sm/unit consumption
  if  ((document.rrform.funits(2).checked==true || 
        document.rrform.funits(3).checked==true) &&
        document.rrform.sunits(0).checked==true)
      {
        vrsm = vgal * vsmg
        vrnm = .86898 * vrsm
        vrhr = vrsm / document.rrform.speed.value
       }
      else
       {
// ......knots and nm/unit consumption
        if  ((document.rrform.funits(4).checked==true ||               document.rrform.funits(5).checked==true) &&
              document.rrform.sunits(1).checked==true)
      {
        vrnm = vgal * vnmg
        vrsm = 1.15078 * vrnm
        vrhr = vrnm / document.rrform.speed.value
       }
      else
       { 
// ......mph and gph consumption
          if  ((document.rrform.funits(0).checked==true ||                 document.rrform.funits(1).checked==true) &&
                document.rrform.sunits(0).checked==true)
      {
        vrhr = vgal / vgph
        vrsm = vrhr * document.rrform.speed.value
        vrnm = .86898 * vrsm
       }
      else
       {
// ......knots and sm/unit consumption
          if  ((document.rrform.funits(2).checked==true ||                 document.rrform.funits(3).checked==true) &&
                document.rrform.sunits(1).checked==true)
      {
        vrsm = vgal * vsmg
        vrnm = .86898 * vrsm
        vrhr = vrnm / document.rrform.speed.value
       }
      else
       {
// ......mph and nm/unit consumption
           if  ((document.rrform.funits(4).checked==true ||                  document.rrform.funits(5).checked==true) &&
                 document.rrform.sunits(0).checked==true)
      {
        vrnm = vgal * vnmg
        vrsm = 1.15078 * vrnm
        vrhr = vrnm / (document.rrform.speed.value * .868976)
       }
      else
       {
// ......knots and gph consumption
           if  ((document.rrform.funits(0).checked==true ||                  document.rrform.funits(1).checked==true) &&
                 document.rrform.sunits(1).checked==true)
      {
        vrhr = vgal / vgph
        vrnm =  vrhr * document.rrform.speed.value
        vrsm = vrnm * 1.15078
       }
     }
    }
   }
  }
 }
            document.rrform.rsm.value =  Math.round (vrsm * 10) / 10
            document.rrform.rnm.value =  Math.round (vrnm * 10) / 10
            document.rrform.rhr.value  =   Math.round (vrhr * 10) / 10
                       vtcost = vgal * document.rrform.cpu.value
            document.rrform.tcost.value = Math.round (vtcost * 100) / 100 
            document.rrform.csm.value = Math.round ((vtcost / vrsm) * 100) / 100
            document.rrform.cnm.value = Math.round ((vtcost / vrnm) * 100) / 100
            document.rrform.chr.value = Math.round ((vtcost / vrhr) * 100) / 100
}            
function format(nval)
{
      var ftmp = Math.round(nval * 10);
      ftmp = ftmp / 10;
      return ftmp;
} 
function disbsm()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
      var icwwg  =  [ [0,27,51,112,150,214,222,236,248,302,356,388,525,537,562,556,614,653,615,651,717,762,769,780,786,856,887,900], [27,0,36,98,135,200,208,224,233,288,341,374,510,523,547,542,599,636,600,636,703,748,754,766,771,841,872,885], [51,36,0,62,99,164,171,188,197,252,305,338,474,487,511,506,563,602,564,600,666,712,718,730,735,805,836,849], [112,98,62,0,37,102,110,126,136,190,243,276,412,425,450,444,502,541,503,539,605,650,656,666,673,743,775,788],
[150,135,99,37,0,73,81,97,106,161,214,247,383,396,421,415,473,512,474,510,576,621,627,639,644,714,746,758],
[214,200,164,102,73,0,58,74,84,138,191,224,361,373,396,392,450,489,451,487,553,598,605,616,622,692,723,736],
[222,208,171,110,81,58,0,32,41,96,149,182,318,331,355,350,407,446,408,444,510,556,562,574,579,649,680,693],
[236,224,188,126,97,74,32,0,26,83,136,169,305,318,342,337,394,433,396,431,496,543,549,561,566,636,668,680],
[248,233,197,136,106,84,41,26,0,66,120,152,289,302,326,320,378,417,379,415,481,526,533,544,550,620,651,664],
[302,288,252,190,161,138,96,83,66,0,53,86,222,235,260,254,312,351,313,349,415,460,466,578,483,553,585,598],
[356,341,305,243,214,191,149,136,120,53,0,33,169,182,206,201,258,297,260,295,362,407,413,425,430,500,532,544],
[388,374,338,276,247,224,182,169,152,86,33,0,136,149,174,168,226,265,227,263,329,374,380,392,397,467,499,512],
[525,510,474,412,383,361,318,305,289,222,169,136,0,32,57,51,109,148,110,146,212,257,264,275,280,351,382,395],
[537,523,487,425,396,373,331,318,302,235,182,149,32,0,26,21,78,117,80,115,182,227,233,245,250,320,352,364],
[562,547,511,450,421,396,355,342,326,260,206,174,57,26,0,26,84,123,85,121,187,232,236,250,255,326,357,370],
[556,542,506,444,415,392,350,337,320,254,201,168,51,21,26,0,58,97,59,95,161,206,212,224,229,300,331,344],
[614,599,563,502,473,450,407,394,378,312,258,226,109,78,84,58,0,48,10,40,106,151,158,169,174,244,276,289],
[653,636,602,541,512,489,446,433,417,351,297,265,148,117,123,97,48,0,48,84,150,195,202,213,219,289,320,333],
[615,600,564,503,474,451,408,396,379,313,260,227,110,80,85,59,10,48,0,44,111,156,162,174,179,249,281,294],
[651,636,600,539,510,487,444,431,415,349,295,263,146,115,121,95,40,84,44,0,70,115,122,133,139,209,240,253],
[717,703,666,605,576,553,510,496,481,415,362,329,212,182,187,161,106,150,111,70,0,45,52,63,68,136,170,183],
[762,748,712,650,621,598,556,543,526,460,407,374,257,227,232,206,151,195,156,115,45,0,9,20,26,96,127,140],
[769,754,718,656,627,605,562,549,533,466,413,380,264,233,236,212,158,202,162,122,52,9,0,12,17,87,118,131],
[780,766,730,666,639,616,574,561,544,578,425,392,275,245,250,224,169,213,174,133,63,20,12,0,15,85,116,129],
[786,771,735,673,644,622,579,566,550,483,430,397,280,250,255,229,174,219,179,139,68,26,17,15,0,89,120,133],
[856,841,805,743,714,692,649,636,620,553,500,467,351,320,326,300,244,289,249,209,136,96,87,85,89,0,33,46],
[887,872,836,775,746,723,680,668,651,585,532,499,382,352,357,331,276,320,281,240,170,127,118,116,120,33,0,13],
[900,885,849,788,758,736,693,680,664,598,544,512,395,364,370,344,289,333,294,253,183,140,131,129,133,46,13,0] ] ;
        porta = parseInt (document.icwwgports.fpid.value);
        portb = parseInt (document.icwwgports.tpid.value);
//        alert("porta= " +porta+ " portb= " +portb) 
        document.icwwgports.distsm.value = Math.round(1.15078 * (icwwg [porta][portb]));
        document.icwwgports.distnm.value =  icwwg [porta][portb];
        document.icwwgports.distkm.value = Math.round(1.852 * (icwwg [porta][portb]));
}
function disbsjsm()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
      var stjohns  =  [ [0,2,4,12,20,32,68,89,86,136,145,162,95,109,143,161], [2,0,2,10,18,30,66,87,84,134,143,160,93,107,141,159], [4,2,0,8,16,28,64,85,82,132,141,158,91,105,139,157], [12,10,8,0,8,20,56,77,74,124,133,150,83,97,131,149],
[20,18,16,8,0,12,48,69,66,116,125,142,75,89,123,141],
[32,30,28,20,12,0,36,56,54,104,112,129,62,77,111,129],
[68,66,64,56,48,36,0,20,18,68,76,94,26,41,75,93],
[89,87,85,77,69,56,20,0,26,76,85,102,35,49,83,101],
[86,84,82,74,66,54,18,26,0,50,58,75,8,23,57,75],
[136,134,132,124,116,104,68,76,50,0,14,31,56,71,105,123],
[145,143,141,133,125,112,76,85,58,14,0,17,65,79,113,131],
[162,160,158,150,142,129,94,102,75,31,17,0,82,96,131,148],
[95,93,91,83,75,62,26,35,8,56,65,82,0,14,49,66],
[109,107,105,97,89,77,41,49,23,71,79,96,14,0,34,52],
[143,141,139,131,123,111,75,83,57,105,113,131,49,34,0,18],
[161,159,157,149,141,129,93,101,75,123,131,148,66,52,18,0], ] ;
        porta = parseInt (document.stjohnsports.fpid.value);
        portb = parseInt (document.stjohnsports.tpid.value);
//        alert("porta= " +porta+ " portb= " +portb) 
        document.stjohnsports.distsm.value = Math.round(1.15078 * (stjohns [porta][portb]));
        document.stjohnsports.distnm.value =  stjohns [porta][portb];
        document.stjohnsports.distkm.value = Math.round(1.852 * (stjohns [porta][portb]));
}
function diskwapal()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
      var kwapal  =  [ [0,42,65,70,57,88,96,134,144,172,186,210,218,232,234,250,310,367,389,406],
[42,0,29,37,31,80,100,136,146,174,189,213,221,235,237,253,313,389,391,408], 
[65,29,0,35,32,81,103,139,149,177,191,215,224,237,240,255,316,392,394,411], 
[70,37,35,0,17,66,88,124,134,162,176,200,209,222,225,240,301,377,379,396],
[57,31,32,17,0,49,71,107,117,145,159,183,192,205,208,223,284,360,362,379],
[88,80,81,66,49,0,38,79,88,116,131,155,163,177,179,195,255,332,334,350],
[96,100,103,88,71,38,0,44,54,82,96,120,129,143,145,160,221,297,299,316],
[134,136,139,124,107,79,44,0,35,63,78,102,110,124,126,142,202,278,280,297],
[144,146,149,134,117,88,54,35,0,28,43,67,75,89,91,107,167,244,245,262],
[172,174,177,162,145,116,82,63,28,0,15,39,47,61,63,79,139,216,218,234],
[186,189,191,176,159,131,96,78,43,15,0,25,33,42,49,65,125,202,204,221],
[210,213,215,200,183,155,120,102,67,39,25,0,22,36,38,54,114,191,193,209],
[218,221,224,209,192,163,129,110,75,47,33,22,0,18,31,47,107,184,186,202],
[232,235,237,222,205,177,143,124,89,61,42,36,18,0,47,63,123,200,202,218],
[234,237,240,225,208,179,145,126,91,63,49,38,31,47,0,18,79,155,157,174],
[250,253,255,240,223,195,160,142,107,79,65,54,47,63,18,0,68,145,147,164],
[310,313,316,301,284,255,221,202,167,139,125,114,107,123,79,68,0,91,101,118],
[367,389,392,377,360,332,297,278,244,216,202,191,184,200,155,145,91,0,52,69],
[389,391,394,379,362,334,299,280,245,218,204,193,186,202,157,147,101,52,0,25],
[406,408,411,396,379,350,316,297,262,234,221,209,202,218,174,164,118,69,25,0],
 ] ;
        porta = parseInt (document.kwapalports.fpid.value);
        portb = parseInt (document.kwapalports.tpid.value);
//        alert("porta= " +porta+ " portb= " +portb) 
        document.kwapalports.distsm.value = Math.round(1.15078 * (kwapal [porta][portb]));
        document.kwapalports.distnm.value =  kwapal [porta][portb];
        document.kwapalports.distkm.value = Math.round(1.852 * (kwapal [porta][portb]));
}
function disfernkw()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
      var fernkw  =  [ [0,717,758,778,796,831,846,879,898,915,918,952,966,990,995,1026,1053,1066,1122,1005,1018,1064,1067,1090,1150,1170,1203,1208,1244], 
[717,0,41,60,79,114,130,162,181,198,201,235,249,273,278,310,336,349,406,289,302,348,350,373,435,453,486,491,527], 
[758,41,0,56,75,109,124,158,176,193,197,230,244,268,274,305,331,344,402,284,297,344,345,368,430,449,481,486,522], 
[778,60,56,0,18,53,68,101,120,137,140,174,188,212,217,248,275,288,344,227,241,287,289,312,373,392,425,430,466],
[796,79,75,18,0,35,51,83,102,119,122,157,170,194,199,230,257,270,327,209,222,269,270,293,356,374,407,412,448],
[831,114,109,53,35,0,16,48,67,84,87,121,135,159,165,196,222,235,292,175,188,235,236,259,321,339,372,377,413],
[846,130,124,68,51,16,0,32,52,68,72,106,120,144,150,181,207,220,276,159,173,219,220,243,305,323,356,362,397],
[879,162,158,101,83,48,32,0,20,36,39,74,87,112,116,147,174,188,244,127,139,186,188,211,273,291,323,329,365],
[898,181,176,120,102,67,52,20,0,16,21,54,68,92,98,129,155,168,224,107,121,167,168,191,253,273,304,311,346],
[915,198,193,137,119,84,68,36,16,0,3,38,52,76,81,112,138,152,208,91,104,151,152,175,237,257,288,293,329],
[918,201,197,140,122,87,72,39,21,3,0,34,47,71,77,108,135,148,205,87,100,147,148,171,234,252,284,290,326],
[952,235,230,174,157,121,106,74,54,38,34,0,14,38,44,75,101,114,170,53,67,113,114,137,199,219,250,257,292],
[966,249,244,188,170,135,120,87,68,52,47,14,0,24,30,61,87,100,157,39,53,99,100,123,185,205,236,243,278],
[990,273,268,212,194,159,144,112,92,76,71,38,24,0,9,40,67,81,137,20,32,79,80,104,166,185,216,222,258],
[995,278,274,217,199,165,150,116,98,81,77,44,30,9,0,31,58,70,128,25,38,85,86,109,171,190,222,228,264],
[1026,310,305,248,230,196,181,147,129,112,108,75,61,40,31,0,26,40,96,56,69,116,117,141,203,221,253,259,295],
[1053,336,331,275,257,222,207,174,155,138,135,101,87,67,58,26,0,13,70,83,96,143,144,167,229,247,280,285,321],
[1066,349,344,288,270,235,220,188,168,152,148,114,100,81,70,40,13,0,56,96,108,155,156,180,242,261,292,298,334],
[1122,406,402,344,327,292,276,244,224,208,205,170,157,137,128,96,70,56,0,152,166,212,213,236,298,318,349,356,390],
[1005,289,284,227,209,175,159,127,107,91,87,53,39,20,25,56,83,96,152,0,14,60,61,84,146,166,197,204,239],
[1018,302,297,241,222,188,173,139,121,104,100,67,53,32,38,69,96,108,166,14,0,47,48,71,133,152,184,190,226],
[1064,348,344,287,269,235,219,186,167,151,147,113,99,79,85,116,143,155,212,60,47,0,1,24,86,106,137,144,178],
[1067,350,345,289,270,236,220,188,168,152,148,114,100,80,86,117,144,156,213,61,48,1,0,23,85,105,136,142,177],
[1090,373,368,312,293,259,243,211,191,175,171,137,123,104,109,141,167,180,236,84,71,24,23,0,62,82,113,120,154],
[1150,435,430,373,356,321,305,273,253,237,234,199,185,166,171,203,229,242,298,146,133,86,85,62,0,22,54,60,96],
[1170,453,449,392,374,339,323,291,273,257,252,219,205,185,190,221,247,261,318,166,152,106,105,82,22,0,33,40,75],
[1203,486,481,425,407,372,356,323,304,288,284,250,236,216,222,253,280,292,349,197,184,137,136,113,54,33,0,39,48],
[1208,491,486,430,412,377,362,329,311,293,290,257,243,222,228,259,285,298,356,204,190,144,142,120,60,40,39,0,84],
[1244,527,522,466,448,413,397,365,346,329,326,292,278,258,264,295,321,334,390,239,226,178,177,154,96,75,48,84,0] ] ;
        porta = parseInt (document.fernkwports.fpid.value);
        portb = parseInt (document.fernkwports.tpid.value);
//        alert("porta= " +porta+ " portb= " +portb) 
        document.fernkwports.distsm.value = Math.round(1.15078 * (fernkw [porta][portb]));
        document.fernkwports.distnm.value =  fernkw [porta][portb];
        document.fernkwports.distkm.value = Math.round(1.852 * (fernkw [porta][portb]));
}

function dismissirv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{
      var missir = [0,25,39,88,93,95,98,175,209,229,304,363,437,537,663,734,954,994,1006,1034,1134,1139,1144,1149,1157,1172,1195,1227,1255,1264,1279,1290,1297,1318,1338,1357,1364,1391,1411,1437,1447,1473,1477,1511,1534,1537,1569,1589,1602,1633,1652,1656,1668,1680,1682,1692,1702,1751,1769,1793,1802,1807];
	
        porta = parseInt (document.missirports.fpid.value);
        portb = parseInt (document.missirports.tpid.value);
        portc = porta;
        portd = portb;
                
        if (porta == "62")
            porta = 9;
        if (portb == "62")
            portb = 9;
        if (porta == "63")
            porta = 16;
        if (portb == "63")
            portb = 16;  

//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(missir[porta] - missir[portb]);
        

 	if ((portc != portd) && (portc == "62" || portd == "62"))
           distanc = (distanc + 64);
        if ((portc != portd) && (portc == "63" || portd == "63"))
           distanc = (distanc + 2);
        document.missirports.distsm.value = distanc;   
        document.missirports.distnm.value = Math.round(0.86898 *                  distanc);
        document.missirports.distkm.value = Math.round(1.609344 *
           distanc);		
}

function dismissourv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var missour = [0,28,67,98,104,105,120,125,130,143,197,202,226,239,250,263,294,317,329,363,367,396,448,495,498,507,542,563,591,615,617,725,732,753];
	
        porta = parseInt (document.missourports.fpid.value);
        portb = parseInt (document.missourports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(missour[porta] - missour[portb]);
        
        document.missourports.distsm.value = distanc;   
        document.missourports.distnm.value = Math.round(0.86898 *                  distanc);
        document.missourports.distkm.value = Math.round(1.609344 *
           distanc);
          
}

function disohiorv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var ohior = [0,2,18,42,46,58,62,133,187,205,225,260,374,378,423,449,509,545,626,640,655,673,702,711,777,797,809,820,855,894,897,913,927,938,950,968,975,981];
	
        porta = parseInt (document.ohiorports.fpid.value);
        portb = parseInt (document.ohiorports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(ohior[porta] - ohior[portb]);
        
        document.ohiorports.distsm.value = distanc;   
        document.ohiorports.distnm.value = Math.round(0.86898 *                  distanc);
        document.ohiorports.distkm.value = Math.round(1.609344 *
           distanc);
          
}

function distennrv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var tennr = [0,0,22,25,100,135,172,178,190,207,227,254,260,275,304,349,414,418,425,464,471,530,568,592,602,648];
	
        porta = parseInt (document.tennrports.fpid.value);
        portb = parseInt (document.tennrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(tennr[porta] - tennr[portb]);
        
        document.tennrports.distsm.value = distanc;   
        document.tennrports.distnm.value = Math.round(0.86898 *                  distanc);
        document.tennrports.distkm.value = Math.round(1.609344 *
           distanc);
          
}

function disillirv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var illir = [0,21,55,65,80,89,158,180,207,210,222,239,244,271,288,293,333];
	
        porta = parseInt (document.illirports.fpid.value);
        portb = parseInt (document.illirports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(illir[porta] - illir[portb]);
        
        document.illirports.distsm.value = distanc;   
        document.illirports.distnm.value = Math.round(0.86898 *                  distanc);
        document.illirports.distkm.value = Math.round(1.609344 *
           distanc);
          
}
function disallegrv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var allegr = [0.0,6.0,6.7,10.0,12.3,14.5,16.4,18.3,24.2,29.3,30.2,30.4,36.3,39.1,42.0,45.7,46.7,50.6,52.6,55.6,60.0,62.2,63.5,69.0,72.0];
	
        porta = parseInt (document.allegrports.fpid.value);
        portb = parseInt (document.allegrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(allegr[porta] - allegr[portb]);
        
        document.allegrports.distsm.value = format(distanc);   
        document.allegrports.distnm.value = format(0.86898 *                  distanc);
        document.allegrports.distkm.value = format(1.609344 *
           distanc);
          
}
function dismononrv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var mononr = [0.0,7.5,11.2,15.5,20.7,23.8,25.5,31.5,41.5,43.7,51.7,56.4,61.2,65.7,68.8,71.8,77.5,85.0,89.6,90.8,91.3,95.1,101.0,102.0,104.6,108.0,115.4,119.7,126.7,128.7];
	
        porta = parseInt (document.mononrports.fpid.value);
        portb = parseInt (document.mononrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(mononr[porta] - mononr[portb]);
        
        document.mononrports.distsm.value = distanc;   
        document.mononrports.distnm.value = Math.round(0.86898 *                  distanc);
        document.mononrports.distkm.value = Math.round(1.609344 *
           distanc);
          
}
function discumbrv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var cumbr =
[0,2,11,16,20,31,33,42,44,59,63,78,89,104,125,126,149,153,158,175,191,197,206,216,222,233,237,240,248,263,279,292,308,309,314,317,333,358,358, 381,381,385,400,423,461]; 
	
        porta = parseInt (document.cumbrports.fpid.value);
        portb = parseInt (document.cumbrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(cumbr[porta] - cumbr[portb]);
        
        document.cumbrports.distsm.value = Math.round(1 * distanc);   
        document.cumbrports.distnm.value = Math.round(0.86898 *                  distanc);
        document.cumbrports.distkm.value = Math.round(1.609344 *
           distanc);
}
function disarksrv()
// Copyright(c) 2000-2005, Blue Heron's Nest - all rights reserved
{		
      var arksr = 
[0,9.8,10.3,13.3,19,50.2,66,71.2,86.3,108.1,119.1,125.4,155.9,156,174,176.9,187,203.4,205.5,230.5,256.8,258,292.8,300.6,308,308.7,319.6,336.2,342,366.6,393.2,394,395,401.4,421.6,445.3];
	
        porta = parseInt (document.arksrports.fpid.value);
        portb = parseInt (document.arksrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(arksr[porta] - arksr[portb]);
        
        document.arksrports.distsm.value = distanc;   
        document.arksrports.distnm.value = Math.round(0.86898 *                  distanc);
        document.arksrports.distkm.value = Math.round(1.609344 *
           distanc);
}
function disredrv()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{		
      var redr = [0,1.2,6.9,10.6,34.4,43.9,74.5,88,111,116.5,152,168.5,177.8,199.9,228];
	
        porta = parseInt (document.redrports.fpid.value);
        portb = parseInt (document.redrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(redr[porta] - redr[portb]);
        
        document.redrports.distsm.value = distanc;   
        document.redrports.distnm.value = Math.round(0.86898 *                  distanc);
        document.redrports.distkm.value = Math.round(1.609344 *
           distanc);
}
function disouacrv()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{		
      var ouacr = [0,25,41,42,57.5,65.8,110,117.2,167,192,223.5,239.4,282.8,293,337];
	
        porta = parseInt (document.ouacrports.fpid.value);
        portb = parseInt (document.ouacrports.tpid.value);
        portc = porta;
        portd = portb;
                
//     alert("porta= " +porta+ " portb= " +portb+); 

        distanc = Math.abs(ouacr[porta] - ouacr[portb]);
        
        document.ouacrports.distsm.value = distanc;   
        document.ouacrports.distnm.value = Math.round(0.86898 *                  distanc);
        document.ouacrports.distkm.value = Math.round(1.609344 *
           distanc);
          
}
