//**************************************************************************
// JavaScript for yagi_vhf.html
//**************************************************************************


//**************************************************************************
// Global Variables and Arrays.
//**************************************************************************


var Design_Freq, MM, INCH, Gain, Boom_Dia;
var BC_Val, BC_Val_Default, G1;
var Boom_Type, Mount_Type, Num_Elements, Boom_Length;

var Length_Available, LL, DE_Dia, PE_Dia;
var Refl_Spa, Refl_Len, DE_Len, Boom_Corr, Boom_Corr_1;
var BH, BV, SH, SV, DIMTOL, Dim_Res, Actual_BL;


var Dim_Array = new Array("Inches", "MilliMeters", "WaveLength");
var Boom_Array = new Array("Metalic", "Metalic", "Non_Metalic");
var Mnt_Array = new Array("Bonded", "Insulated", "Insulated");


var Spacing_Array = new Array( 0.0, 0.075, 0.180, 0.215, 0.250, 0.280, 0.300,
   0.315, 0.330, 0.345, 0.360, 0.375, 0.390, 0.400, 0.400 );


var DL6WU_Spacing = new Array( 0.0, 0.075, 0.180, 0.215, 0.250, 0.280, 0.300,
   0.315, 0.330, 0.345, 0.360, 0.375, 0.390, 0.400, 0.400 );


var ARRL_Spacing = new Array( 0.0, 0.065, 0.121, 0.168, 0.250, 0.280, 0.300,
   0.315, 0.330, 0.345, 0.360, 0.375, 0.390, 0.400, 0.400 );


var Total_Dist = new Array();


var El_Dia_K_Array  = new Array ( .001, .003, .005, .007,  .01, .015, .02 );
var El_Dia_K1_Array = new Array ( .4711, .462, .4538, .4491, .4421, .4358, .4268 );
var El_Dia_K2_Array = new Array ( .018, .01941, .02117, .02274, .02396, .02558, .02614 );
var El_Dia_K3_Array = new Array ( .08398, .08543, .0951, .08801, .1027, .1149, .1112 );
var El_Dia_K4_Array = new Array ( .965, .9697, 1.007, .9004, 1.038, 1.034, 1.036 );


var D = new Array ();
var DL = new Array ();
var DH = new Array ();


//**************************************************************************
// Freq, Elements, Gain, BWh, BWv, Boom Dia, BL, El Dia, Stack-v, Stack-h
//**************************************************************************


ARRL_Ant_Specs = new Array (
   144, 12, 12.5, 34.0, 37.0, 1.250,  2.5, 0.2500, 11.0, 10.0,
   222, 16, 14.0, 29.0, 31.0, 1.250,  3.9, 0.1875,  8.9,  8.3,
   432, 22, 17.9, 24.0, 26.0, 1.250,  6.1, 0.1875,   65,   62,
   432, 33, 19.9, 19.0, 19.5, 1.250, 10.8, 0.1875,   83,   81 );


//**************************************************************************
// Element, El Position, El Length, Boom Dia, ..............
//**************************************************************************


ARRL_El_Dims = new Array(
   "REF",    0, 1044, 1.250,    0, 683, 1.250,   30, 346, 0.75,   30, 348, 1.000,
   "DE",   312,  955, 1.250,  204, 664, 1.250,  134, 340, 0.75,  134, 342, 1.000,
   "D1",   447,  962, 1.250,  292, 630, 1.250,  176, 321, 0.75,  176, 323, 1.000,
   "D2",   699,  938, 1.250,  450, 615, 1.250,  254, 311, 0.75,  254, 313, 1.000,
   "D3",  1050,  922, 1.250,  668, 601, 1.250,  362, 305, 0.75,  362, 307, 1.000,
   "D4",  1482,  912, 1.250,  938, 594, 1.250,  496, 301, 0.75,  496, 303, 1.000,
   "D5",  1986,  904, 1.375, 1251, 588, 1.250,  652, 297, 0.75,  652, 299, 1.000,
   "D6",  2553,  898, 1.375, 1602, 583, 1.250,  828, 295, 0.75,  828, 297, 1.000,
   "D7",  3168,  894, 1.375, 1985, 580, 1.375, 1020, 293, 0.75, 1020, 295, 1.000,
   "D8",  3831,  889, 1.250, 2395, 576, 1.375, 1226, 291, 0.75, 1226, 293, 1.000,
   "D9",  4527,  885, 1.250, 2829, 572, 1.375, 1444, 289, 0.75, 1444, 291, 1.000,
   "D10", 5259,  882, 1.250, 3283, 569, 1.375, 1672, 288, 1.00, 1672, 290, 1.125,
   "D11",    0,    0, 0.000, 3755, 565, 1.250, 1909, 286, 1.00, 1909, 288, 1.125,
   "D12",    0,    0, 0.000, 4243, 563, 1.250, 2152, 285, 1.00, 2152, 287, 1.125,
   "D13",    0,    0, 0.000, 4745, 561, 1.250, 2403, 284, 1.00, 2403, 286, 1.125,
   "D14",    0,    0, 0.000, 5259, 560, 1.250, 2659, 283, 1.00, 2659, 285, 1.125,
   "D15",    0,    0, 0.000,    0,   0, 0.000, 2920, 281, 0.75, 2920, 284, 1.125,
   "D16",    0,    0, 0.000,    0,   0, 0.000, 3184, 280, 0.75, 3184, 284, 1.250,
   "D17",    0,    0, 0.000,    0,   0, 0.000, 3452, 279, 0.75, 3452, 283, 1.250,
   "D18",    0,    0, 0.000,    0,   0, 0.000, 3723, 278, 0.75, 3723, 282, 1.250,
   "D19",    0,    0, 0.000,    0,   0, 0.000, 3997, 277, 0.75, 3997, 281, 1.250,
   "D20",    0,    0, 0.000,    0,   0, 0.000, 4272, 276, 0.75, 4272, 280, 1.250,
   "D21",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 4550, 278, 1.125,
   "D22",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 4828, 278, 1.125,
   "D23",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 5109, 277, 1.125,
   "D24",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 5390, 277, 1.125,
   "D25",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 5672, 276, 1.125,
   "D26",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 5956, 275, 1.000,
   "D27",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 6239, 274, 1.000,
   "D28",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 6524, 274, 1.000,
   "D29",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 6809, 273, 1.000,
   "D30",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 7094, 273, 1.000,
   "D31",    0,    0, 0.000,    0,   0, 0.000,    0,   0, 0.00, 7380, 272, 1.000 );




//**************************************************************************
// Get the required design frequency and calculate the wavelengths in
// Metric and US/Imperial dimensions.
//**************************************************************************


function Design_Init() {


   if (document.yagi_vhf_1.UM.options[0].selected) {
      Design_Freq = document.yagi_vhf_1.Des_Freq.value * 1000; }
   else { Design_Freq = document.yagi_vhf_1.Des_Freq.value; }


   MM = 299793/Design_Freq;      // Wavelength in Millimeters
   INCH = 11802.9/Design_Freq;   // Wavelength in Inches


   FG_BL_Est = "The Driven and Parasitic elements should be\n";
   FG_BL_Est += "limited to between 0.001 and 0.02 wavelengths.\n\n";
   FG_BL_Est += Rnd(0.001*INCH,3) + "\" (" + DIN2FIN(0.001*INCH, 64) + ") --> ";
//   FG_BL_Est += "  * " + Rnd(0.001*INCH,3) + "\" (" + DIN2FIN(0.001*INCH, 64) + ") --> ";
   FG_BL_Est += Rnd(0.02*INCH,3) + "\" (" + DIN2FIN(0.02*INCH,64) + ")\n";
//   FG_BL_Est += "  * " + Rnd(0.001*MM,3) + " mm --> " + Rnd(0.02*MM,3) + " mm";
   FG_BL_Est += Rnd(0.001*MM,3) + " mm ----> " + Rnd(0.02*MM,3) + " mm";


   document.getElementById("El_Dia_Freq").innerHTML = F_Scale(Design_Freq*1000000, 3, "On");
   document.getElementById("El_Dia_Min").innerHTML = Rnd(0.001*INCH,3) + "\" (" + DIN2FIN(0.001*INCH, 64) + ")";
   document.getElementById("El_Dia_Max").innerHTML = Rnd(0.02*INCH,3) + "\" (" + DIN2FIN(0.02*INCH,64) + ")";
   document.getElementById("El_Dia_Min_Metric").innerHTML = Rnd(0.001*MM,3) + " mm";
   document.getElementById("El_Dia_Max_Metric").innerHTML = Rnd(0.02*MM,3) + " mm";




///   document.yagi_vhf_1.DE_PE_Msg.value = FG_BL_Est;


   for (var J = 0; J <= 14; J++) {
      if (document.yagi_vhf_1.Dir_El_Spa.options[0].selected) {
         Spacing_Array[J] = DL6WU_Spacing[J]; }
      else {
         Spacing_Array[J] = ARRL_Spacing[J]; }
      }


   BL_G_Calc();
//   Sample_Text();
   Design_Text();
}


//**************************************************************************
// If Gain is specicied, get the required gain value and calculate the
// approximate boom length.
//
// If Boom length is specified, get the required boom length and calculate
// the approximate gain.
//**************************************************************************


