function disches()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
      var chesa  =  [ [187,209,284,259,265,209,207,214,192,169,243,134,213,122,143,103,98,83,65,78,62,33,13,0], [174,196,271,246,252,196,194,201,179,156,230,121,200,109,130,90,85,70,52,65,49,20,0], [166,175,249,240,230,190,172,185,163,149,224,115,192,101,124,84,78,62,45,61,41,0], 
[150,173,247,222,228,172,170,174,155,132,206,98,175,84,107,66,60,45,28,45,0],
[162,170,244,235,225,185,167,178,156,146,219,110,187,96,119,78,72,59,40,0],
[129,140,213,204,194,152,136,152,130,112,186,77,155,64,86,45,39,25,0],
[132,141,215,206,196,156,138,149,126,116,190,80,156,65,89,48,36,0],
[123,132,206,197,187,147,129,140,117,107,182,72,149,58,81,39,0],
[92,100,174,165,155,115,97,109,87,76,150,42,118,27,51,0],
[103,113,187,178,168,128,110,122,100,87,165,43,141,49,0],
[67,89,163,137,144,89,86,90,68,50,125,27,96,0],
[163,185,259,233,240,185,182,186,164,146,221,121,0],
[67,77,151,142,132,92,74,86,64,51,129,0],
[136,146,220,211,201,161,143,154,132,122,0],
[21,32,106,97,88,48,29,50,28,0],
[34,58,132,101,114,55,55,22,0],
[56,66,140,123,122,78,63,0],
[24,12,77,68,58,21,0],
[42,29,98,89,79,0],
[82,70,19,10,0],
[92,80,28,0],
[101,90,0],
[27,0],
[0]] ;
        var23 = 23;
        porta = parseInt (document.chesaports.fpid.value);
        portb = parseInt (document.chesaports.tpid.value);
//       alert("porta= " +porta+ " portb= " +portb) 

        if (porta == portb) 
         { 
           document.chesaports.distsm.value = 0
           document.chesaports.distnm.value = 0 
           document.chesaports.distkm.value = 0  
         }
	else
         {
	   if (porta < portb)
	    {
	      portb = var23 - portb
//       alert("porta= " +porta+ " portb= " +portb)
        document.chesaports.distsm.value = Math.round(1.15078 * (chesa [porta][portb]))
        document.chesaports.distnm.value =  chesa [porta][portb]
        document.chesaports.distkm.value = Math.round(1.852 * (chesa [porta][portb]))
            }
           else
            {
              portc = porta 
              porta = portb 
              portb = var23 - portc
//       alert("porta= " +porta+ " portb= " +portb)
        document.chesaports.distsm.value = Math.round(1.15078 * (chesa [porta][portb]))
        document.chesaports.distnm.value =  chesa [porta][portb]
        document.chesaports.distkm.value = Math.round(1.852 * (chesa [porta][portb]));
            }
      	  }

}
function disirtny()
// Copyright(c) 2005, Blue Heron's Nest - all rights reserved
{
      var irtny  =  [ [116,107,94,85,80,77,76,72,66,61,62,57,48,42,34,28,21,16,21,11,0], [117,108,95,86,81,78,77,73,67,62,63,58,49,43,35,29,22,17,22,0], 
[108,99,86,77,72,69,68,64,58,53,54,49,40,34,26,20,13,8,0], 
[100,91,78,69,64,61,60,56,50,45,46,41,32,26,18,12,5,0],
[97,88,75,66,61,58,58,54,47,42,44,39,29,23,15,9,0],
[89,80,67,58,53,49,49,45,39,34,35,30,21,15,7,0],
[85,76,63,54,49,46,45,42,35,30,32,27,17,11,0],
[75,66,53,44,38,35,35,31,24,19,21,16,6,0],
[72,63,50,41,36,32,32,28,22,17,18,13,0],
[60,51,38,29,24,21,21,17,10,5,9,0],
[60,51,38,29,24,21,20,16,12,8,0],
[57,48,35,26,21,18,17,13,6,0],
[51,42,29,20,15,12,11,7,0],
[44,35,22,13,8,4,4,0],
[41,32,19,10,5,4,0],
[42,33,20,11,6,0],
[36,27,14,5,0],
[31,22,9,0],
[27,13,0],
[40,0],
[0]] ;
        var20 = 20;
        porta = parseInt (document.irtnyports.fpid.value);
        portb = parseInt (document.irtnyports.tpid.value);
//       alert("porta= " +porta+ " portb= " +portb) 

        if (porta == portb) 
         { 
           document.irtnyports.distsm.value = 0
           document.irtnyports.distnm.value = 0 
           document.irtnyports.distkm.value = 0  
         }
	else
         {
	   if (porta < portb)
	    {
	      portb = var20 - portb
//       alert("porta= " +porta+ " portb= " +portb)
        document.irtnyports.distsm.value = Math.round(1.15078 * (irtny [porta][portb]))
        document.irtnyports.distnm.value =  irtny [porta][portb]
        document.irtnyports.distkm.value = Math.round(1.852 * (irtny [porta][portb]))
            }
           else
            {
              portc = porta 
              porta = portb 
              portb = var20 - portc
//       alert("porta= " +porta+ " portb= " +portb)
        document.irtnyports.distsm.value = Math.round(1.15078 * (irtny [porta][portb]))
        document.irtnyports.distnm.value =  irtny [porta][portb]
        document.irtnyports.distkm.value = Math.round(1.852 * (irtny [porta][portb]));
            }
      	  }

}
function disicwwj()
// Copyright(c) 2005, Blue Heron's Nest - all rights reserved
{
      var icwwj  =  [ [190,142,138,133,128,123,119,108,124,97,79,66,63,54,58,46,44,40,34,0], [156,108,103,99,94,89,85,74,90,62,45,32,29,20,23,11,9,6,0], 
[150,102,98,93,88,83,79,68,84,57,39,26,23,14,18,6,4,0], 
[146,98,94,89,85,79,76,64,80,53,35,22,19,10,14,2,0],
[144,96,92,88,83,77,74,63,79,51,33,20,17,9,12,0],
[142,94,90,86,81,75,72,60,77,49,31,18,15,7,0],
[137,89,85,80,75,70,66,55,71,44,26,13,10,0],
[132,84,80,75,70,65,61,50,66,39,21,8,0],
[131,83,79,74,69,64,60,49,65,38,20,0],
[111,63,59,54,49,44,40,29,45,18,0],
[95,47,43,39,34,28,25,13,30,0],
[100,52,47,43,38,33,29,18,0],
[82,34,30,25,20,15,11,0],
[71,23,18,14,9,4,0],
[67,19,15,10,5,0],
[62,14,9,5,0],
[57,9,5,0],
[52,4,0],
[48,0],
[0]] ;
        var19 = 19;
        porta = parseInt (document.icwwnjports.fpid.value);
        portb = parseInt (document.icwwnjports.tpid.value);
//       alert("porta= " +porta+ " portb= " +portb) 

        if (porta == portb) 
         { 
           document.icwwnjports.distsm.value = 0
           document.icwwnjports.distnm.value = 0 
           document.icwwnjports.distkm.value = 0  
         }
	else
         {
	   if (porta < portb)
	    {
	      portb = var19 - portb
//       alert("porta= " +porta+ " portb= " +portb)
        document.icwwnjports.distsm.value = Math.round(1.15078 * (icwwj [porta][portb]))
        document.icwwnjports.distnm.value =  icwwj [porta][portb]
        document.icwwnjports.distkm.value = Math.round(1.852 * (icwwj [porta][portb]))
            }
           else
            {
              portc = porta 
              porta = portb 
              portb = var19 - portc
//       alert("porta= " +porta+ " portb= " +portb)
        document.icwwnjports.distsm.value = Math.round(1.15078 * (icwwj [porta][portb]))
        document.icwwnjports.distnm.value =  icwwj [porta][portb]
        document.icwwnjports.distkm.value = Math.round(1.852 * (icwwj [porta][portb]));
            }
      	  }

}
var points = new Array(1);
points["Potomac"] = ["Potomac River mouth", "Coan River mouth, VA",
"Smith Creek mouth, MD", "St. Marys River mouth", "Yeocomico River mouth, VA", "Piney Point, MD", "Lower Machodoc Creek, VA", 
"Nomini Bay, VA", "Breton Bay Entrance, MD", "Wicomico River mouth, MD", "Colonial Beach, VA", "Dahlgren, VA", "Potomac R. (US 301) Bridge", "Quantico, VA", "Occoquan, VA", "Indian Head, MD", "Mount Vernon, VA", "Alexandria, VA", "Bladensburg, MD", "Washington, DC", "Key Bridge", "Chain Bridge"]; 
points["Delaware"] = ["Delaware Bay Entrance", "Roosevelt Inlet, DE",
"Cape May Canal, West Entrance", "St. Jones River mouth, DE",
"Mauricetown, NJ", "Bridgeton, NJ", "Smyrna River mouth, DE", 
"Salem, NJ", "C & D Canal, East Entrance", "New Castle, DE",
"Wilmington, DE", "Marcus Hook, PA", "Bridgeport, NJ", "Chester, PA",
"Schuylkill River mouth, PA", "Philadelphia, PA", "Burlington, NJ",
"former U.S. Steel Basin, PA", "Bordentown, NJ", "Trenton, NJ" ];
points["Hudson"] = ["New York (The Battery)", "Yonkers", "Tarrytown",
"Nyack", "Ossining", "Haverstraw", "Peekskill", "West Point",
"Newburgh", "Poughkeepsie", "Hyde Park", "Kingston", "Saugerties",
"Catskill", "Hudson", "Athens", "Coxsackie", "Coeymans", "Albany",
"Rensselear", "Troy", "Watervliet", "Troy Lock"];
points["icwwnj"] = ["New York, NY (the Battery)", "Shark River Inlet *", "Manasquan Inlet", "Bay Head", "Mantoloking", "Toms River (town)",
"Seaside Park", "Forked River (town)", "Barnegat Inlet", "Beach Haven",
"Atlantic City", "Mays Landing", "Ocean City", "Sea Isle City", "Avalon", "Stone Harbor", "Wildwood", "Cape May Harbor", "Cape May Canal, West Entrance", "C & D Canal, East Entrance"]; 
points["irtny"] = ["Greenport", "Sag Harbor", "Riverside", "Shinnecock Canal", "Shinnecock Inlet", "Westhampton Beach", "Moriches Inlet", "Bellport", "Patchogue", "Bay Shore", "Fire Island Inlet",
"Babylon", "Amityville", "Jones Beach", "Jones Inlet", "Freeport",
"Long Beach", "East Rockaway", "Rockaway Point *", "New York (The Battery) *", "Manasquan Inlet, NJ *"];
points["chesa"] = ["C & D Canal, East Entrance", "Chesapeake City, MD", "Havre de Grace, MD", "Baltimore, MD", "Chestertown, MD",
"Annapolis, MD", "St. Michaels, MD", "Cambridge, MD", "Solomons, MD",
"Salisbury, MD", "Potomac River mouth", "Washington, DC", "Crisfield, MD", "Fredericksburg, VA", "Cape Charles, VA", "Yorktown, VA", "West Point, VA", "Newport News, VA", "Suffolk, VA", "Hopewell, VA", "Petersburg, VA", "Richmond, VA", "Norfolk, VA", "Chesapeake Bay Entrance"];