function BL_G_Calc() {


   FG_BL_Val = document.yagi_vhf_1.FG_BL_Val.value;


   if (document.yagi_vhf_1.FG_BL.options[0].selected) {
      //********************************************************************
      // Foward Gain Specified.
      //********************************************************************


      FG_BL = "Gain";
      Gain = FG_BL_Val;


      //********************************************************************
      // Calculate the Boom Length required for a specific Gain.
      //********************************************************************


      Boom_Length = Math.exp((Gain-9.2)/3.39);
      B1 = Boom_Length*INCH;                //Boom length in in.
      B2 = Boom_Length*MM;                  //Boom length in mm
      B3 = B1/12;                           //Boom length in ft


      FG_BL_Est = "For <B>" + Rnd(Gain,1) + " dBd Gain</B>, the <B>Estimated Boom Length</B> is ";
      FG_BL_Est += "<B>" + Rnd(Boom_Length,3) + " Wavelengths</B>, which is <B>";
      FG_BL_Est += Rnd(B1,1) + "\" (";
      FG_BL_Est += Rnd(B2,0) + "&nbsp;mm)</B>";


      //********************************************************************
      // Limit Boom Length if the specified Gain is to high.
      //********************************************************************


      if ( Boom_Length > 39 ) {
         document.yagi_vhf_1.FG_BL_Est.value = "Calculating, Please Wait.\n";


         FG_BL_Est = "The specified <B>Gain</B> of <B>" + Gain + " dBd</B> requires a <B>Boom ";
         FG_BL_Est += "Length</B> <B>" + Rnd(Boom_Length,3) + " Wavelengths</B>. This is ";
         FG_BL_Est += "beyond the scope of this program. Please limit the <B>Boom ";
         Boom_Length = 39;
         Gain = Rnd(9.2+3.39*Math.log(Boom_Length),1);
         FG_BL_Est += "Length</B> to <B>" + Boom_Length + " Wavelengths</B> and <B>Gain</B> to <B>";
         FG_BL_Est += Rnd(Gain,1) + " dBd</B>.";
         }
      else {
         FG_BL_Est += "\n"; }


      Ele_Spacing();
      Actual_Gain = 9.2+3.39*Math.log(Actual_BL);
      }
   else {
      //********************************************************************
      // Boom Length Specified. Calculate the Gain based on the Boom Length.
      //********************************************************************


      FG_BL = "Length";


      if (document.yagi_vhf_1.FG_BL.options[1].selected) {
         Boom_Length = FG_BL_Val/INCH;
         Gain = 9.2+3.39*Math.log(Boom_Length);
         FG_BL_Est = "A <B>" + Rnd(Boom_Length*INCH,1) + " Inch Boom</B> should have an <B>Estimated"; }
      else if  (document.yagi_vhf_1.FG_BL.options[2].selected) {
         Boom_Length = FG_BL_Val/MM;
         Gain = 9.2+3.39*Math.log(Boom_Length);
         FG_BL_Est = "A <B>" + Rnd(Boom_Length*MM,1) + " mm Boom</B> should have an <B>Estimated"; }
      else if  (document.yagi_vhf_1.FG_BL.options[3].selected) {
         Boom_Length = FG_BL_Val;
         Gain = 9.2+3.39*Math.log(Boom_Length);
         FG_BL_Est = "A <B>" + Rnd(Boom_Length,1) + " Wavelength Boom</B> should have an <B>Estimated\n"; }


      //FG_BL_Est += "Gain of " + Rnd(Gain,3) + " dBd, however, the maximum number\n";
      //FG_BL_Est += "of director elements that will fit on this boom\n";


      //********************************************************************
      // Limit Boom Length if the specified Gain is to high.
      //********************************************************************


      if ( Boom_Length > 39 ) {
         document.yagi_vhf_1.FG_BL_Est.value = "Calculating, Please Wait.\n";


         //FG_BL_Est += "Gain of " + Rnd(Gain,3) + " dBd.\n\n";
         FG_BL_Est = "The  specified  <B>Boom  Length</B> of <B>" + Boom_Length + " Wavelengths</B> ";
         FG_BL_Est += "should have a <B>Gain</B> of <B>" + Rnd(Gain,3) + " dBd</B>. This is "
         FG_BL_Est += "beyond the scope of this program. Please limit the ";
         Boom_Length = 39;
         Gain = Rnd(9.2+3.39*Math.log(Boom_Length),1);
         FG_BL_Est += "<B>Boom Length</B> to <B>" + Boom_Length + " Wavelengths</B> and <B>Gain</B> to<B> ";
         FG_BL_Est += Rnd(Gain,1) + " dBd<B>.";
         Ele_Spacing();
         Actual_Gain = 9.2+3.39*Math.log(Actual_BL);
         }
      else {
         FG_BL_Est += "Gain</B> of <B>" + Rnd(Gain,3) + " dBd</B>. The maximum number of\n";
         FG_BL_Est += "director elements that will fit on this boom\n";
         Ele_Spacing();
         Actual_Gain = 9.2+3.39*Math.log(Actual_BL);
         FG_BL_Est += "length is <B>" + Num_Elements + "</B>, for a <B>Actual Gain</B> of <B>";
         FG_BL_Est += Rnd(Actual_Gain,3) + " dBd</B>.\n\n";
         }
      }


//   FG_BL_Est += "Gain should be between to 11.8 dBd and 21.6 dBd.\n";
//   FG_BL_Est += "Boom  Length  should  be  between  2.2  and  39\nWavelengths.";


   document.getElementById("Gain_Length_Est").innerHTML = FG_BL_Est;


//   document.yagi_vhf_1.FG_BL_Est.value = FG_BL_Est;


   Set_Boom_Info();
}


//**************************************************************************
// Set boom information when boom type is selected.
//**************************************************************************


function Set_Boom_Info() {
   for (var I = 0; I < document.yagi_vhf_1.El_Mount.options.length; I++) {
      if (document.yagi_vhf_1.El_Mount.options[I].selected) {
         Boom_Type = Boom_Array[I];
         Mount_Type = Mnt_Array[I]; }
   }


   BC_Calc();
}


//**************************************************************************
// Calculate Boom Correction.
//**************************************************************************


function BC_Calc() {


   Boom_Dia = document.yagi_vhf_1.Boom_Dia.value;


   //***********************************************************************
   // Get the unit of measure for the Boom Diameter and convert to
   // wavelength.
   //***********************************************************************


   if (document.yagi_vhf_1.BD_Unit.options[0].selected) { BD_WL = Boom_Dia/INCH; }
   else { BD_WL = Boom_Dia/MM; }


   //***********************************************************************
   // Calculate the Boom Correction based on the Boom Diameter specified.
   //***********************************************************************


   Boom_Corr = 733*BD_WL*(.055-BD_WL) - 504*BD_WL*(.03-BD_WL);


   //***********************************************************************
   // Make an adjustment to the Boom Correction based on the
   // type of boom and the element mounting.
   //***********************************************************************


   if (document.yagi_vhf_1.El_Mount.options[0].selected) {
      BC_Val = Rnd(Boom_Corr,4);
      BC_Val_Default = Rnd(Boom_Corr,4);
      Boom_Info = "A Metalic Boom with Bonded Elements and with \n";
      document.getElementById("Boom_Sel_Type").innerHTML = "Metalic";
      document.getElementById("Boom_Sel_Mtg").innerHTML = "Bonded";
      }
   else if (document.yagi_vhf_1.El_Mount.options[1].selected) {
      BC_Val = Rnd(Boom_Corr/2,4);
      BC_Val_Default = Rnd(Boom_Corr/2,4);
      Boom_Info = "A Metalic Boom with Insulated Elements and with \n";
      document.getElementById("Boom_Sel_Type").innerHTML = "Metalic";
      document.getElementById("Boom_Sel_Mtg").innerHTML = "Insulated";
      }
   else if (document.yagi_vhf_1.El_Mount.options[2].selected) {
      BC_Val = "0";
      BC_Val_Default = "0";
      Boom_Info = "A Non-Metalic Boom with Insulated Elements and with \n";


      document.getElementById("Boom_Sel_Type").innerHTML = "Non-Metalic";
      document.getElementById("Boom_Sel_Mtg").innerHTML = "Insulated";
      }


   //***********************************************************************
   // Output the Boom Correction information in the text window.
   //***********************************************************************


   Boom_Info += "a diameter of " + Rnd(BD_WL*INCH,2) + "\"";
   Boom_Info += " = " + Rnd(BD_WL*MM,1) + " mm";
   Boom_Info += " = " + Rnd(BD_WL,4) + " Wavelengths\n";
   Boom_Info += "has a calculated Boom Correction of " + Rnd(BC_Val,4) + " .";


   document.getElementById("Boom_Sel_Lambda").innerHTML = Rnd(BD_WL,2) + " Wavelengths";
   document.getElementById("Boom_Sel_Dia").innerHTML = Rnd(BD_WL*INCH,2) + "\" (" + Rnd(BD_WL*MM,1) + "&nbsp;mm)";
   document.getElementById("Boom_Sel_Corr").innerHTML = Rnd(BC_Val,4);


   Boom_Info += "Boom Diameter should be limited to\n";
   Boom_Info += Rnd((0.06*INCH)/12,3) + "'";
   Boom_Info += " = " + Rnd(0.06*INCH,1) + "\"";
   Boom_Info += " = " + Rnd(0.06*MM,1) + " mm";
   Boom_Info += " = " + Rnd(0.06,2) + " Wavelengths";


   document.getElementById("Boom_Sel_Max_Lambda").innerHTML = Rnd(0.06,2) + " Wavelengths";
   document.getElementById("Boom_Sel_Max_Dia").innerHTML = Rnd(0.06*INCH,1) + "\" (" + Rnd(0.06*MM,1) + "&nbsp;mm)";


//   document.yagi_vhf_1.Boom_Info.value = Boom_Info;


   //***********************************************************************
   // Strip off the individual digits of the Boom Correction and set the
   // initial values in the Boom Correction select boxes.
   //***********************************************************************


   BC_Tenths = Math.floor(BC_Val*10);
   document.yagi_vhf_1.BC_Tenths.selectedIndex = BC_Tenths;


   BC_Hundreds = Math.floor((Rnd(BC_Val-(BC_Tenths/10),4))*100);
   document.yagi_vhf_1.BC_Hundreds.selectedIndex = BC_Hundreds;


   BC_Thou = Math.floor((Rnd(BC_Val-(BC_Tenths/10)-(BC_Hundreds/100),4))*1000);
   document.yagi_vhf_1.BC_Thou.selectedIndex = BC_Thou;


   BC_Ten_Thou = Math.floor((Rnd(BC_Val-(BC_Tenths/10)-(BC_Hundreds/100)-(BC_Thou/1000),4))*10000);
   document.yagi_vhf_1.BC_Ten_Thou.selectedIndex = BC_Ten_Thou;


   Set_BC_Val();

}


//**************************************************************************
// Adjust the Boom Correction value based on the Boom Correction select
// boxes.
//**************************************************************************


function Set_BC_Val() {
   //***********************************************************************
   // Decode the Boom Correction from the numbers selected in the Boom
   // Correction select boxes.
   //***********************************************************************


   for (var I = 0; I < 10; I++) {
      if (document.yagi_vhf_1.BC_Tenths.options[I].selected) {
         BC_Tenths = document.yagi_vhf_1.BC_Tenths.options[I].value; }
      if (document.yagi_vhf_1.BC_Hundreds.options[I].selected) {
         BC_Hundreds = document.yagi_vhf_1.BC_Hundreds.options[I].value; }
      if (document.yagi_vhf_1.BC_Thou.options[I].selected) {
         BC_Thou = document.yagi_vhf_1.BC_Thou.options[I].value; }
      if (document.yagi_vhf_1.BC_Ten_Thou.options[I].selected) {
         BC_Ten_Thou = document.yagi_vhf_1.BC_Ten_Thou.options[I].value; }
   }


   BC_Val = BC_Tenths/10 + BC_Hundreds/100 + BC_Thou/1000 + BC_Ten_Thou/10000;


   //***********************************************************************
   // Output a message to the text box based on the value in the Boom
   // Correction select boxes.
   //***********************************************************************


   if ( Rnd(BC_Val,4) == Rnd(BC_Val_Default,4) ) {
      BC_Msg_Info = "the <B>default</B> calculated value for the Boom\n";
      BC_Msg_Info += "Correction is selected.";
      document.getElementById("BC_Selected").innerHTML = BC_Msg_Info;
      }
   else {
      BC_Msg_Info = "a <B>user selected</B> Boom Correction value of\n";
      BC_Msg_Info += "<B>" + Rnd(BC_Val,4) + "</B> is being used.";
      document.getElementById("BC_Selected").innerHTML = BC_Msg_Info;
      }


//   document.yagi_vhf_1.BC_Msg.value = BC_Msg_Info;


   //Ele_Spacing();
   Ant_Calc();
}


//**************************************************************************
// Calculate the spacing of the elements along the boom.
//**************************************************************************


function Ele_Spacing() {
   Num_Elements = 0; SY = 1;


   //***********************************************************************
   // Reflector spacing. 0.2 per DL6WU and 0.20 per ARRL.
   //***********************************************************************


   if (document.yagi_vhf_1.Refl_Spa.options[0].selected) { Refl_Spa = 0.2; }
   else if (document.yagi_vhf_1.Refl_Spa.options[1].selected) { Refl_Spa = 0.19; }
   else if (document.yagi_vhf_1.Refl_Spa.options[2].selected) { Refl_Spa = 0.18; }
   else if (document.yagi_vhf_1.Refl_Spa.options[3].selected) { Refl_Spa = 0.17; }
   else if (document.yagi_vhf_1.Refl_Spa.options[4].selected) { Refl_Spa = 0.16; }
   else { Refl_Spa = 0.15; }


   //***********************************************************************
   // If Foward Gain is specified, increase Boom Length until specified gain
   // is met or exceeded. If Boom Length is specified, only go through loop
   // once.
   //***********************************************************************


   if (document.yagi_vhf_1.FG_BL.options[0].selected) { Loop = 1; }
   else { Loop = 0; }


   Do_Loops = 1;


   do {
      //********************************************************************
      // Subtract reflector spacing from the calculated boom length.
      //********************************************************************


      Length_Available = Boom_Length - Refl_Spa;


      //********************************************************************
      // Calculate element spacing for first 14 directors.
      //********************************************************************


      for ( var I = 1; I <= 14; I++ ) {


         //*****************************************************************
         // Total distance from reflector. This calculation is only used for
         // outputing the Cumulative Spacing column on the completed design.
         //*****************************************************************


         if ( I == 1 ) Total_Dist[I] = Refl_Spa + Spacing_Array[I];
         else Total_Dist[I] = Total_Dist[I-1] + Spacing_Array[I];


         //*****************************************************************
         // Subtract from boom length.
         //*****************************************************************


         Length_Available = Length_Available - Spacing_Array[I];


         if ( Length_Available < 0 ) {
            //**************************************************************
            // This IF statement is here to compensate for a oddity in the
            // original basic. In the original basic, if we run out of boom
            // length before we reach I==14, Spacing_Array[14] has not been
            // read and is zero. A RESTORE statement after the element spacing
            // calculations re-synchronizes the READ for the element length
            // array read. In JavaScript, with the array already loaded,
            // Spacing_Array[14] is defined. This can change number of
            // director elements for yagi arrays that are less than 14
            // elements.
            //
            // As a simple example, relying mostly on defaults, a antenna
            // for 144 MHz was calculated. The following entries were used:
            //    Gain = 12 dBd
            //    Boom Diameter = 2 inches
            //    Metal Boom with elements Bonded to boom
            //    Driven and Parasitic Element Diameters = 0.25 inches
            //
            // The basic program calculates a Yagi with 10 elements,
            // however, the JavaScript program calculates a Yagi with 11
            // elements.
            //**************************************************************


            SY = Length_Available;


            //if ( I == 14 ) {
            //   Length_Available = Length_Available + Spacing_Array[I];
            //   }


            Num_Elements = I - 1;
            I = 14;
            Length_Available += Spacing_Array[I];
            }
         }


      if ( SY >= 0 ) {
         for (var N = 15; N <= 100; N++) {
            Spacing_Array[N] = Spacing_Array[14];
            Total_Dist[N] = Total_Dist[N-1] + Spacing_Array[N];


            Length_Available = Length_Available - Spacing_Array[N];      // Subtract from boom length


            Num_Elements = N - 1;
            if ( Length_Available < 0 ) {
               Num_Elements = N - 1;
               Length_Available = Length_Available + Spacing_Array[N];
               N = 100;
               }
            }
         }


      Actual_BL = Total_Dist[Num_Elements];


      //********************************************************************
      // Boom length from reflector to last director.
      //********************************************************************


      LL = Boom_Length - Length_Available;


      //********************************************************************
      // Re-estimate gain from active boom length.
      //********************************************************************


      G1 = 9.2 + 3.39 * Math.log(LL);


      //if ( G1 < 11.8 ) {
      //   Boom_Length = 1.05 * Boom_Length;
      //   }


      if ( G1 < Gain && Loop == 1 ) {
         Boom_Length = 1.05 * Boom_Length;
         }


      Do_Loops += 1;


   //} while ( G1 < 11.8 )   //end do-while loop
   } while ( G1 < Gain && Loop == 1 )   //end do-while loop
}


//**************************************************************************
// Calculate the antenna dimensions based on previously entered data.
//**************************************************************************


function Ant_Calc() {
   //***********************************************************************
   // Get the user entered element diameters and convert to wavelengths.
   //***********************************************************************


   if (document.yagi_vhf_1.DE_Unit.options[0].selected) {
      DE_Dia = document.yagi_vhf_1.DE_Dia.value/INCH; }
   else { DE_Dia = document.yagi_vhf_1.DE_Dia.value/MM; }


   if (document.yagi_vhf_1.PE_Unit.options[0].selected) {
      PE_Dia = document.yagi_vhf_1.PE_Dia.value/INCH; }
   else { PE_Dia = document.yagi_vhf_1.PE_Dia.value/MM; }


   //***********************************************************************
   // Determine the Boom Type and Element Mounting from the select box.
   //***********************************************************************


   for (var I = 0; I < document.yagi_vhf_1.El_Mount.options.length; I++) {
      if (document.yagi_vhf_1.El_Mount.options[I].selected) {
         Boom_Type = Boom_Array[I];
         Mount_Type = Mnt_Array[I]; }
      }


   //document.yagi_vhf_1.Boom_Type.value = Boom_Type;
   //document.yagi_vhf_1.Mount_Type.value = Mount_Type;


   L = 0;H = 0;
   for ( var I = 1; I <= 7; I++ ) {
      K = El_Dia_K_Array[I-1];
      K1 = El_Dia_K1_Array[I-1]; K2 = El_Dia_K2_Array[I-1];
      K3 = El_Dia_K3_Array[I-1]; K4 = El_Dia_K4_Array[I-1];


      if ( K <= PE_Dia ) {
         L = K;
         KL1 = El_Dia_K1_Array[I-1]; KL2 = El_Dia_K2_Array[I-1];
         KL3 = El_Dia_K3_Array[I-1]; KL4 = El_Dia_K4_Array[I-1];
         }


      if ( K >= PE_Dia ) {
         H = K;
         KH1 = El_Dia_K1_Array[I-1]; KH2 = El_Dia_K2_Array[I-1];
         KH3 = El_Dia_K3_Array[I-1]; KH4 = El_Dia_K4_Array[I-1];
         I = 7;
         }
      }
   J = ( PE_Dia - L ) / ( H - L );


   for ( var I = 1; I <= Num_Elements; I++ ) {
      if ( J == 0 ) {
         D[I] = (K1-K2*Math.log(I))*(1-K3*Math.exp(-K4*I));
         }
      else {
         DL[I]=(KL1-KL2*Math.log(I))*(1-KL3*Math.exp(-KL4*I));
         DH[I]=(KH1-KH2*Math.log(I))*(1-KH3*Math.exp(-KH4*I));
         D[I] = DL[I]+J*(DH[I]-DL[I]);
         }
      D[I] = D[I] + (eval(BC_Val)*BD_WL);
      }


   //***********************************************************************
   // Reflector length.
   //***********************************************************************


   Refl_X = 20;
   Refl_Len = (((Refl_X-40)/(186.77*Math.log(2/PE_Dia)-320)) + 1)/2;
   Refl_Len = Refl_Len + (eval(BC_Val)*BD_WL);


   //***********************************************************************
   // Driven element length.
   //***********************************************************************


   DE_Len = (.4777-(1.0522*DE_Dia)+(.43363*(Math.pow(DE_Dia,-.014891))))/2;
   DE_Len = 1.02 * DE_Len;


   //***********************************************************************
   // Correlation from published patterns of DL6WU yagis
   //***********************************************************************


   BH = 30 - 3.14 * (G1-14);


   //***********************************************************************
   // Over-estimates BV for shorter yagis.
   //***********************************************************************


   BV = BH / Math.cos(BH/(2*57));
   SH = 51 / BH;
   SV = 51 / BV;
   DIMTOL = .003;
}