var cvalus = new Array(1);
cvalus["Potomac"] = 
["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21"];
cvalus["Delaware"] = 
["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"];
cvalus["Hudson"] = 
["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22"];
cvalus["icwwnj"] = 
["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"];
cvalus["irtny"] = 
["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]; 
cvalus["chesa"] = 
["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"];

function dishudsn()
// Copyright(c) 2000, Blue Heron's Nest - all rights reserved
{
      var hudsn  =  [ [134,132,132,126,126,115,108,102,102,99,89,80,71,66,53,45,38,33,29,25,24,16,0], [118,116,116,110,110,100,93,86,86,83,74,64,55,50,37,29,23,18,14,10,9,0], [110,108,108,102,102,92,85,78,78,75,66,56,47,42,29,21,15,9,6,2,0], 
[110,108,108,102,102,92,85,78,78,75,66,57,48,43,29,22,15,10,6,0],
[106,104,104,98,98,88,80,74,74,71,62,52,43,38,25,17,11,5,0],
[102,100,100,94,94,84,76,70,70,67,58,48,39,34,21,13,6,0],
[96,94,94,88,88,78,71,64,64,61,52,43,34,29,15,8,0],
[89,87,87,81,81,70,63,57,57,54,45,35,26,21,8,0],
[81,79,79,73,73,62,55,49,49,46,37,27,18,13,0],
[68,66,66,60,60,49,42,36,36,33,24,14,5,0],
[63,61,61,55,55,44,37,31,31,28,19,9,0],
[56,54,54,48,48,38,30,24,24,21,12,0],
[46,44,44,38,38,28,21,14,14,11,0],
[37,35,35,29,29,19,11,5,5,0],
[32,30,30,24,24,14,7,1,0],
[32,30,30,24,24,14,6,0],
[26,24,24,18,18,7,0],
[18,16,16,10,10,0],
[8,6,6,0,0],
[8,6,6,0],
[2,0,0],
[2,0],
[0]] ;
        var22 = 22;
        porta = parseInt (document.hudsnports.fpid.value);
        portb = parseInt (document.hudsnports.tpid.value);
//       alert("porta= " +porta+ " portb= " +portb) 

        if (porta == portb) 
         { 
           document.hudsnports.distsm.value = 0
           document.hudsnports.distnm.value = 0 
           document.hudsnports.distkm.value = 0  
         }
	else
         {
	   if (porta < portb)
	    {
	      portb = var22 - portb
//       alert("porta= " +porta+ " portb= " +portb)
        document.hudsnports.distsm.value = Math.round(1.15078 * (hudsn [porta][portb]))
        document.hudsnports.distnm.value =  hudsn [porta][portb]
        document.hudsnports.distkm.value = Math.round(1.852 * (hudsn [porta][portb]))
            }
           else
            {
              portc = porta 
              porta = portb 
              portb = var22 - portc
//       alert("porta= " +porta+ " portb= " +portb)
        document.hudsnports.distsm.value = Math.round(1.15078 * (hudsn [porta][portb]))
        document.hudsnports.distnm.value =  hudsn [porta][portb]
        document.hudsnports.distkm.value = Math.round(1.852 * (hudsn [porta][portb]));
            }
      	  }

}
function disdela()
// Copyright(c) 2005, Blue Heron's Nest - all rights reserved
{
      var delaw  =  [ [115,112,110,103,87,80,72,72,68,62,58,51,54,39,51,33,20,9,6,0], [116,113,111,104,88,81,73,73,69,63,59,52,55,40,52,37,20,14,0], 
[112,109,107,100,84,77,69,69,65,59,55,48,51,36,47,26,21,0], 
[97,94,92,85,69,63,55,55,51,45,40,34,36,21,35,30,0],
[115,112,110,103,87,80,72,72,68,62,58,51,54,39,51,0],
[100,97,95,88,72,65,57,57,53,47,43,36,39,25,0],
[77,74,72,65,49,42,34,34,30,24,20,13,16,0],
[69,66,64,57,41,34,26,26,22,16,12,5,0],
[64,61,59,52,36,29,21,21,17,11,7,0],
[58,55,53,46,30,23,15,15,12,5,0],
[54,51,49,42,26,19,11,11,8,0],
[46,43,41,34,18,12,3,4,0],
[49,46,44,37,22,14,6,0],
[43,40,38,31,15,9,0],
[34,31,29,23,7,0],
[28,25,23,16,0],
[12,9,7,0],
[5,2,0],
[4,0],
[0]] ;
        var19 = 19;
        porta = parseInt (document.delawports.fpid.value);
        portb = parseInt (document.delawports.tpid.value);
//       alert("porta= " +porta+ " portb= " +portb) 

        if (porta == portb) 
         { 
           document.delawports.distsm.value = 0
           document.delawports.distnm.value = 0 
           document.delawports.distkm.value = 0  
         }
	else
         {
	   if (porta < portb)
	    {
	      portb = var19 - portb
//       alert("porta= " +porta+ " portb= " +portb)
        document.delawports.distsm.value = Math.round(1.15078 * (delaw [porta][portb]))
        document.delawports.distnm.value =  delaw [porta][portb]
        document.delawports.distkm.value = Math.round(1.852 * (delaw [porta][portb]))
            }
           else
            {
              portc = porta 
              porta = portb 
              portb = var19 - portc
//       alert("porta= " +porta+ " portb= " +portb)
        document.delawports.distsm.value = Math.round(1.15078 * (delaw [porta][portb]))
        document.delawports.distnm.value =  delaw [porta][portb]
        document.delawports.distkm.value = Math.round(1.852 * (delaw [porta][portb]));
            }
      	  }

}
function dispot()
// Copyright(c) 2005, Blue Heron's Nest - all rights reserved
{
      var potom  =  [ [101,98,96,101,91,84,76,80,68,44,43,38,31,26,27,23,16,13,12,11,11,0], [96,93,90,96,86,79,70,75,63,38,37,33,26,22,22,18,11,6,8,17,0], 
[95,92,89,95,85,78,69,74,62,37,36,32,25,21,21,17,10,8,3,0], 
[93,90,87,93,83,76,68,72,60,35,34,30,23,19,19,15,8,7,0],
[94,91,88,94,84,76,68,72,61,36,35,31,24,19,20,16,9,0],
[85,82,80,85,75,68,60,64,52,28,27,22,15,11,11,7,0],
[80,77,75,80,70,63,55,59,47,22,21,17,10,6,5,0],
[78,75,72,78,68,60,52,57,45,20,19,15,8,6,0],
[79,76,74,79,69,62,54,58,46,21,20,16,9,0],
[71,68,66,71,61,53,45,50,38,13,12,9,0],
[68,65,63,68,58,51,43,47,35,11,10,0],
[63,60,58,63,53,46,38,42,30,6,0],
[58,55,52,58,48,40,32,36,24,0],
[33,30,28,34,24,16,8,12,0],
[33,30,27,33,23,15,7,0],
[26,23,20,26,16,8,0],
[19,16,13,19,9,0],
[10,7,4,10,0],
[14,11,8,0],
[8,5,0],
[3,0],
[0]] ;
        var21 = 21;
        porta = parseInt (document.potomports.fpid.value);
        portb = parseInt (document.potomports.tpid.value);
//       alert("porta= " +porta+ " portb= " +portb) 

        if (porta == portb) 
         { 
           document.potomports.distsm.value = 0
           document.potomports.distnm.value = 0 
           document.potomports.distkm.value = 0  
         }
	else
         {
	   if (porta < portb)
	    {
	      portb = var21 - portb
//       alert("porta= " +porta+ " portb= " +portb)
        document.potomports.distsm.value = Math.round(1.15078 * (potom [porta][portb]))
        document.potomports.distnm.value =  potom [porta][portb]
        document.potomports.distkm.value = Math.round(1.852 * (potom [porta][portb]))
            }
           else
            {
              portc = porta 
              porta = portb 
              portb = var21 - portc
//       alert("porta= " +porta+ " portb= " +portb)
        document.potomports.distsm.value = Math.round(1.15078 * (potom [porta][portb]))
        document.potomports.distnm.value =  potom [porta][portb]
        document.potomports.distkm.value = Math.round(1.852 * (potom [porta][portb]));
            }
      	  }

}
function removeOptions(optionMenu)
{
       optionMenu.options.length = 0;
}

function addOptions(optionList, valueList, optionMenu)
{
 var i=0; var j=-1;
 removeOptions(optionMenu);  // clear out the options
 for (i=0; i < optionList.length; i++)
    {
      j++ 
      optionMenu[j] = new Option(optionList[i], valueList[i]);
    }
}