//**************************************************************************
// Fill in the text area below the Antenna Design Viewing selection box based
// on the dimensions required.
//**************************************************************************


function Design_Text() {
   if (document.yagi_vhf_1.Dim_View_Type.options[0].selected) {
      Desg_Text = "Press the View button to view the current\n";
      Desg_Text += "design in US/Imperial dimensions.\n\n"; }
   else {
      Desg_Text = "Press the View button to view the current\n";
      Desg_Text += "design in Metric dimensions.\n\n"; }


   Actual_Gain = 9.2+3.39*Math.log(Actual_BL);


//   Desg_Text += "The current design is an antenna for " + Design_Freq + " MHz.\n";
//   Desg_Text += "It has 1 Reflector, 1 Driven, and ";
//   Desg_Text += Num_Elements + " Director\nElements. ";
//   Desg_Text += "Estimated Gain is " + Rnd(Actual_Gain,3) + " dBd.";


   document.getElementById("View_Freq").innerHTML = F_Scale(Design_Freq*1000000, 3, "On");
   document.getElementById("View_Num_Refl").innerHTML = "1";
   document.getElementById("View_Num_Driv").innerHTML = "1";
   document.getElementById("View_Num_Dir").innerHTML = Num_Elements;
   document.getElementById("View_Gain").innerHTML = Rnd(Actual_Gain,3);


//   document.yagi_vhf_1.View_Msg.value = Desg_Text;
}


function View_Design() {
   if (document.yagi_vhf_1.Dim_View_Type.options[0].selected) {
      View_Des_US(); }
   else { View_Des_Metric(); }
}


//**************************************************************************
// Display window with design information using Metric dimensions.
//**************************************************************************


function View_Des_Metric() {
   Ant_Calc();


   Des_Win_M=window.open('','Des_Win_M',
      'menubar=yes,resizable=yes,scrollbars=yes,status=yes');


   with (Des_Win_M.document) {
      write("<HTML>\n")
      write("<HEAD>\n")
      write("<title>" + Design_Freq + " MHz Yagi Design Details (Metric)</title>\n")
      write("<link rel=stylesheet type=\"text/css\" href=\"../../css/dg.css\">\n")
      write("</HEAD>\n\n")
      write("<BODY bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\n\n")


      write("<table width=\"100%\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"black\">\n")
      write("  <tr valign=\"center\">\n")
      write("    <td align=center width=50%>\n")
      write("    <!----------your logo goes here---------->\n")
      write("    <img src=\"../../images/K7MEM_Logo.jpg\" border=\"0\" alt=\"\"></td>\n")
      write("    <!--------------------------------------->\n")
      write("    <td align=center width=50%><P class=std_16_aqua ALIGN=\"center\">Javascript Electronic Notebook<BR>\n")
      write("    <font color=\"#fff2d2\">")
      write("" + Design_Freq + " MHz Yagi Design Details (Metric)<BR>\n")
      write("    " + (Num_Elements+2) + " Elements, " + Rnd(9.2 + 3.39 * Math.log(Actual_BL),1) + " dBd Estimated Gain</font><BR>\n")
      write("    by Martin E. Meserve</td>\n")
      write("  </tr>\n")
      write("</table>\n\n")


      write("<table width=\"100%\" height=\"19\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../design/topgrbg.gif\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td align=right width=\"100%\" background=\"../../design/topgrbg.gif\">\n")
      write("</td></tr></table>\n\n")


      write("<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\" align=\"center\">\n")
      write("  <TR>\n")
      write("    <TD bgcolor=\"#000000\" HEIGHT=\"1\">\n")
      write("      <TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n")
      write("        <TR>\n")
      write("          <TD>\n")
      write("      </TD></TR></TABLE>\n")
      write("</TD></TR></TABLE>\n\n")


      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td bgcolor=\"#C6F7BD\" width=50%>\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Design Synopsys</P>\n")
      write("    <P class=\"std_10_bold\">" + Design_Freq, " MHz, ", Num_Elements + 2, " Elements, ")
      write(Rnd(9.2 + 3.39 * Math.log(Actual_BL),3) + " dBd Estimated Gain</P>\n")


      if (document.yagi_vhf_1.FG_BL.options[0].selected) {
         //*****************************************************************
         // Check if specified Gain is within limits.
         //*****************************************************************
         if ( document.yagi_vhf_1.FG_BL_Val.value > 21.6 ) {
            write("<P class=\"special\">\n")
            write("  <B>Warning: The specified Gain of ", document.yagi_vhf_1.FG_BL_Val.value ," dBd to <I>Large</I>.<BR>\n")
            write("  Gain should be less than 21.6 dBd.</B>\n")
            }
         else if ( document.yagi_vhf_1.FG_BL_Val.value < 11.8 ) {
            write("<P class=\"special\">\n")
            write("  <B>Warning: The specified Gain of ", document.yagi_vhf_1.FG_BL_Val.value ," dBd to <I>Small</I>.<BR>\n")
            write("  Gain should be greater than 11.8 dBd.</B>\n")
            }
         }
      else {
         if ( Boom_Length > 39 ) {
            write("<P class=\"special\">\n")
            write("  <B>Warning: The specified Boom Length of ", Boom_Length ," Wavelengths is to <I>Large</I>.\n")
            write("  Boom Length should be less than 39 Wavelengths.</B>\n")
            }
         else if ( Boom_Length < 2.2 ) {
            write("<P class=\"special\">\n");
            if (document.yagi_vhf_1.FG_BL.options[1].selected) {
               write("  <B>Warning: The specified Boom Length of ");
               write(document.yagi_vhf_1.FG_BL_Val.value ," Inches is to <I>Small</I>.\n") }
            else if (document.yagi_vhf_1.FG_BL.options[2].selected) {
               write("  <B>Warning: The specified Boom Length of ");
               write(document.yagi_vhf_1.FG_BL_Val.value ," Millimeters is to <I>Small</I>.\n") }
            else {
               write("  <B>Warning: The specified Boom Length of ");
               write(document.yagi_vhf_1.FG_BL_Val.value ," Wavelengths is to <I>Small</I>.\n") }
            write("  Boom Length should be greater than 2.2 Wavelengths.</B>\n")
            }
         }


      write("    <P class=\"std_10_bold\">", Rnd(BH,1), " Degrees <I>Horizontal</I> Beam Width\n")
      write("    <P class=\"std_10_bold\">", Rnd(BV,1), " Degrees <I>Vertical</I> Beam Width\n")


      write("    <P class=\"std_10_bold\">")
      if ( Boom_Type == "Metalic" & Mount_Type == "Bonded") {
         write("" + Rnd(BD_WL*MM,2) + " mm Diameter, <I>Metalic</I> ");
         write("Boom with <I>Bonded</I> Elements. ");
         write("Boom Correction of ", Rnd(BC_Val,3), " applied.\n" );
         }
      else if ( Boom_Type == "Metalic" & Mount_Type == "Insulated") {
         write("<B>", Rnd(BD_WL*MM,2) + " mm Diameter, <I>Metalic</I> Boom with <I>Insulated</I> Elements. ");
         write("Boom Correction of ", Rnd(BC_Val,3), " applied.</B>\n" );
         }
      else {
         write("<B>N/A Diameter, <I>Non-Metalic</I> Boom with <I>Insulated</I> Elements. ");
         write("<I>N0</I> Boom Correction applied.</B>\n" );
         }


      if ( Boom_Type == "Metalic" && BD_WL > 0.06 ) {
         write("    <P class=\"special\"><B>Warning: Boom Diameter is too large. ")
         write("The Diameter of a Metalic Boom should be less than " + Rnd(0.06*MM,3) + " mm</B>")
         }


      write("    <P class=\"std_10_bold\"><B>Electrical Boom Length of " + Rnd(Boom_Length*MM,1) + " mm.<BR>")
      write("Allow for overhang when cutting boom to length.</B>\n")


      write("    <P class=\"std_10_bold\"><B>" + Rnd(DE_Dia*MM,3) + " mm Driven Element Diameter.</B>\n");


      if ( DE_Dia < 0.001 ||  DE_Dia > 0.02 ) {
         write("    <P class=\"special\"><B>Warning: The Driven Element Diameter is Incorrect. ");
         write("The Driven Element Diameter should be between " + Rnd(0.001*MM,1) + " mm ");
         write("and " + Rnd(0.02*MM,1) + " mm.</B>\n");
         }


      write("    <P class=\"std_10_bold\"><B>" + Rnd(PE_Dia*MM,3) + " mm Parasitic Element Diameter.</B></blockquote>\n")


      if ( PE_Dia < 0.001 || PE_Dia > 0.02 ) {
         write("    <P class=\"special\"><B>Warning: The Parasitic Element Diameters are Incorrect. ");
         write("The Parasitic Element Diameters should be between " + Rnd(0.001*MM,1) + " mm ");
         write("and " + Rnd(0.02*MM,1) + " mm.</B>\n")
         }


      write("    <P class=\"std_10_bold\"><B>Suggested Stacking Distance for 2 Yagis:</B></FONT>\n")
      write("      <UL>\n")
      write("        <P class=\"std_10_bold\"><B>" + Rnd(SH*MM,1) + " mm Horizontally</B>\n")
      write("        <P class=\"std_10_bold\"><B>" + Rnd(SV*MM,1) + " mm Vertically</B>\n")
      write("      </UL>\n")


      write("    <P class=\"std_10_bold\"><B>" + Rnd(DIMTOL*MM,1) + " mm ");
      write("Dimensional tolerance required for element lengths.</B>\n");


      write("    </td>\n\n")


      write("    <td valign=top>\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Antenna Dimensions\n")


      write("    <TABLE ALIGN=CENTER border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=100%>\n")


      write("      <TR>\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_red\">&nbsp;\n")
      write("        <TD valign=center align=center>&nbsp;\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")


      write("      <TR>\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_blue\">Cumulative<BR>Spacing (mm)\n")
      write("        <TH COLSPAN=2><P class=\"std_bold_blue\">\Element</FONT>\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_blue\">Element<BR>Length (mm)\n")


      write("      <TR>\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">Zero\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_red\">REFL\n")
      write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_ref.jpg\" ALIGN=center>\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">" + Rnd(Refl_Len*MM,2)+ "\n")


      write("      <TR>\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">" + Rnd(Refl_Spa*MM,2)+ "\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_red\">D.E.\n")
      write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_de.jpg\" ALIGN=center>\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">" + Rnd(DE_Len*MM,2)+ "\n")


      for (K = 1; K <= Num_Elements; K++) {
         write("      <TR>\n");
         write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">" + Rnd(Total_Dist[K]*MM,2) + "\n");
         write("        <TH COLSPAN=1><P class=\"std_bold_red\">D", K, "\n");
         write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_dir.jpg\" ALIGN=center>\n")
         write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">" + Rnd(D[K]*MM,2)+ "\n");
         }


      write("      <TR>\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_red\">&nbsp;\n")
      write("        <TD valign=center align=center>&nbsp;\n")
      write("        <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")


      write("    </table>\n")
      write("</table>\n")


      write("</body>\n")
      write("</html>\n")


      close()
      } // End of "with (Des_Win_M.document)" statement
 }


//**************************************************************************
// Display window with design information using US/Imperial dimensions.
//**************************************************************************


function View_Des_US() {
   Ant_Calc();


   Dim_Res = 64;
   //if ( DIMTOL*INCH > 0.015625 ) Dim_Res = 32;
//   if ( DIMTOL*INCH > 0.031250 ) Dim_Res = 32;
//   if ( DIMTOL*INCH > 0.062500 ) Dim_Res = 16;
//   if ( DIMTOL*INCH > 0.125000 ) Dim_Res = 8;
   if ( DIMTOL*INCH > 0.031250 ) Dim_Res = 64;
   if ( DIMTOL*INCH > 0.062500 ) Dim_Res = 32;
   if ( DIMTOL*INCH > 0.125000 ) Dim_Res = 16;


   Des_Win_US=window.open('','Des_Win',
      'menubar=yes,resizable=yes,scrollbars=yes,status=yes');


   with (Des_Win_US.document) {
      write("<HTML>\n")
      write("<HEAD>\n")
      write("<title>" + Design_Freq + " MHz Yagi Design Details (US/Imperial)</title>\n")
      write("<link rel=stylesheet type=\"text/css\" href=\"../../css/dg.css\">\n")
      write("</HEAD>\n\n")
      write("<BODY bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\n\n")


      write("<table width=\"100%\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"black\">\n")
      write("  <tr valign=\"center\">\n")
      write("    <td align=center width=50%>\n")
      write("    <!----------your logo goes here---------->\n")
      write("    <img src=\"../../images/K7MEM_Logo.jpg\" border=\"0\" alt=\"\"></td>\n")
      write("    <!--------------------------------------->\n")
      write("    <td align=center width=50%><P class=std_16_aqua ALIGN=\"center\">Javascript Electronic Notebook<BR>\n")
      write("    <font color=\"#fff2d2\">")
      write("" + Design_Freq + " MHz Yagi Design Details (US/Imperial)<BR>\n")
      write("    " + (Num_Elements+2) + " Elements, " + Rnd(9.2 + 3.39 * Math.log(Actual_BL),1) + " dBd Estimated Gain</font><BR>\n")
      write("    by Martin E. Meserve</td>\n")
      write("  </tr>\n")
      write("</table>\n\n")


      write("<table width=\"100%\" height=\"19\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../design/topgrbg.gif\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td align=right width=\"100%\" background=\"../../design/topgrbg.gif\">\n")
      write("</td></tr></table>\n\n")


      write("<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\" align=\"center\">\n")
      write("  <TR>\n")
      write("    <TD bgcolor=\"#000000\" HEIGHT=\"1\">\n")
      write("      <TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n")
      write("        <TR>\n")
      write("          <TD>\n")
      write("      </TD></TR></TABLE>\n")
      write("</TD></TR></TABLE>\n\n")


      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td bgcolor=\"#C6F7BD\" width=50%>\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Design Synopsys</P>\n")


      write("    <P class=\"std_10_bold\">")
      write(Design_Freq, " MHz, ", Num_Elements + 2, " Elements, ")
      write(Rnd(9.2 + 3.39 * Math.log(Actual_BL),3) + " dBd Estimated Gain</P>\n")


      if (document.yagi_vhf_1.FG_BL.options[0].selected) {
         //*****************************************************************
         // Check if specified Gain is within limits.
         //*****************************************************************


         if ( document.yagi_vhf_1.FG_BL_Val.value > 21.6 ) {
            write("    <P class=\"special\">\n")
            write("    <B>Warning: The specified Gain of ", document.yagi_vhf_1.FG_BL_Val.value ," dBd is too <I>Large</I>. \n")
            write("    Gain should be less than 21.6 dBd.</B></P></LI>\n")
            }
         else if ( document.yagi_vhf_1.FG_BL_Val.value < 11.8 ) {
            write("    <P class=\"special\" align=justify>\n")
            write("    <B>Warning: The specified Gain of ", document.yagi_vhf_1.FG_BL_Val.value ," dBd is too <I>Small</I>. \n")
            write("    Gain should be greater than 11.8 dBd.</B></P>\n")
            }
         }
      else {
         //*****************************************************************
         // Check if specified Boom Length is within limits.
         //*****************************************************************


         if ( Boom_Length > 39 ) {
            write("    <P class=\"special\" align=justify>\n")
            write("    <B>Warning: The specified Boom Length of ", Rnd(Boom_Length,3) ," Wavelengths is to <I>Large</I>.\n")
            write("    Boom Length should be less than 39 Wavelengths.</B></P>\n")
            }
         else if ( Boom_Length < 2.2 ) {
            write("    <P class=\"special\" align=justify>\n")
            if (document.yagi_vhf_1.FG_BL.options[1].selected) {
               write("    <B>Warning: The specified Boom Length of ");
               write(document.yagi_vhf_1.FG_BL_Val.value ," Inches is to <I>Small</I>.\n") }
            else if (document.yagi_vhf_1.FG_BL.options[2].selected) {
               write("    <B>Warning: The specified Boom Length of ");
               write(document.yagi_vhf_1.FG_BL_Val.value ," Millimeters is to <I>Small</I>.\n") }
            else {
               write("    <B>Warning: The specified Boom Length of ");
               write(document.yagi_vhf_1.FG_BL_Val.value ," Wavelengths is to <I>Small</I>.\n") }
            write("    Boom Length should be greater than 2.2 Wavelengths.</B></P>\n")
            }
         }


      write("    <P class=\"std_10_bold\">")
      write(Rnd(BH,1), " Degrees <I>Horizontal</I> Beam Width</P>\n")


      write("    <P class=\"std_10_bold\">")
      write(Rnd(BV,1), " Degrees <I>Vertical</I> Beam Width</P>\n")


      write("    <P class=\"std_10_bold\">")
      if ( Boom_Type == "Metalic" & Mount_Type == "Bonded") {
         write(Rnd(BD_WL*INCH,2) + "\" Diameter, <I>Metalic</I> ");
         write("Boom with <I>Bonded</I> Elements. ");
         write("Boom Correction of ", Rnd(BC_Val,3), " applied.</P>\n" );
         }
      else if ( Boom_Type == "Metalic" & Mount_Type == "Insulated") {
         write(Rnd(BD_WL*INCH,2) + "\" Diameter, <I>Metalic</I> Boom with <I>Insulated</I> Elements. ");
         write("Boom Correction of ", Rnd(BC_Val,3), " applied.</P>\n" );
         }
      else {
         write("N/A Diameter, <I>Non-Metalic</I> Boom with <I>Insulated</I> Elements. ");
         write("<I>N0</I> Boom Correction applied.</P>\n" );
         }


      if ( Boom_Type == "Metalic" && BD_WL > 0.06 ) {
         write("    <P class=\"special\" align=justify>\n")
         write("            <B>Warning: Boom Diameter is too large.\n")
         write("            The Diameter of a Metalic Boom should be less than ");
         write("          " + Rnd(0.06*INCH,3) + " (" + DIN2FIN( 0.06*INCH, 64 ) + ")</B></FONT>")
         }


      write("    <P class=\"std_10_bold\">")
      write("Electrical Boom Length of " + Rnd(Boom_Length*INCH,1) + "\" (" + DFTtoFTIN( (Boom_Length*INCH)/12, 1, Dim_Res ) + "). ")
      write("Allow for overhang when cutting boom to length.</P>\n")


      write("    <P class=\"std_10_bold\">")
      write(Rnd(DE_Dia*INCH,3) + "\" (" + DIN2FIN( DE_Dia*INCH, Dim_Res ) + ") ");

//      write(Rnd(DE_Dia*INCH,3) + "\" (" + DIN2FIN( DE_Dia*INCH, 64 ) + ") ");
      write("Driven Element Diameter.</P>\n")


      if ( DE_Dia < 0.001 ||  DE_Dia > 0.02 ) {
         write("      <P class=\"special\" align=justify>")
         write("<B>Warning: The Driven Element Diameter is Incorrect.\n")
         if ( 0.001*INCH >= 1.0 ) {
            write("      The Driven Element Diameter should be between " + Rnd(0.001*INCH,3) + " (" + DIN2FIN( 0.001*INCH, Dim_Res ) + "\") ") }
         else {
            write("      The Driven Element Diameter should be between " + Rnd(0.001*INCH,3) + " (" + Dec2Frac( 0.001*INCH, Dim_Res ) + "\") ") }
         if ( 0.02*INCH >= 1.0 ) {
            write(" and " + Rnd(0.02*INCH,3) + " ("  + DIN2FIN( 0.02*INCH, Dim_Res ) + ")</B></P>\n") }
         else {
            write(" and " + Rnd(0.02*INCH,3) + " ("  + Dec2Frac( 0.02*INCH, Dim_Res ) + "\")</B></P>\n") }
         }


      write("    <P class=\"std_10_bold\">")
      write(Rnd(PE_Dia*INCH,3) + "\" (" + DIN2FIN( PE_Dia*INCH, Dim_Res ) + ") ");
//      write(Rnd(PE_Dia*INCH,3) + "\" (" + DIN2FIN( PE_Dia*INCH, 64 ) + ") ");
      write("Parasitic Element Diameter.</P>\n")


      write("    <P class=\"std_10_bold\">")
      write("Suggested Stacking Distance for 2 Yagis:</P>\n")
      write("    <P class=\"std_10_bold\">&nbsp;&nbsp;&nbsp;&nbsp;")
      write(Rnd(SH*INCH,1) + "\" (" + DFTtoFTIN( (SH*INCH)/12, 1, Dim_Res ) + ") Horizontally</P>\n")
      write("    <P class=\"std_10_bold\">&nbsp;&nbsp;&nbsp;&nbsp;")
      write(Rnd(SV*INCH,1) + "\" (" + DFTtoFTIN( (SV*INCH)/12, 1, Dim_Res ) + ") Vertically</P>\n")


      write("    <P class=\"std_10_bold\">");
      write(Rnd(DIMTOL*INCH,3) + "\" (" + Dec2Frac(DIMTOL*INCH, Dim_Res) + "\") ");

      write("Dimensional tolerance required for element lengths.</P>\n");


      write("    </td>\n\n")


      write("  <td valign=top>\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Antenna Dimensions\n")


      write("    <TABLE ALIGN=CENTER border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=100%>\n")


      write("    <TR>\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")
      write("      <TH COLSPAN=1><P class=\"std_bold_red\">&nbsp;\n")
      write("      <TD valign=center align=center>&nbsp;\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")


      write("    <TR>\n")
      write("      <TH COLSPAN=1><P class=\"std_bold_blue\">Cumulative<BR>Spacing</FONT>\n")
      write("      <TH COLSPAN=2><P class=\"std_bold_blue\">Element</FONT>\n")
      write("      <TH COLSPAN=1><P class=\"std_bold_blue\">Element<BR>Length</FONT>\n")


      write("    <TR>\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">Zero\n")
      write("      <TH COLSPAN=1><P class=\"std_bold_red\">REFL\n")
      write("      <TD valign=center align=center><IMG SRC=\"images/yagi_ant_ref.jpg\" ALIGN=center>\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">")

      write( DIN2FIN( Refl_Len*INCH, Dim_Res )+ "\n");


      write("    <TR>\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">")
      write( DIN2FIN(Refl_Spa*INCH, Dim_Res) + "\n")
      write("      <TH COLSPAN=1><P class=\"std_bold_red\">D.E.</FONT>\n")
      write("      <TD valign=center align=center><IMG SRC=\"images/yagi_ant_de.jpg\" ALIGN=center>\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">")
      write( DIN2FIN(DE_Len*INCH, Dim_Res) + "\n")


      for (K = 1; K <= Num_Elements; K++) {
         write("    <TR>\n");
         write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">");
         write( DIN2FIN(Total_Dist[K]*INCH, Dim_Res) + "\n");
         write("      <TH COLSPAN=1><P class=\"std_bold_red\">");
         write("D", K, "</FONT>\n");
         write("      <TD valign=center align=center><IMG SRC=\"images/yagi_ant_dir.jpg\" ALIGN=center>\n")
         write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">");
         write( DIN2FIN(D[K]*INCH, Dim_Res) + "\n");
         }


      write("    <TR>\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")
      write("      <TH COLSPAN=1><P class=\"std_bold_red\">&nbsp;\n")
      write("      <TD valign=center align=center>&nbsp;\n")
      write("      <TD ALIGN=CENTER><P class=\"std_bold_blue\">&nbsp;\n")
      write("    </table>\n")
      write("</table>\n")
      write("</body>\n")
      write("</html>\n")


      close()
      } // End of "with (Des_Win_US.document)" statement
}


//**************************************************************************
// Display window with design information using Metric dimensions.
//**************************************************************************


function View_Arrl( Antenna_Def ) {
   Dim_Off_Array = new Array( 1, 4, 7, 10 );
   Spec_Off_Array = new Array( 0, 10, 20, 30 );


   if ( Antenna_Def == "144_12" ) {Ant_Freq = 144; Dim_Off = 1; Spec_Off = 0;}
   else if ( Antenna_Def == "222_16" ) {Ant_Freq = 222; Dim_Off = 4; Spec_Off = 10;}
   else if ( Antenna_Def == "432_22" ) {Ant_Freq = 432; Dim_Off = 7; Spec_Off = 20;}
   else if ( Antenna_Def == "432_33" ) {Ant_Freq = 432; Dim_Off = 10; Spec_Off = 30;}


   Arrl=window.open('','Antenna_Def',
      'menubar=yes,resizable=yes,scrollbars=yes,status=yes');


   with (Arrl.document) {
      write("<HTML>\n")
      write("<HEAD>\n")
      write("<title>" + ARRL_Ant_Specs[Spec_Off] )
      write(" MHz Antenna Data from the ARRL Antenna Handbook</title>\n")
      write("<link rel=stylesheet type=\"text/css\" href=\"../../css/dg.css\">\n")
      write("</HEAD>\n\n")
      write("<BODY bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\n\n")


      write("<table width=\"100%\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"black\">\n")
      write("  <tr valign=\"center\">\n")
      write("    <td align=center width=50%>\n")
      write("    <!----------your logo goes here---------->\n")
      write("    <img src=\"../../images/K7MEM_Logo.jpg\" border=\"0\" alt=\"\"></td>\n")
      write("    <!--------------------------------------->\n")
      write("    <td align=center width=50%><P class=std_16_aqua ALIGN=\"center\">Javascript Electronic Notebook<BR>\n")
      write("    <font color=\"#fff2d2\">\n")
      write("          " + ARRL_Ant_Specs[Spec_Off] + " MHz Antenna Data from the<BR>ARRL Antenna Handbook</font><BR>\n")
      write("    by Martin E. Meserve</td>\n")
      write("  </tr>\n")
      write("</table>\n\n")


      write("<table width=\"100%\" height=\"19\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../design/topgrbg.gif\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td align=right width=\"100%\" background=\"../../design/topgrbg.gif\">\n")
      write("</td></tr></table>\n\n")


      write("<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\" align=\"center\">\n")
      write("  <TR>\n")
      write("    <TD bgcolor=\"#000000\" HEIGHT=\"1\">\n")
      write("      <TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n")
      write("        <TR>\n")
      write("          <TD>\n")
      write("      </TD></TR></TABLE>\n")
      write("</TD></TR></TABLE>\n\n")


      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td bgcolor=\"#C6F7BD\">\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Design Synopsys</P>\n")


      write("    <P class=\"std_10_bold\">")
      write("" + ARRL_Ant_Specs[Spec_Off] + " MHz, " + ARRL_Ant_Specs[Spec_Off+1] + " Elements, ")
      write("" + ARRL_Ant_Specs[Spec_Off+2] + " dBd Estimated Gain</P>\n")
      write("    <P class=\"std_10_bold\">" + ARRL_Ant_Specs[Spec_Off+3] + " Degrees <I>Horizontal</I> Beam Width</P>\n")
      write("    <P class=\"std_10_bold\">" + ARRL_Ant_Specs[Spec_Off+4] + " Degrees <I>Vertical</I> Beam Width</P>\n")
      write("    <P class=\"std_10_bold\">" + ARRL_Ant_Specs[Spec_Off+5] + "\" Diameter, <I>Metalic</I> Boom with <I>Insulated</I> Elements.</P>\n");


      ARRL_MM = 299793/ARRL_Ant_Specs[Spec_Off];      // Wavelength in Millimeters
      ARRL_INCH = 11802.9/ARRL_Ant_Specs[Spec_Off];   // Wavelength in Inches


      write("    <P class=\"std_10_bold\">Electrical Boom Length of " + Rnd(ARRL_Ant_Specs[Spec_Off+6]*ARRL_MM,1) + " mm");
      write(" (" + Rnd(ARRL_Ant_Specs[Spec_Off+6]*ARRL_INCH,1) + "\").");
      write(" Allow for overhang when cutting boom to length.</P>\n");


      write("    <P class=\"std_10_bold\">" + Rnd(ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM,3) + " mm");
      write(" (" + Rnd(ARRL_Ant_Specs[Spec_Off+7],4) + "\") Driven Element Diameter.</P>\n");


      write("    <P class=\"std_10_bold\">" + Rnd(ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM,3) + " mm");
      write(" (" + Rnd(ARRL_Ant_Specs[Spec_Off+7],4) + "\") Parasitic Element Diameter.</P>\n")


      write("    <P class=\"std_10_bold\">Suggested Stacking Distance for 2 Yagis:\n");


      if ( ARRL_Ant_Specs[Spec_Off] == 432 ) {
         write("    <P class=\"std_10_bold\">");
         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+8]/ARRL_INCH*ARRL_MM,1) +" mm (" );
         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+8]/12,1,64) + ") Vertically</P>\n");
         write("    <P class=\"std_10_bold\">");
         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+9]/ARRL_INCH*ARRL_MM,1) +" mm (" );
         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+9]/12,1,64) + ") Vertically</P>\n");
         }
      else {
         write("    <P class=\"std_10_bold\">");
         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+8]*12/ARRL_INCH*ARRL_MM,1) +" mm (" );
         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+8],1,32) + ") Vertically</P>\n");
         write("    <P class=\"std_10_bold\">");
         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+9]*12/ARRL_INCH*ARRL_MM,1) +" mm (" );
         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+9],1,64) + ") Vertically</P>\n");
         }


      write("    <P class=\"std_10_bold\">" + Rnd(.003*ARRL_MM,1) + " mm (" + Dec2Frac(.003*ARRL_INCH, 16) + "\")");
      write(" Dimensional tolerance required for element lengths.</P>\n");
      write("    </td>\n\n")


      write("  <td valign=top>\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Antenna Dimensions\n")



      write("    <TABLE ALIGN=CENTER border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=100%>\n")
      write("      <TR>\n")
      write("        <TH COLSPAN=2><P class=\"std_bold_blue\" align=center>Cumulative<BR>Spacing</P>\n")
      write("        <TH COLSPAN=2><P class=\"std_bold_blue\" align=center>Element</P></FONT>\n")
      write("        <TH COLSPAN=2><P class=\"std_bold_blue\" align=center>Element<BR>Length</P>\n")


      write("      <TR>\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_blue\" align=center>(mm)\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_black\" align=center>(in)\n")
      write("        <TD>\n")
      write("        <TD>\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_blue\" align=center>(mm)\n")
      write("        <TH COLSPAN=1><P class=\"std_bold_black\" align=center>(in)\n")


      write("      <TR>\n")
      write("        <TD><P class=\"std_bold_blue\" align=center>" + ARRL_El_Dims[Dim_Off] + "\n")
      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")
      write("        <TH><P class=\"std_bold_red\" align=center>REFL\n")
      write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_ref.jpg\" ALIGN=center>\n")
      write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[1+Dim_Off],0)+ "\n")
      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[1+Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")


      write("      <TR>\n")
      write("        <TD><P class=\"std_bold_blue\">" + Rnd(ARRL_El_Dims[13+Dim_Off],0)+ "\n")
      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[13+Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")
      write("        <TH><P class=\"std_bold_red\" align=center>D.E.\n")
      write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_de.jpg\" ALIGN=center>\n")
      write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[13+1+Dim_Off],0) + "\n")
      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[13+1+Dim_Off]/ARRL_MM*ARRL_INCH, 16)+ "\n")


      for (I = 1; I <= ARRL_Ant_Specs[Spec_Off+1]-2; I++) {
         write("      <TR>\n")
         write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[(I+1)*13+Dim_Off],0) + "\n")
         write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[(I+1)*13+Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")
         write("        <TH><P class=\"std_bold_red\">D", I, "\n")
         write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_dir.jpg\" ALIGN=center>\n")
         write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[(I+1)*13+1+Dim_Off],0)+ "\n")
         write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[(I+1)*13+1+Dim_Off]/ARRL_MM*ARRL_INCH, 16)+ "\n")
         }


      write("      </table>\n")
      write("</table>\n")


      write("</body>\n")
      write("</html>\n")




      close()
      } // End of "with (Des_Win_M.document)" statement
 }


//**************************************************************************
// Display window with design information using US/Imperial dimensions.
//**************************************************************************


function View_ARRL_Boom() {
   Des_ARRL_Boom=window.open('','Des_Win',
      'menubar=yes,resizable=yes,scrollbars=yes,status=yes');


   with (Des_ARRL_Boom.document) {
      write("<HTML>\n")
      write("<HEAD>\n")
      write("<title>ARRL Extended Yagi Boom Design</title>\n")
      write("<link rel=stylesheet type=\"text/css\" href=\"../../css/dg.css\">\n")
      write("</HEAD>\n\n")
      write("<BODY bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\n\n")


      write("<table width=\"100%\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"black\">\n")
      write("  <tr valign=\"center\">\n")
      write("    <td align=center width=50%>\n")
      write("    <!----------your logo goes here---------->\n")
      write("    <img src=\"../../images/K7MEM_Logo.jpg\" border=\"0\" alt=\"\"></td>\n")
      write("    <!--------------------------------------->\n")
      write("    <td align=center width=50%><P class=std_16_aqua ALIGN=\"center\">Javascript Electronic Notebook<BR>\n")
      write("    <font color=\"#fff2d2\">ARRL Extended Yagi Boom Design<BR>\n")
      write("    by Martin E. Meserve</td>\n")
      write("  </tr>\n")
      write("</table>\n\n")


      write("<table width=\"100%\" height=\"19\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../design/topgrbg.gif\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td align=right width=\"100%\" background=\"../../design/topgrbg.gif\">\n")
      write("</td></tr></table>\n\n")


      write("<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\" align=\"center\">\n")
      write("  <TR>\n")
      write("    <TD bgcolor=\"#000000\" HEIGHT=\"1\">\n")
      write("      <TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n")
      write("        <TR>\n")
      write("          <TD>\n")
      write("      </TD></TR></TABLE>\n")
      write("</TD></TR></TABLE>\n\n")


      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <tr>\n")
      write("    <td class=green colspan=2>\n")
      write("      <table align=center border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=100%>\n")
      write("        <tr class=green>\n")
      write("          <td valign=top width=50%><P class=\"std_10\" align=\"justify\">\n")
      write("          Below is an example, by the ARRL, of how to create an extended mast\n")
      write("          that will be strong enough to hold a lot of elements with out\n")
      write("          excessive bending. This example was ment for the 22 Element antenna\n")
      write("          for 432 MHz but the principals can be applied to any of the antennas\n")
      write("          described here.\n\n")


      write("          <P class=\"std_10\" align=\"justify\">The basic principal is to use round boom\n")
      write("          sections of different\n")
      write("          diameters, such that one boom section could slide inside another section.\n")
      write("          The sections are then secured together by slotting the larger section\n")
      write("          and using a hose clamp to secure the sections. A #8-32 screw is also used\n")
      write("          on each overlapping section to ensure electrical connection and prevent\n")
      write("          the sections from rotating around each other.\n\n")


      write("          <P class=\"std_10\" align=\"justify\">\n")
      write("          An extra 304mm (12\") length of 7/8\" OD x 0.049 wall - 6061 tubing is needed\n")
      write("          to double up the boom at the mast mount.\n\n")


      write("          <td valign=top width=50%><P class=std>\n\n")


      write("          <table border=2 width=100%>\n")
      write("            <tr>\n")
      write("              <th><P class=std_10>Section\n")
      write("              <th><P class=std_10>Length\n")
      write("              <th><P class=std_10>Type\n")
      write("            <tr>\n")
      write("              <td align=center><P class=std_10>Front\n")
      write("              <td align=center><P class=std_10><tt>1530mm<BR>(60-1/4\")</tt>\n")
      write("              <td align=center><P class=std_10><tt>7/8\" OD x 0.049<BR>wall - 6061</tt>\n")
      write("            <tr>\n")
      write("              <td align=center><P class=std_10>Center\n")
      write("              <td align=center><P class=std_10><tt>1415mm<BR>(55 11/16\")</tt>\n")
      write("              <td align=center><P class=std_10><tt>1\" OD x 0.058<BR> wall - 6061</tt>\n")
      write("            <tr>\n")
      write("              <td align=center><P class=std_10>Rear\n")
      write("              <td align=center><P class=std_10><tt>304mm<BR>(12\")</tt>\n")
      write("              <td align=center><P class=std_10><tt>7/8\" OD x 0.049<BR>wall - 6061</tt>\n")
      write("          </table>\n<BR>\n")


      write("          <P class=\"std_10\" align=\"justify\">You start out with the lengths listed\n")
      write("          in the table and then insert the Front and Rear sections into the Center\n")
      write("          section, until the dimensions in the drawing are achieved. This should\n")
      write("          cause a overlap between the sections of 4 to 5 inches.\n\n")


      write("        <tr>\n")
      write("          <td class=green colspan=2 align=center><P class=\"std\"><IMG SRC=\"images/ARRL_Mast.jpg\">\n");


      write("      </table>\n")
      write("</table>\n")


      write("</body>\n")
      write("</html>\n")


      close()
      } // End of "with (Des_ARRL_Boom.document)" statement
}

//**************************************************************************
// Display window with design information using US/Imperial dimensions.
//**************************************************************************


function View_G8WRB_Data( Antenna_Def ) {
   Dim_Off_Array = new Array( 1, 4, 7, 10 );
   Spec_Off_Array = new Array( 0, 10, 20, 30 );

   if ( Antenna_Def == "144_12" ) {Ant_Freq = 144; Dim_Off = 1; Spec_Off = 0;}
   else if ( Antenna_Def == "222_16" ) {Ant_Freq = 222; Dim_Off = 4; Spec_Off = 10;}
   else if ( Antenna_Def == "432_22" ) {Ant_Freq = 432; Dim_Off = 7; Spec_Off = 20;}
   else if ( Antenna_Def == "432_33" ) {Ant_Freq = 432; Dim_Off = 10; Spec_Off = 30;}

   G8WRB_Data=window.open('','Antenna_Def',
      'menubar=yes,resizable=yes,scrollbars=yes,status=yes');


   with (G8WRB_Data.document) {
      write("<HTML>\n")
      write("<HEAD>\n")
      write("<title>" + ARRL_Ant_Specs[Spec_Off] )
      write(" MHz Antenna Data for G8WRB Yagi-Uda Design Tool</title>\n")
      write("<link rel=stylesheet type=\"text/css\" href=\"../../css/dg.css\">\n")
      write("</HEAD>\n\n")
      write("<BODY bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\n\n")

      write("<table width=\"100%\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"black\">\n")
      write("  <tr valign=\"center\">\n")
      write("    <td align=center width=50%>\n")
      write("    <!----------your logo goes here---------->\n")
      write("    <img src=\"../../images/K7MEM_Logo.jpg\" border=\"0\" alt=\"\"></td>\n")
      write("    <!--------------------------------------->\n")
      write("    <td align=center width=50%><P class=std_16_aqua ALIGN=\"center\">Javascript Electronic Notebook<BR>\n")
      write("    <font color=\"#fff2d2\">\n")
      write("          " + ARRL_Ant_Specs[Spec_Off] + " MHz ARRL Antenna Data for<BR>the G8WRB Yagi-Uda Design Tool</font><BR>\n")
      write("    by Martin E. Meserve</td>\n")
      write("  </tr>\n")
      write("</table>\n\n")

      write("<table width=\"100%\" height=\"19\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../design/topgrbg.gif\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td align=right width=\"100%\" background=\"../../design/topgrbg.gif\">\n")
      write("</td></tr></table>\n\n")

      write("<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\" align=\"center\">\n")
      write("  <TR>\n")
      write("    <TD bgcolor=\"#000000\" HEIGHT=\"1\">\n")
      write("      <TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n")
      write("        <TR>\n")
      write("          <TD>\n")
      write("      </TD></TR></TABLE>\n")
      write("</TD></TR></TABLE>\n\n")
			
      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td bgcolor=\"#C6F7BD\">\n")
      write("    <P class=std_14_fbrick ALIGN=\"center\">Antenna Data for the G8WRB Yagi-Uda Design Tool</P>\n")

      write("    <p><pre>")
      write("NOTES " + ARRL_Ant_Specs[Spec_Off] + " MHz ARRL Antenna<br>");
      write("FREQUENCY " + Ant_Freq + ".000000<br>");
//			Min_Freq = Ant_Freq - 10; Max_Freq = Ant_Freq + 10;
      // Set the Min_Freq and Max_Freq at +/- 5 percent of center.
			Min_Freq = Ant_Freq - Ant_Freq*0.05; Max_Freq = Ant_Freq + Ant_Freq*0.05;
      write("MIN_FREQUENCY " + Min_Freq + "<br>");
      write("MAX_FREQUENCY " + Max_Freq + "<br>");
//			Step_Freq = 0.5;
      // Set the Step_Freq equal to 100 steps between Min_Freq and Max_Freq
			Step_Freq = Rnd((Max_Freq - Min_Freq) / 100, 3);
			write("STEP_FREQUENCY  " + Step_Freq + "<br>");
			
			Elements = ARRL_Ant_Specs[Spec_Off+1];
			write("ELEMENTS " + Elements + "<br>");
			write("DRIVEN 1<br>");
			
			Parasitic = ARRL_Ant_Specs[Spec_Off+1] - 1;
			write("PARASITIC " + Parasitic + "<br>");
			write("ANGULAR_STEP   5.000000<br>");
		
      ARRL_MM = 299793/ARRL_Ant_Specs[Spec_Off];      // Wavelength in Millimeters
      ARRL_INCH = 11802.9/ARRL_Ant_Specs[Spec_Off];   // Wavelength in Inches

			write("#DATA_DRIVEN        x         y       length     diameter voltage(r) voltage(i)<br>");
			write("DATA_DRIVEN      " + ARRL_El_Dims[13+Dim_Off]/1000 + "     0.00000   " + ARRL_El_Dims[13+1+Dim_Off]/1000 );
			write("  " + Rnd((ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM)/1000,5) + "    1.00000    0.00000<br>");

			write("#DATA_PARASITIC     x         y       length     diameter<br>");
			write("DATA_PARASITIC   " + ARRL_El_Dims[Dim_Off]/1000 + "     0.00000   " + ARRL_El_Dims[1+Dim_Off]/1000 );
			write("  " + Rnd((ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM)/1000,5) + "<br>");

      for (I = 1; I <= ARRL_Ant_Specs[Spec_Off+1]-2; I++) {
			   write("                 " + ARRL_El_Dims[(I+1)*13+Dim_Off]/1000 + "     0.00000   " + ARRL_El_Dims[((I+1)*13+Dim_Off)+1]/1000 );
			   write("  " + Rnd((ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM)/1000,5) + "<br>");
         }
			
      write("    </pre></p>")


// STEP_FREQUENCY 0.500000
// ELEMENTS 11
// DRIVEN 1
// PARASITIC 10
// ANGULAR_STEP   5.000000
// #DATA_DRIVEN        x         y       length     diameter voltage(r) voltage(i)
// DATA_DRIVEN     0.13627    0.00000    0.32422    0.00635    1.00000    0.00000
// #DATA_PARASITIC     x         y       length     diameter
// DATA_PARASITIC
			
			
//      write("" + ARRL_Ant_Specs[Spec_Off] + " MHz, " + ARRL_Ant_Specs[Spec_Off+1] + " Elements, ")
//      write("" + ARRL_Ant_Specs[Spec_Off+2] + " dBd Estimated Gain</P>\n")
//      write("    <P class=\"std_10_bold\">" + ARRL_Ant_Specs[Spec_Off+3] + " Degrees <I>Horizontal</I> Beam Width</P>\n")
//      write("    <P class=\"std_10_bold\">" + ARRL_Ant_Specs[Spec_Off+4] + " Degrees <I>Vertical</I> Beam Width</P>\n")
//      write("    <P class=\"std_10_bold\">" + ARRL_Ant_Specs[Spec_Off+5] + "\" Diameter, <I>Metalic</I> Boom with <I>Insulated</I> Elements.</P>\n");

//      ARRL_MM = 299793/ARRL_Ant_Specs[Spec_Off];      // Wavelength in Millimeters
//      ARRL_INCH = 11802.9/ARRL_Ant_Specs[Spec_Off];   // Wavelength in Inches

//      write("    <P class=\"std_10_bold\">Electrical Boom Length of " + Rnd(ARRL_Ant_Specs[Spec_Off+6]*ARRL_MM,1) + " mm");
//      write(" (" + Rnd(ARRL_Ant_Specs[Spec_Off+6]*ARRL_INCH,1) + "\").");
//      write(" Allow for overhang when cutting boom to length.</P>\n");

//      write("    <P class=\"std_10_bold\">" + Rnd(ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM,3) + " mm");
//      write(" (" + Rnd(ARRL_Ant_Specs[Spec_Off+7],4) + "\") Driven Element Diameter.</P>\n");

//      write("    <P class=\"std_10_bold\">" + Rnd(ARRL_Ant_Specs[Spec_Off+7]/ARRL_INCH*ARRL_MM,3) + " mm");
//      write(" (" + Rnd(ARRL_Ant_Specs[Spec_Off+7],4) + "\") Parasitic Element Diameter.</P>\n")
//      write("    <P class=\"std_10_bold\">Suggested Stacking Distance for 2 Yagis:\n");

//      if ( ARRL_Ant_Specs[Spec_Off] == 432 ) {
//         write("    <P class=\"std_10_bold\">");
//         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+8]/ARRL_INCH*ARRL_MM,1) +" mm (" );
//         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+8]/12,1,64) + ") Vertically</P>\n");
//         write("    <P class=\"std_10_bold\">");
//         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+9]/ARRL_INCH*ARRL_MM,1) +" mm (" );
//         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+9]/12,1,64) + ") Vertically</P>\n");
//         }
//      else {
//         write("    <P class=\"std_10_bold\">");
//         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+8]*12/ARRL_INCH*ARRL_MM,1) +" mm (" );
//         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+8],1,32) + ") Vertically</P>\n");
//         write("    <P class=\"std_10_bold\">");
//         write("&nbsp;&nbsp;&nbsp;&nbsp;" + Rnd(ARRL_Ant_Specs[Spec_Off+9]*12/ARRL_INCH*ARRL_MM,1) +" mm (" );
//         write( DFTtoFTIN(ARRL_Ant_Specs[Spec_Off+9],1,64) + ") Vertically</P>\n");
//         }


//      write("    <P class=\"std_10_bold\">" + Rnd(.003*ARRL_MM,1) + " mm (" + Dec2Frac(.003*ARRL_INCH, 16) + "\")");
//      write(" Dimensional tolerance required for element lengths.</P>\n");
//      write("    </td>\n\n")


//      write("  <td valign=top>\n")
//      write("    <P class=std_14_fbrick ALIGN=\"center\">Antenna Dimensions\n")

//      write("    <TABLE ALIGN=CENTER border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=100%>\n")
//      write("      <TR>\n")
//      write("        <TH COLSPAN=2><P class=\"std_bold_blue\" align=center>Cumulative<BR>Spacing</P>\n")
//      write("        <TH COLSPAN=2><P class=\"std_bold_blue\" align=center>Element</P></FONT>\n")
//      write("        <TH COLSPAN=2><P class=\"std_bold_blue\" align=center>Element<BR>Length</P>\n")


//      write("      <TR>\n")
//      write("        <TH COLSPAN=1><P class=\"std_bold_blue\" align=center>(mm)\n")
//      write("        <TH COLSPAN=1><P class=\"std_bold_black\" align=center>(in)\n")
//      write("        <TD>\n")
//      write("        <TD>\n")
//      write("        <TH COLSPAN=1><P class=\"std_bold_blue\" align=center>(mm)\n")
//      write("        <TH COLSPAN=1><P class=\"std_bold_black\" align=center>(in)\n")


//      write("      <TR>\n")
//      write("        <TD><P class=\"std_bold_blue\" align=center>" + ARRL_El_Dims[Dim_Off] + "\n")
//      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")
//      write("        <TH><P class=\"std_bold_red\" align=center>REFL\n")
//      write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_ref.jpg\" ALIGN=center>\n")
//      write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[1+Dim_Off],0)+ "\n")
//      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[1+Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")


//      write("      <TR>\n")
//      write("        <TD><P class=\"std_bold_blue\">" + Rnd(ARRL_El_Dims[13+Dim_Off],0)+ "\n")
//      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[13+Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")
//      write("        <TH><P class=\"std_bold_red\" align=center>D.E.\n")
//      write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_de.jpg\" ALIGN=center>\n")
//      write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[13+1+Dim_Off],0) + "\n")
//      write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[13+1+Dim_Off]/ARRL_MM*ARRL_INCH, 16)+ "\n")


//      for (I = 1; I <= ARRL_Ant_Specs[Spec_Off+1]-2; I++) {
//         write("      <TR>\n")
//         write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[(I+1)*13+Dim_Off],0) + "\n")
//         write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[(I+1)*13+Dim_Off]/ARRL_MM*ARRL_INCH, 16) + "\n")
//         write("        <TH><P class=\"std_bold_red\">D", I, "\n")
//         write("        <TD valign=center align=center><IMG SRC=\"images/yagi_ant_dir.jpg\" ALIGN=center>\n")
//         write("        <TD><P class=\"std_bold_blue\" align=center>" + Rnd(ARRL_El_Dims[(I+1)*13+1+Dim_Off],0)+ "\n")
//         write("        <TD><P class=\"std_bold_black\" align=center>" + DIN2FIN( ARRL_El_Dims[(I+1)*13+1+Dim_Off]/ARRL_MM*ARRL_INCH, 16)+ "\n")
//         }


      write("      </table>\n")
      write("</table>\n")


      write("</body>\n")
      write("</html>\n")




      close()
      } // End of "with (Des_Win_M.document)" statement
 }

