//**************************************************************************
// JavaScript for act_hpfil.html
//**************************************************************************


//**************************************************************************
// Global Variables and Arrays.
//**************************************************************************


var R1_Init, R2_Init, R3_Init, C1_C2;
var R1_Std, R2_Std, R3_Std;
var RA_Std, RB_Std, RC_Prec, R_Delta;
var R1_A, R1_B, R2_A, R2_B, R3_A, R3_B;
var R1_Prec, R2_Prec, R3_Prec, R1_Delta, R2_Delta, R3_Delta;
var Fil_Type, Fil_Order, F_C, Fil_Char;
var C1_1_Est, C1_1_Init;


//**************************************************************************
// Arrays for calculating multiple resistor combinations.
//**************************************************************************


Sel_Array = new Array("LT","GT");
R1_Val = new Array();
R2_Val = new Array();
R3_Val = new Array();
R4_Val = new Array();
R1A_Val = new Array();
R2A_Val = new Array();
R3A_Val = new Array();
R4A_Val = new Array();
R1B_Val = new Array();
R2B_Val = new Array();
R3B_Val = new Array();
R4B_Val = new Array();
K_Val  = new Array();
K1_Val  = new Array();
K2_Val  = new Array();
KA_Val  = new Array();
KB_Val  = new Array();
W0_Val = new Array();
WC_Val = new Array();
WCA_Val = new Array();
WCB_Val = new Array();
Q_Val  = new Array();
F0_Val = new Array();
F0A_Val = new Array();
F0B_Val = new Array();
BW_Val = new Array();


//**************************************************************************
//  HP_Fil_Design
//**************************************************************************


function HP_Fil_Calc() {


   //***********************************************************************
   // Get the Filter type, Order, and Response Characteristics.
   //***********************************************************************


   if (document.HP_Fil_Design.Fil_Type.options[0].selected) Fil_Type = "MFB";
   else Fil_Type = "VCVS";


   //***********************************************************************
   // Dynamically adjust some of the input and output fields based on the
   // filter order that is selected.
   //***********************************************************************


   if (document.HP_Fil_Design.Fil_Order.options[0].selected) {
      document.HP_Fil_Design.K2_Unit_Value.disabled = 1;
      document.HP_Fil_Design.K2_Unit_Value.style.color = "#cccccc";
      document.HP_Fil_Design.K2_Tenth_Value.disabled = 1;
      document.HP_Fil_Design.K2_Tenth_Value.style.color = "#cccccc";
      document.HP_Fil_Design.C1_2_Est.disabled = 1;
      document.HP_Fil_Design.C1_2_Est.style.color = "#cccccc";
      document.HP_Fil_Design.C2_2_Est.disabled = 1;
      document.HP_Fil_Design.C2_2_Est.style.color = "#cccccc";
      document.HP_Fil_Design.C1_2_Init.disabled = 1;
      document.HP_Fil_Design.C1_2_Init.style.color = "#cccccc";
      document.HP_Fil_Design.C1_2_Unit.disabled = 1;
      document.HP_Fil_Design.C1_2_Unit.style.color = "#cccccc";
      document.HP_Fil_Design.C2_2_Init.disabled = 1;
      document.HP_Fil_Design.C2_2_Init.style.color = "#cccccc";
      document.HP_Fil_Design.C2_2_Unit.disabled = 1;
      document.HP_Fil_Design.C2_2_Unit.style.color = "#cccccc";


      if ( Fil_Type == "VCVS" ) {
         document.HP_Fil_Design.C2_1_Est.size = 18;
         document.HP_Fil_Design.C2_1_Init.disabled = 1;
         document.HP_Fil_Design.C2_1_Init.style.color = "#cccccc";
         document.HP_Fil_Design.C2_1_Unit.disabled = 1;
         document.HP_Fil_Design.C2_1_Unit.style.color = "#cccccc";
         }
      else {
         document.HP_Fil_Design.C2_1_Est.size = 14;
         document.HP_Fil_Design.C2_1_Init.disabled = 0;
         document.HP_Fil_Design.C2_1_Init.style.color = "#000000";
         document.HP_Fil_Design.C2_1_Unit.disabled = 0;
         document.HP_Fil_Design.C2_1_Unit.style.color = "#000000";
         }


      Fil_Order = "Second"; }
   else {
      document.HP_Fil_Design.K2_Unit_Value.disabled = 0;
      document.HP_Fil_Design.K2_Unit_Value.style.color = "#000000";
      document.HP_Fil_Design.K2_Tenth_Value.disabled = 0;
      document.HP_Fil_Design.K2_Tenth_Value.style.color = "#000000";
      document.HP_Fil_Design.C1_2_Est.disabled = 0;
      document.HP_Fil_Design.C1_2_Est.style.color = "#000000";
      document.HP_Fil_Design.C2_2_Est.disabled = 0;
      document.HP_Fil_Design.C2_2_Est.style.color = "#000000";
      document.HP_Fil_Design.C1_2_Init.disabled = 0;
      document.HP_Fil_Design.C1_2_Init.style.color = "#000000";
      document.HP_Fil_Design.C1_2_Unit.disabled = 0;
      document.HP_Fil_Design.C1_2_Unit.style.color = "#000000";
      document.HP_Fil_Design.C2_2_Init.disabled = 0;
      document.HP_Fil_Design.C2_2_Init.style.color = "#000000";
      document.HP_Fil_Design.C2_2_Unit.disabled = 0;
      document.HP_Fil_Design.C2_2_Unit.style.color = "#000000";


      if ( Fil_Type == "VCVS" ) {
         document.HP_Fil_Design.C2_1_Est.size = 18;
         document.HP_Fil_Design.C2_1_Init.disabled = 1;
         document.HP_Fil_Design.C2_1_Init.style.color = "#cccccc";
         document.HP_Fil_Design.C2_1_Unit.disabled = 1;
         document.HP_Fil_Design.C2_1_Unit.style.color = "#cccccc";
         document.HP_Fil_Design.C2_2_Est.size = 18;
         document.HP_Fil_Design.C2_2_Init.disabled = 1;
         document.HP_Fil_Design.C2_2_Init.style.color = "#cccccc";
         document.HP_Fil_Design.C2_2_Unit.disabled = 1;

         document.HP_Fil_Design.C2_2_Unit.style.color = "#cccccc";
         }
      else {
         document.HP_Fil_Design.C2_1_Est.size = 14;
         document.HP_Fil_Design.C2_1_Init.disabled = 0;
         document.HP_Fil_Design.C2_1_Init.style.color = "#000000";
         document.HP_Fil_Design.C2_1_Unit.disabled = 0;
         document.HP_Fil_Design.C2_1_Unit.style.color = "#000000";
         document.HP_Fil_Design.C2_2_Est.size = 14;
         document.HP_Fil_Design.C2_2_Init.disabled = 0;
         document.HP_Fil_Design.C2_2_Init.style.color = "#000000";
         document.HP_Fil_Design.C2_2_Unit.disabled = 0;
         document.HP_Fil_Design.C2_2_Unit.style.color = "#000000";
         }


      Fil_Order = "Fourth"; }


   if (document.HP_Fil_Design.Fil_Order.options[0].selected) Fil_Order = "Second";
   else Fil_Order = "Fourth";


   if (document.HP_Fil_Design.Fil_Char.options[0].selected) Fil_Char = "Butterworth";
   else if (document.HP_Fil_Design.Fil_Char.options[1].selected) Fil_Char = "Chebishev, 0.1 dB";
   else if (document.HP_Fil_Design.Fil_Char.options[2].selected) Fil_Char = "Chebishev, 0.5 dB";
   else Fil_Char = "Chebishev, 1.0 dB";


   if ( Fil_Order == "Second" ) {
      if ( Fil_Char == "Butterworth" ) { a = 1.41421; b = 1.00000; }
      else if ( Fil_Char == "Chebishev, 0.1 dB" ) { a = 2.37209; b = 3.31329; }
      else if ( Fil_Char == "Chebishev, 0.5 dB" ) { a = 1.42562; b = 1.51620; }
      else { a = 1.09773; b = 1.10251; } }
   else {
      if ( Fil_Char == "Butterworth" ) { a1 = 0.76537; b1 = 1.00000; a2 = 1.84776; b2 = 1.00000; }
      else if ( Fil_Char == "Chebishev, 0.1 dB" ) { a1 = 0.52827; b1 = 1.32981; a2 = 1.27536; b2 = 0.62282; }
      else if ( Fil_Char == "Chebishev, 0.5 dB" ) { a1 = 0.35071; b1 = 1.06352; a2 = 0.84668; b2 = 0.35641; }
      else { a1 = 0.27907; b1 = 0.98650; a2 = 0.67374; b2 = 0.27940; } }


   //***********************************************************************
   // Get the -3 db Frequency specified.
   //***********************************************************************


   F_C = document.HP_Fil_Design.F_C.value;


   //***********************************************************************
   // Get the Gain value(s) specified.
   //***********************************************************************


   for (var J = 0; J <= 8; J++) {
      if (document.HP_Fil_Design.K1_Unit_Value.options[J].selected) K1_Value = J+1; }


   for (var K = 0; K <= 11; K++) {
      if (document.HP_Fil_Design.K1_Tenth_Value.options[K].selected){
        K1_Value += document.HP_Fil_Design.K1_Tenth_Value.options[K].value/100; }
      }


   for (var J = 0; J <= 8; J++) {
      if (document.HP_Fil_Design.K2_Unit_Value.options[J].selected) K2_Value = J+1; }


   for (var K = 0; K <= 11; K++) {
      if (document.HP_Fil_Design.K2_Tenth_Value.options[K].selected){
        K2_Value += document.HP_Fil_Design.K2_Tenth_Value.options[K].value/100; }
      }


   //***********************************************************************
   // Set in the estimate for C1 and C2 for a Stage 1 filter. Then get the
   // user entered capacitor values.
   //***********************************************************************


   C1_1_Est = 10 / (1000000 * F_C);
   document.HP_Fil_Design.C1_1_Est.value = "10/FC = " + C_Scale(C1_1_Est);


   if (document.HP_Fil_Design.C1_1_Unit.options[0].selected) {
      C1_1_Unit = 1000000; }
   else {
      C1_1_Unit = 1000000000000; }
   C1_1_Init = document.HP_Fil_Design.C1_1_Init.value / C1_1_Unit;


   if ( Fil_Type == "MFB" ) {
      C2_1_Est = C1_1_Init/K1_Value;
      document.HP_Fil_Design.C2_1_Est.value = "C2 ~ " + C_Scale(C2_1_Est);
      if (document.HP_Fil_Design.C2_1_Unit.options[0].selected) { C2_1_Unit = 1000000; }
      else { C2_1_Unit = 1000000000000; }
      C2_1_Init = document.HP_Fil_Design.C2_1_Init.value / C2_1_Unit;
      }
   else if ( Fil_Type == "VCVS" ) {
      C2_1_Est = C1_1_Init/K1_Value;
      document.HP_Fil_Design.C2_1_Est.value = "C1 = C2 = " + C_Scale(C1_1_Init);
      C2_1_Init = C1_1_Init;
      }


   //***********************************************************************
   // Set in the estimate for C1 and C2 for a Stage 2 filter. Then get the
   // user entered capacitor values.
   //***********************************************************************


   C1_2_Est = 10 / (1000000 * F_C);
   document.HP_Fil_Design.C1_2_Est.value = "10/FC = " + C_Scale(C1_2_Est);


   if (document.HP_Fil_Design.C1_2_Unit.options[0].selected) {
      C1_2_Unit = 1000000; }
   else {
      C1_2_Unit = 1000000000000; }
   C1_2_Init = document.HP_Fil_Design.C1_2_Init.value / C1_2_Unit;


   if ( Fil_Type == "MFB" ) {
      C2_2_Est = C1_2_Init/K2_Value;
      document.HP_Fil_Design.C2_2_Est.value = "C2 ~ " + C_Scale(C2_2_Est);
      if (document.HP_Fil_Design.C2_2_Unit.options[0].selected) { C2_2_Unit = 1000000; }
      else { C2_2_Unit = 1000000000000; }
      C2_2_Init = document.HP_Fil_Design.C2_2_Init.value / C2_2_Unit; }
   else if ( Fil_Type == "VCVS" ) {
      C2_2_Est = C1_2_Init/K2_Value;
      if ( Fil_Order == "Fourth" ) {
         document.HP_Fil_Design.C2_2_Est.value = "C1 = C2 = " + C_Scale(C1_2_Init); }
      C2_2_Init = C1_2_Init;
      }


   //***********************************************************************
   // Set the estimated maximum value for C1 and then get the user entered
   // value.
   //***********************************************************************


   Filter_View_Data = Fil_Order + "-Order " + Fil_Type +  " High-Pass Filter\n";
   Filter_View_Data += "-3dB Cutoff Frequency = " + F_C + " Hz\n";
   Filter_View_Data += Fil_Char + " response\n";


   W_C = 2 * Math.PI * F_C;
   K_Calc = C1_1_Init/C2_1_Init;


   document.getElementById("F_Order").innerHTML = Fil_Order;
   document.getElementById("F_Type").innerHTML = Fil_Type;
   document.getElementById("F_Response").innerHTML = Fil_Char;
   document.getElementById("F_Cutoff").innerHTML = F_C + "Hz";


   //***********************************************************************
   // Second-Order MFB Filter.
   //***********************************************************************


   if ( Fil_Type == "MFB" && Fil_Order == "Second" ) {
      document.getElementById("F_Gain").innerHTML = "Stage Gain (K) = " + K1_Value;


      Filter_View_Data += "Stage Gain (K) = " + K1_Value + "\n";
      Filter_View_Data += "\n";
      Filter_View_Data += "Component Values:\n\n";
      Filter_View_Data += "  C1 = " + C_Scale(C1_1_Init) + "\n  C2 = " + C_Scale(C2_1_Init) + "\n";


      document.getElementById("F_Stage_1").innerHTML = "";
      document.getElementById("F_Stage_2").innerHTML = "";
      document.getElementById("F_C1_1").innerHTML = "C<sub>1</sub> = " + C_Scale(C1_1_Init);
      document.getElementById("F_C2_1").innerHTML = "C<sub>2</sub> = " + C_Scale(C2_1_Init);
      document.getElementById("F_C1_2").innerHTML = "";
      document.getElementById("F_C2_2").innerHTML = "";


      //********************************************************************
      // Calculate the component values for a Second-Order MFB Filter.
      //********************************************************************


      X = a*K_Calc;
      Y = (2*K_Calc + 1);
      Z = C1_1_Init * W_C;


      R1_1_Init = X / ( Y * Z );
      R2_1_Init = (b * Y ) / ( a * Z );


      Filter_View_Data += "  R1 = " + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Filter_View_Data += "  R2 = " + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";



      document.getElementById("F_R1_1").innerHTML = "R<sub>1</sub> = " + comma_ins(Math.round(R1_1_Init)) + " Ohms";
      document.getElementById("F_R2_1").innerHTML = "R<sub>2</sub> = " + comma_ins(Math.round(R2_1_Init)) + " Ohms";
      document.getElementById("F_R3_1").innerHTML = "";
      document.getElementById("F_R4_1").innerHTML = "";


      document.getElementById("F_R1_2").innerHTML = "";
      document.getElementById("F_R2_2").innerHTML = "";
      document.getElementById("F_R3_2").innerHTML = "";
      document.getElementById("F_R4_2").innerHTML = "";


      } // End - if ( Fil_Type == "MFB" && Fil_Order == "Second" )


   //***********************************************************************
   // Fourth-Order MFB Filter.
   //***********************************************************************


   else if ( Fil_Type == "MFB" && Fil_Order == "Fourth" ) {
      K_Total = K1_Value * K2_Value;
      document.getElementById("F_Gain").innerHTML = "Overall filter gain (K1 x K2) = " + K1_Value + " x " + K2_Value+ " = " +  + K_Total;


      K1_Actual = Rnd(C1_1_Init/C2_1_Init,3);
      K2_Actual = Rnd(C1_2_Init/C2_2_Init,3);
      K_Actual = K1_Actual * K2_Actual;


      Filter_View_Data += "Stage Gain (K1*K2) = " + K1_Value + " * " + K2_Value + " = " + K_Total + "\n";
      Filter_View_Data += "\n";
      Filter_View_Data += "Component Values, Stage 1:\n\n";
      Filter_View_Data += "  C1 = " + C_Scale(C1_1_Init) + "\n  C2 = " + C_Scale(C2_1_Init) + "\n";


      document.getElementById("F_Stage_1").innerHTML = "<font color=\"#0000af\">Stage 1, Gain (K) = " + K1_Value + "</font>";
      document.getElementById("F_C1_1").innerHTML = "C<sub>1</sub> = " + C_Scale(C1_1_Init);
      document.getElementById("F_C2_1").innerHTML = "C<sub>2</sub> = " + C_Scale(C2_1_Init);


      //********************************************************************
      // Calculate the component values for stage 1 of a Fourth-Order MFB Filter.
      //********************************************************************


      X = a1*K1_Actual;
      Y = (2*K1_Actual + 1);
      Z = C1_1_Init * W_C;


      R1_1_Init = X / ( Y * Z );
      R2_1_Init = (b1 * Y ) / ( a1 * Z );


      Filter_View_Data += "  R1 = " + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Filter_View_Data += "  R2 = " + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";


      document.getElementById("F_R1_1").innerHTML = "R<sub>1</sub> = " + comma_ins(Math.round(R1_1_Init)) + " Ohms";
      document.getElementById("F_R2_1").innerHTML = "R<sub>2</sub> = " + comma_ins(Math.round(R2_1_Init)) + " Ohms";
      document.getElementById("F_R3_1").innerHTML = "";
      document.getElementById("F_R4_1").innerHTML = "";


      Filter_View_Data += "\n";
      Filter_View_Data += "Component Values, Stage 2:\n\n";
      Filter_View_Data += "  C1 = " + C_Scale(C1_2_Init) + "\n  C2 = " + C_Scale(C2_2_Init) + "\n";


      document.getElementById("F_Stage_2").innerHTML = "<font color=\"#0000af\">Stage 2, Gain (K) = " + K2_Value + "</font>";
      document.getElementById("F_C1_2").innerHTML = "C<sub>1</sub> = " + C_Scale(C1_2_Init);
      document.getElementById("F_C2_2").innerHTML = "C<sub>2</sub> = " + C_Scale(C2_2_Init);


      //********************************************************************
      // Calculate the component values for stage 2 of a Fourth-Order MFB Filter.
      //********************************************************************


      X = a2*K2_Actual;
      Y = (2*K2_Actual + 1);
      Z = C1_2_Init * W_C;


      R1_2_Init = X / ( Y * Z );
      R2_2_Init = (b2 * Y ) / ( a2 * Z );


      Filter_View_Data += "  R1 = " + comma_ins(Math.round(R1_2_Init)) + " Ohms\n";
      Filter_View_Data += "  R2 = " + comma_ins(Math.round(R2_2_Init)) + " Ohms\n";


      document.getElementById("F_R1_2").innerHTML = "R<sub>1</sub> = " + comma_ins(Math.round(R1_2_Init)) + " Ohms";
      document.getElementById("F_R2_2").innerHTML = "R<sub>2</sub> = " + comma_ins(Math.round(R2_2_Init)) + " Ohms";
      document.getElementById("F_R3_2").innerHTML = "";
      document.getElementById("F_R4_2").innerHTML = "";


      } // End - else if ( Fil_Type == "MFB" && Fil_Order == "Fourth" )


   //***********************************************************************
   // Second-Order VCVS Filter.
   //***********************************************************************


   else if ( Fil_Type == "VCVS" && Fil_Order == "Second" ) {
      document.getElementById("F_Gain").innerHTML = "Stage Gain (K) = " + K1_Value;


      Filter_View_Data += "Stage Gain (K) = " + K1_Value + "\n";
      Filter_View_Data += "\n";
      Filter_View_Data += "Component Values:\n\n";
      Filter_View_Data += "  C1 = " + C_Scale(C1_1_Init) + "\n  C2 = " + C_Scale(C1_1_Init) + "\n";


      document.getElementById("F_Stage_1").innerHTML = "";
      document.getElementById("F_Stage_2").innerHTML = "";
      document.getElementById("F_C1_1").innerHTML = "C<sub>1</sub> = " + C_Scale(C1_1_Init);
      document.getElementById("F_C2_1").innerHTML = "C<sub>2</sub> = " + C_Scale(C2_1_Init);
      document.getElementById("F_C1_2").innerHTML = "";
      document.getElementById("F_C2_2").innerHTML = "";


      //********************************************************************
      // Calculate the component values for a Second-Order VCVS Filter.
      //********************************************************************


      X = 4 * b;
      Y = Math.pow(a,2) + ( 8 * b * (K1_Value-1) );
      Z = C1_1_Init * W_C;
      R2_1_Init = X / ( Math.sqrt( Y ) * Z );
      R1_1_Init = b/( Math.pow(C1_1_Init,2)* R2_1_Init * Math.pow(W_C,2) );


      //********************************************************************
      // For Unity gain, short R4 and omit R3.
      //********************************************************************


      if ( K1_Value == 1.0 ) {
         R3_1_Init = "Open - Omit"; R4_1_Init = "Short"; }
      else {
         R3_1_Init = (K1_Value*R2_1_Init)/(K1_Value - 1);
         R4_1_Init = K1_Value*R2_1_Init; }


      Filter_View_Data += "  R1 = " + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Filter_View_Data += "  R2 = " + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";


      document.getElementById("F_R1_1").innerHTML = "R<sub>1</sub> = " + comma_ins(Math.round(R1_1_Init)) + " Ohms";
      document.getElementById("F_R2_1").innerHTML = "R<sub>2</sub> = " + comma_ins(Math.round(R2_1_Init)) + " Ohms";


      if ( K1_Value == 1.0 ) {
         Filter_View_Data += "  R3 = " + R3_1_Init + "\n";
         Filter_View_Data += "  R4 = " + R4_1_Init + "\n";
         document.getElementById("F_R3_1").innerHTML = "R<sub>3</sub> = Open - Omit";
         document.getElementById("F_R4_1").innerHTML = "R<sub>4</sub> = Short";
         }
      else {
         Filter_View_Data += "  R3 = " + comma_ins(Math.round(R3_1_Init)) + " Ohms\n";
         Filter_View_Data += "  R4 = " + comma_ins(Math.round(R4_1_Init)) + " Ohms\n";
         document.getElementById("F_R3_1").innerHTML = "R<sub>3</sub> = " + comma_ins(Math.round(R3_1_Init)) + " Ohms";
         document.getElementById("F_R4_1").innerHTML = "R<sub>4</sub> = " + comma_ins(Math.round(R4_1_Init)) + " Ohms";
         }


      document.getElementById("F_R1_2").innerHTML = "";
      document.getElementById("F_R2_2").innerHTML = "";
      document.getElementById("F_R3_2").innerHTML = "";
      document.getElementById("F_R4_2").innerHTML = "";


      } // End - else if ( Fil_Type == "VCVS" && Fil_Order == "Second" )


   //***********************************************************************
   // Fourth-Order VCVS Filter.
   //***********************************************************************


   else if ( Fil_Type == "VCVS" && Fil_Order == "Fourth" ) {
      //********************************************************************
      // Stage 1
      //********************************************************************


      K_Total = K1_Value * K2_Value;
      document.getElementById("F_Gain").innerHTML = "Overall filter gain (K1 x K2) = " + K1_Value + " x " + K2_Value+ " = " +  + K_Total;


      Filter_View_Data += "Stage Gain (K1*K2) = " + K1_Value + " * " + K2_Value + " = " + K_Total + "\n";
      Filter_View_Data += "\n";
      Filter_View_Data += "Component Values, Stage 1:\n\n";
      Filter_View_Data += "  C1 = " + C_Scale(C1_1_Init) + "\n  C2 = " + C_Scale(C2_1_Init) + "\n";


      document.getElementById("F_Stage_1").innerHTML = "<font color=\"#0000af\">Stage 1, Gain (K) = " + K1_Value + "</font>";
      document.getElementById("F_C1_1").innerHTML = "C<sub>1</sub> = " + C_Scale(C1_1_Init);
      document.getElementById("F_C2_1").innerHTML = "C<sub>2</sub> = " + C_Scale(C2_1_Init);


      //********************************************************************
      // Calculate the component values for Stage 1 of a Fourth-Order
      // VCVS Filter.
      //********************************************************************


      X = 4 * b1;
      Y = Math.pow(a1,2) + ( 8 * b1 * (K1_Value-1) );
      Z = C1_1_Init * W_C;
      R2_1_Init = X / ( Math.sqrt( Y ) * Z );
      R1_1_Init = b1/( Math.pow(C1_1_Init,2)* R2_1_Init * Math.pow(W_C,2) );


      //********************************************************************
      // For Unity gain, short R4 and omit R3.
      //********************************************************************


      if ( K1_Value == 1.0 ) {
         R3_1_Init = "Open - Omit"; R4_1_Init = "Short"; }
      else {
         R3_1_Init = (K1_Value*(R1_1_Init + R2_1_Init))/(K1_Value - 1);
         R4_1_Init = K1_Value*(R1_1_Init + R2_1_Init); }


      Filter_View_Data += "  R1 = " + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Filter_View_Data += "  R2 = " + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";
      document.getElementById("F_R1_1").innerHTML = "R<sub>1</sub> = " + comma_ins(Math.round(R1_1_Init)) + " Ohms";
      document.getElementById("F_R2_1").innerHTML = "R<sub>2</sub> = " + comma_ins(Math.round(R2_1_Init)) + " Ohms";


      if ( K1_Value == 1.0 ) {
         Filter_View_Data += "  R3 = " + R3_1_Init + "\n";
         Filter_View_Data += "  R4 = " + R4_1_Init + "\n";
         document.getElementById("F_R3_1").innerHTML = "R<sub>3</sub> = Open - Omit";
         document.getElementById("F_R4_1").innerHTML = "R<sub>4</sub> = Short";
         }
      else {
         Filter_View_Data += "  R3 = " + comma_ins(Math.round(R3_1_Init)) + " Ohms\n";
         Filter_View_Data += "  R4 = " + comma_ins(Math.round(R4_1_Init)) + " Ohms\n";
         document.getElementById("F_R3_1").innerHTML = "R<sub>3</sub> = " + comma_ins(Math.round(R3_1_Init)) + " Ohms";
         document.getElementById("F_R4_1").innerHTML = "R<sub>4</sub> = " + comma_ins(Math.round(R4_1_Init)) + " Ohms";
         }


      //********************************************************************
      // Stage 2
      //********************************************************************


      Filter_View_Data += "\n";
      Filter_View_Data += "Component Values, Stage 2:\n\n";
      Filter_View_Data += "  C1 = " + C_Scale(C1_2_Init) + "\n  C2 = " + C_Scale(C2_2_Init) + "\n";


      document.getElementById("F_Stage_2").innerHTML = "<font color=\"#0000af\">Stage 2, Gain (K) = " + K2_Value + "</font>";
      document.getElementById("F_C1_2").innerHTML = "C<sub>1</sub> = " + C_Scale(C1_2_Init);
      document.getElementById("F_C2_2").innerHTML = "C<sub>2</sub> = " + C_Scale(C2_2_Init);


      //********************************************************************
      // Calculate the component values for Stage 2 of a Fourth-Order
      // VCVS Filter.
      //********************************************************************


      X = 4 * b2;
      Y = Math.pow(a2,2) + ( 8 * b2 * (K2_Value-1) );

      Z = C1_2_Init * W_C;
      R2_2_Init = X / ( Math.sqrt( Y ) * Z );
      R1_2_Init = b2/( Math.pow(C1_2_Init,2)* R2_2_Init * Math.pow(W_C,2) );


      //********************************************************************
      // For Unity gain, short R4 and omit R3.
      //********************************************************************


      if ( K2_Value == 1.0 ) {
         R3_2_Init = "Open - Omit"; R4_2_Init = "Short"; }
      else {
         R3_2_Init = (K2_Value*(R1_2_Init + R2_2_Init))/(K2_Value - 1);
         R4_2_Init = K2_Value*(R1_2_Init + R2_2_Init); }


      Filter_View_Data += "  R1 = " + comma_ins(Math.round(R1_2_Init)) + " Ohms\n";
      Filter_View_Data += "  R2 = " + comma_ins(Math.round(R2_2_Init)) + " Ohms\n";


      document.getElementById("F_R1_2").innerHTML = "R<sub>1</sub> = " + comma_ins(Math.round(R1_2_Init)) + " Ohms";
      document.getElementById("F_R2_2").innerHTML = "R<sub>2</sub> = " + comma_ins(Math.round(R2_2_Init)) + " Ohms";


      if ( K2_Value == 1.0 ) {
         Filter_View_Data += "  R3 = " + R3_2_Init + "\n";
         Filter_View_Data += "  R4 = " + R4_2_Init + "\n";
         document.getElementById("F_R3_2").innerHTML = "R<sub>3</sub> = Open - Omit";
         document.getElementById("F_R4_2").innerHTML = "R<sub>4</sub> = Short";
         }
      else {
         Filter_View_Data += "  R3 = " + comma_ins(Math.round(R3_2_Init)) + " Ohms\n";
         Filter_View_Data += "  R4 = " + comma_ins(Math.round(R4_2_Init)) + " Ohms\n";
         document.getElementById("F_R3_2").innerHTML = "R<sub>3</sub> = " + comma_ins(Math.round(R3_2_Init)) + " Ohms";
         document.getElementById("F_R4_2").innerHTML = "R<sub>4</sub> = " + comma_ins(Math.round(R4_2_Init)) + " Ohms";
         }


   } // End - else if ( Fil_Type == "VCVS" && Fil_Order == "Fourth" )


   //***********************************************************************
   // Choice 1 - Select standard resistor values and calculate new filter
   // parameters.
   //***********************************************************************


   if (document.HP_Fil_Design.Res_Tol.options[0].selected) Res_Tol = "05";
   else Res_Tol = "10";


   Standard_R_Table = "<table align=center border=\"2\" bgcolor=\"#aaffaa\" bordercolor=\"#008b00\" cellpadding=\"5\" cellspacing=\"0\">\n";
   Standard_R_Table += "<TR>";
   Standard_R_Table += "<TD colspan=7><P class=std_10_fbrick align=center><BR>Standard Resistor Options ";
   Standard_R_Table += "for a " + Fil_Order + "-Order " + Fil_Type + " High-Pass Active Filter,<BR>with "
   Standard_R_Table += Fil_Char + " response, and a -3db Cutoff Frequency (Fc) of " + F_C + " Hz.";


   TR = "<TR>\n"
   TD = "<TD><P class=std_10_bold align=center>"


   //***********************************************************************
   // Choice 1 - Second-Order MFB Filter.
   //***********************************************************************


   if ( Fil_Type == "MFB" && Fil_Order == "Second" ) {
      //********************************************************************
      // Calculate filter properties for all of the possible resistor
      // combinations.
      //********************************************************************


      for ( JJ = 0; JJ < 2; JJ++ ) {
         for ( KK = 0; KK < 2; KK++ ) {
            L = JJ*2 + KK*1;
            R1_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[JJ], Res_Tol );
            R2_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[KK], Res_Tol );


            K_Val[L] = C1_1_Init / C2_1_Init;
            WC_Val[L] = (a * K_Val[L])/(C1_1_Init * R1_Val[L] * (2*K_Val[L] + 1) );
            F0_Val[L] = WC_Val[L] / ( 2 * Math.PI ); }  }


      //***********************************************************************
      // Simple bubble sort based on frequency, highest to lowest.
      //***********************************************************************


      for ( I = 0; I < 4; I++ ) {
         for ( J = 0; J < 3; J++ ) {
            if ( F0_Val[J] < F0_Val[J+1] ) {
               F0_Val_Tmp = F0_Val[J]; F0_Val[J] = F0_Val[J+1]; F0_Val[J+1] = F0_Val_Tmp;
               WC_Val_Tmp = WC_Val[J]; WC_Val[J] = WC_Val[J+1]; WC_Val[J+1] = WC_Val_Tmp;
               K_Val_Tmp = K_Val[J]; K_Val[J] = K_Val[J+1]; K_Val[J+1] = K_Val_Tmp;
               R1_Val_Tmp = R1_Val[J]; R1_Val[J] = R1_Val[J+1]; R1_Val[J+1] = R1_Val_Tmp;
               R2_Val_Tmp = R2_Val[J]; R2_Val[J] = R2_Val[J+1]; R2_Val[J+1] = R2_Val_Tmp;
               R3_Val_Tmp = R3_Val[J]; R3_Val[J] = R3_Val[J+1]; R3_Val[J+1] = R3_Val_Tmp; } } }


      STD_Resistors_Data = "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Filter #\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>-3db Frequency\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Gain\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R1\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R2\n"


      Standard_R_Table += "<BR>Intended Stage Gain (K) = " + K1_Value + ".<BR><BR>\n";
      Standard_R_Table += TR + "\n" + TD + "Fil #\n"
      Standard_R_Table += TD + "-3db Frequency\n"
      Standard_R_Table += TD + "Gain K\n"
      Standard_R_Table += TD + "R<sub>1</sub>\n"
      Standard_R_Table += TD + "R<sub>2</sub>\n"


      for ( I = 0; I < 4; I++ ) {
         STD_Resistors_Data += "  <tr>\n"

         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + (I+1) + "\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(F0_Val[I],1) + " Hz\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(K_Val[I],2) + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_Val[I],1,"off") + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_Val[I],1,"off") + "\n";


         Standard_R_Table += TR + "\n" + TD + (I+1) + "\n"
         Standard_R_Table += TD + Rnd(F0_Val[I],1) + " Hz\n"
         Standard_R_Table += TD + Rnd(K_Val[I],2) + "\n"
         Standard_R_Table += TD + R_Format(R1_Val[I],1,"off") + "\n"
         Standard_R_Table += TD + R_Format(R2_Val[I],1,"off") + "\n"
         }
      STD_Resistors_Data += "</table>\n"


      Standard_R_Table += "            </table>\n";
      document.getElementById("Std_R_Table").innerHTML = Standard_R_Table;


   } // End - if ( Fil_Type == "MFB" && Fil_Order == "Second" )


   //***********************************************************************
   // Choice 1 - Fourth-Order MFB Filter.
   //***********************************************************************


   else if ( Fil_Type == "MFB" && Fil_Order == "Fourth" ) {
      //********************************************************************
      // Calculate filter properties for all of the possible resistor
      // combinations for Stage 1.
      //********************************************************************


      for ( JJ = 0; JJ < 2; JJ++ ) {
         for ( KK = 0; KK < 2; KK++ ) {
            L = JJ*2 + KK*1;
            R1A_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[JJ], Res_Tol );
            R2A_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[KK], Res_Tol );


            KA_Val[L] = C1_1_Init / C2_1_Init;
            WCA_Val[L] = (a1 * KA_Val[L])/(C1_1_Init * R1A_Val[L] * (2*KA_Val[L] + 1) );
            F0A_Val[L] = WCA_Val[L] / ( 2 * Math.PI ); } }


      //***********************************************************************
      // Simple bubble sort based on frequency, highest to lowest.
      //***********************************************************************


      for ( I = 0; I < 4; I++ ) {
         for ( J = 0; J < 3; J++ ) {
            if ( F0A_Val[J] < F0A_Val[J+1] ) {
               F0A_Val_Tmp = F0A_Val[J]; F0A_Val[J] = F0A_Val[J+1]; F0A_Val[J+1] = F0A_Val_Tmp;
               WCA_Val_Tmp = WCA_Val[J]; WCA_Val[J] = WCA_Val[J+1]; WCA_Val[J+1] = WCA_Val_Tmp;
               KA_Val_Tmp = KA_Val[J]; KA_Val[J] = KA_Val[J+1]; KA_Val[J+1] = KA_Val_Tmp;
               R1A_Val_Tmp = R1A_Val[J]; R1A_Val[J] = R1A_Val[J+1]; R1A_Val[J+1] = R1A_Val_Tmp;
               R2A_Val_Tmp = R2A_Val[J]; R2A_Val[J] = R2A_Val[J+1]; R2A_Val[J+1] = R2A_Val_Tmp; }  }  }


      STD_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td colspan=6><p class=std_10_bold align=center>Filter Components, Stage 1\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Filter #\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>-3db Frequency\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Gain\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R1\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R2\n"


      Standard_R_Table += "<BR>Intended Overall Filter Gain (K1 x K2) = " + K1_Value + " x " + K2_Value + " = " + K_Total + ".<BR><BR>\n";


      Standard_R_Table += TR + "\n" + "<td colspan=6><p class=std_10_bold align=center><font color=\"#0000af\">Filter Components, Stage 1</font>\n"


      Standard_R_Table += TR + "\n" + TD + "Fil #\n"
      Standard_R_Table += TD + "-3db Frequency\n"
      Standard_R_Table += TD + "Gain K\n"
      Standard_R_Table += TD + "R<sub>1</sub>\n"
      Standard_R_Table += TD + "R<sub>2</sub>\n"


      for ( I = 0; I < 4; I++ ) {
         STD_Resistors_Data += "  <tr>\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + (I+1) + "\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(F0A_Val[I],1) + " Hz\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(KA_Val[I],2) + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1A_Val[I],1,"off") + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2A_Val[I],1,"off") + "\n";


         Standard_R_Table += TR + "\n" + TD + (I+1) + "\n"
         Standard_R_Table += TD + Rnd(F0A_Val[I],1) + " Hz\n"
         Standard_R_Table += TD + Rnd(KA_Val[I],2) + "\n"
         Standard_R_Table += TD + R_Format(R1A_Val[I],1,"off") + "\n"
         Standard_R_Table += TD + R_Format(R2A_Val[I],1,"off") + "\n"
         }


      //*****************************************************************
      // Calculate filter properties for all of the possible resistor
      // combinations for Stage 2.
      //*****************************************************************


      for ( JJ = 0; JJ < 2; JJ++ ) {
         for ( KK = 0; KK < 2; KK++ ) {
            L = JJ*2 + KK*1;
            R1B_Val[L] = Get_Std_Res( R1_2_Init, Sel_Array[JJ], Res_Tol );
            R2B_Val[L] = Get_Std_Res( R2_2_Init, Sel_Array[KK], Res_Tol );


            KB_Val[L] = C1_2_Init / C2_2_Init;
            WCB_Val[L] = (a2 * KB_Val[L])/(C1_2_Init * R1B_Val[L] * (2*KB_Val[L] + 1) );
            F0B_Val[L] = WCB_Val[L] / ( 2 * Math.PI ); }  }


      //***********************************************************************
      // Simple bubble sort based on frequency, highest to lowest.
      //***********************************************************************


      for ( I = 0; I < 4; I++ ) {
         for ( J = 0; J < 3; J++ ) {
            if ( F0B_Val[J] < F0B_Val[J+1] ) {
               F0B_Val_Tmp = F0B_Val[J]; F0B_Val[J] = F0B_Val[J+1]; F0B_Val[J+1] = F0B_Val_Tmp;
               WCB_Val_Tmp = WCB_Val[J]; WCB_Val[J] = WCB_Val[J+1]; WCB_Val[J+1] = WCB_Val_Tmp;
               KB_Val_Tmp = KB_Val[J]; KB_Val[J] = KB_Val[J+1]; KB_Val[J+1] = KB_Val_Tmp;
               R1B_Val_Tmp = R1B_Val[J]; R1B_Val[J] = R1B_Val[J+1]; R1B_Val[J+1] = R1B_Val_Tmp;
               R2B_Val_Tmp = R2B_Val[J]; R2B_Val[J] = R2B_Val[J+1]; R2B_Val[J+1] = R2B_Val_Tmp; }  }  }


      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td colspan=6><p class=std_10_bold align=center>Filter Components, Stage 2\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Filter #\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>-3db Frequency\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Gain\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R1\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R2\n"


      Standard_R_Table += TR + "\n" + "<td colspan=6><p class=std_10_bold align=center><font color=\"#0000af\">Filter Components, Stage 2</font>\n"


      Standard_R_Table += TR + "\n" + TD + "Fil #\n"
      Standard_R_Table += TD + "-3db Frequency\n"
      Standard_R_Table += TD + "Gain K\n"
      Standard_R_Table += TD + "R<sub>1</sub>\n"

      Standard_R_Table += TD + "R<sub>2</sub>\n"


      for ( I = 0; I < 4; I++ ) {
         STD_Resistors_Data += "  <tr>\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + (I+1) + "\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(F0B_Val[I],2) + " Hz\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(KB_Val[I],2) + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1B_Val[I],2,"off") + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2B_Val[I],2,"off") + "\n";


         Standard_R_Table += TR + "\n" + TD + (I+1) + "\n"
         Standard_R_Table += TD + Rnd(F0B_Val[I],1) + " Hz\n"
         Standard_R_Table += TD + Rnd(KB_Val[I],2) + "\n"
         Standard_R_Table += TD + R_Format(R1B_Val[I],1,"off") + "\n"
         Standard_R_Table += TD + R_Format(R2B_Val[I],1,"off") + "\n"
         }


      STD_Resistors_Data += "</table>\n"
      Standard_R_Table += "            </table>\n";
      document.getElementById("Std_R_Table").innerHTML = Standard_R_Table;
   } // End - else if ( Fil_Type == "MFB" && Fil_Order == "Fourth" )


   //***********************************************************************
   // Choice 1 - Second-Order VCVS Filter.
   //***********************************************************************


   else if ( Fil_Type == "VCVS" && Fil_Order == "Second" ) {
      //********************************************************************
      // Calculate filter properties for all of the possible resistor
      // combinations. If the gain is set at one, don't bother itterating
      // on the gain control resistors, R3 and R4.
      //********************************************************************


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {
         for ( II = 0; II < 2; II++ ) {
            for ( JJ = 0; JJ < 2; JJ++ ) {
               L = II*2 + JJ*1;
               K_Val[L] = 1.0; R3_Val[L] = R3_1_Init; R4_Val[L] = R4_1_Init;
               R1_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[II], Res_Tol );
               R2_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[JJ], Res_Tol );


               WC_Val[L] = Math.sqrt( 1 / ( b * Math.pow(C1_1_Init,2) * R1_Val[L] * R2_Val[L] ));
               F0_Val[L] = WC_Val[L] / ( 2 * Math.PI ); } } }
      else {
         for ( II = 0; II < 2; II++ ) {
            for ( JJ = 0; JJ < 2; JJ++ ) {
               for ( KK = 0; KK < 2; KK++ ) {
                  for ( LL = 0; LL < 2; LL++ ) {
                     L = II*8 + JJ*4 + KK*2 + LL*1;
                     R1_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[KK], Res_Tol );
                     R2_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[LL], Res_Tol );


                     WC_Val[L] = Math.sqrt( 1 / ( b * Math.pow(C1_1_Init,2) * R1_Val[L] * R2_Val[L] ));
                     F0_Val[L] = WC_Val[L] / ( 2 * Math.PI );


                     R3_Val[L] = Get_Std_Res( R3_1_Init, Sel_Array[JJ], Res_Tol );
                     R4_Val[L] = Get_Std_Res( R4_1_Init, Sel_Array[II], Res_Tol );
                     K_Val[L] = 1 + (R4_Val[L] / R3_Val[L]); } } } } }


      //***********************************************************************
      // Simple bubble sort based on frequency, highest to lowest.
      //***********************************************************************


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) { Loop_Lim = 4; }
      else { Loop_Lim = 16; }


      for ( I = 0; I < Loop_Lim; I++ ) {
         for ( J = 0; J < Loop_Lim-1; J++ ) {
            if ( F0_Val[J] < F0_Val[J+1] ) {
               F0_Val_Tmp = F0_Val[J]; F0_Val[J] = F0_Val[J+1]; F0_Val[J+1] = F0_Val_Tmp;
               WC_Val_Tmp = WC_Val[J]; WC_Val[J] = WC_Val[J+1]; WC_Val[J+1] = WC_Val_Tmp;
               K_Val_Tmp = K_Val[J]; K_Val[J] = K_Val[J+1]; K_Val[J+1] = K_Val_Tmp;
               R1_Val_Tmp = R1_Val[J]; R1_Val[J] = R1_Val[J+1]; R1_Val[J+1] = R1_Val_Tmp;
               R2_Val_Tmp = R2_Val[J]; R2_Val[J] = R2_Val[J+1]; R2_Val[J+1] = R2_Val_Tmp;
               R3_Val_Tmp = R3_Val[J]; R3_Val[J] = R3_Val[J+1]; R3_Val[J+1] = R3_Val_Tmp;
               R4_Val_Tmp = R4_Val[J]; R4_Val[J] = R4_Val[J+1]; R4_Val[J+1] = R4_Val_Tmp;
               } } }


      STD_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center>Filter Components, Stage 1\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Filter #\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>-3db Frequency\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Gain\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R1\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R2\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R3\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R3\n"


      Standard_R_Table += "<BR>Intended Stage Gain (K) = " + K1_Value + ".<BR><BR>\n";
      Standard_R_Table += TR + "\n" + TD + "Fil #\n"
      Standard_R_Table += TD + "-3db Frequency\n"
      Standard_R_Table += TD + "Gain K\n"
      Standard_R_Table += TD + "R<sub>1</sub>\n"
      Standard_R_Table += TD + "R<sub>2</sub>\n"
      Standard_R_Table += TD + "R<sub>3</sub>\n"
      Standard_R_Table += TD + "R<sub>4</sub>\n"


      for ( I = 0; I < Loop_Lim; I++ ) {
         STD_Resistors_Data += "  <tr>\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + (I+1) + "\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(F0_Val[I],1) + " Hz\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(K_Val[I],2) + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_Val[I],1,"off") + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_Val[I],1,"off") + "\n";


         Standard_R_Table += TR + "\n" + TD + (I+1) + "\n"
         Standard_R_Table += TD + Rnd(F0_Val[I],1) + " Hz\n"
         Standard_R_Table += TD + Rnd(K_Val[I],2) + "\n"
         Standard_R_Table += TD + R_Format(R1_Val[I],1,"off") + "\n"
         Standard_R_Table += TD + R_Format(R2_Val[I],1,"off") + "\n"


         if ( K_Val[I] == 1.0 ) {
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Open - Omit\n";
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Short\n";
            Standard_R_Table += TD + "Open - Omit\n"
            Standard_R_Table += TD + "Short\n"
            }
         else {
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_Val[I],1,"off") + "\n";
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_Val[I],1,"off") + "\n";
            Standard_R_Table += TD + R_Format(R3_Val[I],1,"off") + "\n"
            Standard_R_Table += TD + R_Format(R4_Val[I],1,"off") + "\n"
            }
         }


      STD_Resistors_Data += "</table>\n"


      Standard_R_Table += "            </table>\n";
      document.getElementById("Std_R_Table").innerHTML = Standard_R_Table;


   } // End - else if ( Fil_Type == "VCVS" && Fil_Order == "Second" )


   //***********************************************************************
   // Choice 1 - Fourth-Order VCVS Filter.
   //***********************************************************************


   else if ( Fil_Type == "VCVS" && Fil_Order == "Fourth" ) {
      //********************************************************************
      // Calculate the stage 1 filter properties for all of the possible
      // resistor combinations. If the gain is set at one, don't bother
      // itterating on the gain control resistors, R3 and R4.
      //********************************************************************


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {
         for ( II = 0; II < 2; II++ ) {
            for ( JJ = 0; JJ < 2; JJ++ ) {
               L = II*2 + JJ*1;
               KA_Val[L] = 1.0; R3A_Val[L] = R3_1_Init; R4A_Val[L] = R4_1_Init;
               R1A_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[II], Res_Tol );
               R2A_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[JJ], Res_Tol );


               WCA_Val[L] = Math.sqrt( 1 / ( b1 * Math.pow(C1_1_Init,2) * R1A_Val[L] * R2A_Val[L] ));
               F0A_Val[L] = WCA_Val[L] / ( 2 * Math.PI ); } } }
      else {
         for ( II = 0; II < 2; II++ ) {
            for ( JJ = 0; JJ < 2; JJ++ ) {
               for ( KK = 0; KK < 2; KK++ ) {
                  for ( LL = 0; LL < 2; LL++ ) {
                     L = II*8 + JJ*4 + KK*2 + LL*1;
                     R1A_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[KK], Res_Tol );
                     R2A_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[LL], Res_Tol );


                     WCA_Val[L] = Math.sqrt( 1 / ( b1 * Math.pow(C1_1_Init,2) * R1A_Val[L] * R2A_Val[L] ));
                     F0A_Val[L] = WCA_Val[L] / ( 2 * Math.PI );


                     if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {
                        KA_Val[L] = 1.0;
                        R3A_Val[L] = R3_1_Init;
                        R4A_Val[L] = R4_1_Init; }
                     else {
                        R3A_Val[L] = Get_Std_Res( R3_1_Init, Sel_Array[JJ], Res_Tol );
                        R4A_Val[L] = Get_Std_Res( R4_1_Init, Sel_Array[II], Res_Tol );
                        KA_Val[L] = 1+ (R4A_Val[L] / R3A_Val[L]); } } } } } }


      //***********************************************************************
      // Simple bubble sort based on frequency, highest to lowest.
      //***********************************************************************


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) { Loop_Lim = 4; }
      else { Loop_Lim = 16; }


      for ( I = 0; I < Loop_Lim; I++ ) {
         for ( J = 0; J < Loop_Lim-1; J++ ) {
            if ( F0A_Val[J] < F0A_Val[J+1] ) {
               F0A_Val_Tmp = F0A_Val[J]; F0A_Val[J] = F0A_Val[J+1]; F0A_Val[J+1] = F0A_Val_Tmp;
               WCA_Val_Tmp = WCA_Val[J]; WCA_Val[J] = WCA_Val[J+1]; WCA_Val[J+1] = WCA_Val_Tmp;
               KA_Val_Tmp = KA_Val[J]; KA_Val[J] = KA_Val[J+1]; KA_Val[J+1] = KA_Val_Tmp;
               R1A_Val_Tmp = R1A_Val[J]; R1A_Val[J] = R1A_Val[J+1]; R1A_Val[J+1] = R1A_Val_Tmp;
               R2A_Val_Tmp = R2A_Val[J]; R2A_Val[J] = R2A_Val[J+1]; R2A_Val[J+1] = R2A_Val_Tmp;
               R3A_Val_Tmp = R3A_Val[J]; R3A_Val[J] = R3A_Val[J+1]; R3A_Val[J+1] = R3A_Val_Tmp;
               R4A_Val_Tmp = R4A_Val[J]; R4A_Val[J] = R4A_Val[J+1]; R4A_Val[J+1] = R4A_Val_Tmp; } } }


      STD_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center>Filter Components, Stage 1\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Filter #\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>-3db Frequency\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Gain\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R1\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R2\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R3\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R3\n"


      Standard_R_Table += "<BR>Intended Overall Filter Gain (K1 x K2) = " + K1_Value + " x " + K2_Value + " = " + K_Total + ".<BR><BR>\n";
      Standard_R_Table += TR + "\n" + "<td colspan=7><p class=std_10_bold align=center><font color=\"#0000af\">Filter Components, Stage 1</font>\n"
      Standard_R_Table += TR + "\n" + TD + "Fil #\n"
      Standard_R_Table += TD + "-3db Frequency\n"
      Standard_R_Table += TD + "Gain K\n"
      Standard_R_Table += TD + "R<sub>1</sub>\n"
      Standard_R_Table += TD + "R<sub>2</sub>\n"
      Standard_R_Table += TD + "R<sub>3</sub>\n"
      Standard_R_Table += TD + "R<sub>4</sub>\n"


      for ( I = 0; I < Loop_Lim; I++ ) {
         STD_Resistors_Data += "  <tr>\n"

         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + (I+1) + "\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(F0A_Val[I],1) + " Hz\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(KA_Val[I],2) + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1A_Val[I],1,"off") + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2A_Val[I],1,"off") + "\n";


         Standard_R_Table += TR + "\n" + TD + (I+1) + "\n"
         Standard_R_Table += TD + Rnd(F0A_Val[I],1) + " Hz\n"
         Standard_R_Table += TD + Rnd(KA_Val[I],2) + "\n"
         Standard_R_Table += TD + R_Format(R1A_Val[I],1,"off") + "\n"
         Standard_R_Table += TD + R_Format(R2A_Val[I],1,"off") + "\n"


         if ( K_Val[I] == 1.0 ) {
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Open - Omit\n";
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Short\n";
            Standard_R_Table += TD + "Open - Omit\n"
            Standard_R_Table += TD + "Short\n"
            }
         else {
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3A_Val[I],1,"off") + "\n";
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4A_Val[I],1,"off") + "\n";
            Standard_R_Table += TD + R_Format(R3A_Val[I],1,"off") + "\n"
            Standard_R_Table += TD + R_Format(R4A_Val[I],1,"off") + "\n"
            } }


      //********************************************************************
      // Calculate the stage 2 filter properties for all of the possible
      // resistor combinations. If the gain is set at one, don't bother
      // itterating on the gain control resistors, R3 and R4.
      //********************************************************************


      if ( R3_2_Init == "Open - Omit" && R4_2_Init == "Short" ) {
         for ( II = 0; II < 2; II++ ) {
            for ( JJ = 0; JJ < 2; JJ++ ) {
               L = II*2 + JJ*1;
               KB_Val[L] = 1.0; R3B_Val[L] = R3_2_Init; R4B_Val[L] = R4_2_Init;
               R1B_Val[L] = Get_Std_Res( R1_1_Init, Sel_Array[II], Res_Tol );
               R2B_Val[L] = Get_Std_Res( R2_1_Init, Sel_Array[JJ], Res_Tol );


               WCB_Val[L] = Math.sqrt( 1 / ( b2 * Math.pow(C1_2_Init,2) * R1B_Val[L] * R2B_Val[L] ));
               F0B_Val[L] = WCB_Val[L] / ( 2 * Math.PI ); } } }
      else {
         for ( II = 0; II < 2; II++ ) {
            for ( JJ = 0; JJ < 2; JJ++ ) {
               for ( KK = 0; KK < 2; KK++ ) {
                  for ( LL = 0; LL < 2; LL++ ) {
                     L = II*8 + JJ*4 + KK*2 + LL*1;
                     R1B_Val[L] = Get_Std_Res( R1_2_Init, Sel_Array[KK], Res_Tol );
                     R2B_Val[L] = Get_Std_Res( R2_2_Init, Sel_Array[LL], Res_Tol );


                     WCB_Val[L] = Math.sqrt( 1 / ( b2 * Math.pow(C1_2_Init,2) * R1B_Val[L] * R2B_Val[L] ));
                     F0B_Val[L] = WCB_Val[L] / ( 2 * Math.PI );


                     if ( R3_2_Init == "Open - Omit" && R4_2_Init == "Short" ) {
                        KB_Val[L] = 1.0;
                        R3B_Val[L] = R3_2_Init;
                        R4B_Val[L] = R4_2_Init; }
                     else {
                        R3B_Val[L] = Get_Std_Res( R3_2_Init, Sel_Array[JJ], Res_Tol );
                        R4B_Val[L] = Get_Std_Res( R4_2_Init, Sel_Array[II], Res_Tol );
                        KB_Val[L] = 1 + (R4B_Val[L] / R3B_Val[L]); } } } } } }


      //***********************************************************************
      // Simple bubble sort based on frequency, highest to lowest.
      //***********************************************************************


      if ( R3_2_Init == "Open - Omit" && R4_2_Init == "Short" ) { Loop_Lim = 4; }
      else { Loop_Lim = 16; }


      for ( I = 0; I < Loop_Lim; I++ ) {
         for ( J = 0; J < Loop_Lim-1; J++ ) {
            if ( F0B_Val[J] < F0B_Val[J+1] ) {
               F0B_Val_Tmp = F0B_Val[J]; F0B_Val[J] = F0B_Val[J+1]; F0B_Val[J+1] = F0B_Val_Tmp;
               WCB_Val_Tmp = WCB_Val[J]; WCB_Val[J] = WCB_Val[J+1]; WCB_Val[J+1] = WCB_Val_Tmp;
               KB_Val_Tmp = KB_Val[J]; KB_Val[J] = KB_Val[J+1]; KB_Val[J+1] = KB_Val_Tmp;
               R1B_Val_Tmp = R1B_Val[J]; R1B_Val[J] = R1B_Val[J+1]; R1B_Val[J+1] = R1B_Val_Tmp;
               R2B_Val_Tmp = R2B_Val[J]; R2B_Val[J] = R2B_Val[J+1]; R2B_Val[J+1] = R2B_Val_Tmp;
               R3B_Val_Tmp = R3B_Val[J]; R3B_Val[J] = R3B_Val[J+1]; R3B_Val[J+1] = R3B_Val_Tmp;
               R4B_Val_Tmp = R4B_Val[J]; R4B_Val[J] = R4B_Val[J+1]; R4B_Val[J+1] = R4B_Val_Tmp; } } }


      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center>Filter Components, Stage 2\n"
      STD_Resistors_Data += "  <tr>\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Filter #\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>-3db Frequency\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Gain\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R1\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R2\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R3\n"
      STD_Resistors_Data += "    <td><p class=std_10_bold align=center>R3\n"


      Standard_R_Table += TR + "\n" + "<td colspan=7><p class=std_10_bold align=center><font color=\"#0000af\">Filter Components, Stage 2</font>\n"
      Standard_R_Table += TR + "\n" + TD + "Fil #\n"
      Standard_R_Table += TD + "-3db Frequency\n"
      Standard_R_Table += TD + "Gain K\n"
      Standard_R_Table += TD + "R<sub>1</sub>\n"
      Standard_R_Table += TD + "R<sub>2</sub>\n"
      Standard_R_Table += TD + "R<sub>3</sub>\n"
      Standard_R_Table += TD + "R<sub>4</sub>\n"


      for ( I = 0; I < Loop_Lim; I++ ) {
         STD_Resistors_Data += "  <tr>\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + (I+1) + "\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(F0B_Val[I],1) + " Hz\n"
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(KB_Val[I],2) + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1B_Val[I],1,"off") + "\n";
         STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2B_Val[I],1,"off") + "\n";


         Standard_R_Table += TR + "\n" + TD + (I+1) + "\n"
         Standard_R_Table += TD + Rnd(F0B_Val[I],1) + " Hz\n"
         Standard_R_Table += TD + Rnd(KB_Val[I],2) + "\n"
         Standard_R_Table += TD + R_Format(R1B_Val[I],1,"off") + "\n"
         Standard_R_Table += TD + R_Format(R2B_Val[I],1,"off") + "\n"


         if ( K_Val[I] == 1.0 ) {
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Open - Omit\n";
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>Short\n";
            Standard_R_Table += TD + "Open - Omit\n"
            Standard_R_Table += TD + "Short\n"
            }
         else {
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3A_Val[I],1,"off") + "\n";
            STD_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4A_Val[I],1,"off") + "\n";
            Standard_R_Table += TD + R_Format(R3B_Val[I],1,"off") + "\n"
            Standard_R_Table += TD + R_Format(R4B_Val[I],1,"off") + "\n"
            } }


      STD_Resistors_Data += "</table>\n"


      Standard_R_Table += "            </table>\n";
      document.getElementById("Std_R_Table").innerHTML = Standard_R_Table;
   } // End - else if ( Fil_Type == "VCVS" && Fil_Order == "Fourth" )


   //***********************************************************************
   // Choice 2 - Calculate two standard resistors that, when wired in
   // parallel, will equal the initial design resistor values.
   //***********************************************************************


   if (document.HP_Fil_Design.Prec_Res_Tol.options[0].selected) Prec_Res_Tol = "05";
   else Prec_Res_Tol = "10";


   TR = "<TR>\n"
   TD = "<TD><P class=std_10_bold align=center>"


   Custom_R_Table = "<table align=center border=\"2\" bgcolor=\"#aaffaa\" bordercolor=\"#008b00\" cellpadding=\"5\" cellspacing=\"0\">\n";
   Custom_R_Table += TR;


   //***********************************************************************
   // Choice 2 - Second-Order MFB Filter.
   //***********************************************************************


   if ( Fil_Type == "MFB" && Fil_Order == "Second" ) {


      Prec_Res_Calc( R1_1_Init, Prec_Res_Tol );
      R1_A = RA_Std; R1_B = RB_Std; R1_Prec = RC_Prec; R1_Delta = R_Delta;
      Prec_Res_Calc( R2_1_Init, Prec_Res_Tol );
      R2_A = RA_Std; R2_B = RB_Std; R2_Prec = RC_Prec; R2_Delta = R_Delta;


      //*****************************************************************
      // Reverse calculation from the precision resistors formed by two
      // standard resistors in parallel, for each resistor.
      //*****************************************************************


      RP_K_Value = C1_1_Init / C2_1_Init;
      RP_W0 = (a * RP_K_Value)/(C1_1_Init * R1_Prec * (2*RP_K_Value + 1) );
      RP_F0 = RP_W0 / ( 2 * Math.PI );


      PREC_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      PREC_Resistors_Data += "  <tr>\n";
      PREC_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center><font color=\"#b22222\">\n";
      PREC_Resistors_Data += "    " + Fil_Order + "-Order " + Fil_Type + " High-Pass Filter, ";
      PREC_Resistors_Data += Fil_Char + " response characteristics.</font><br><br>\n";
      PREC_Resistors_Data += "    <font color=\"#b22222\">-3 dB Cutoff Frequency = " + Rnd(RP_F0,1) + " Hz, ";
      PREC_Resistors_Data += "Gain (K) = " + Rnd(RP_K_Value,3) + "</font><br><br>\n";


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Resistor\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra || Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Deviation\n";


      Custom_R_Table += "<TD colspan=6><P class=std_10_fbrick align=center><BR>Precision ";
      Custom_R_Table += "Resistor Options Values calculated to yield a ";
      Custom_R_Table += Fil_Order + "-Order " + Fil_Type + " High-Pass Active Filter with "
      Custom_R_Table += Fil_Char + " response.<BR><BR>\n";
      Custom_R_Table += "<FONT color=\"#0000af\">-3db Cutoff Frequency (Fc) of " + Rnd(RP_F0,1) + " Hz and a \n";
      Custom_R_Table += "Stage Gain (K) of " + Rnd(RP_K_Value,3) + ".</font><br><br>\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "Resistor\n";
      Custom_R_Table += TD + "Intended<BR>Value\n";
      Custom_R_Table += "<TD colspan=2><P class=std_10_bold align=center>R<sub>A</sub> || R<sub>B</sub> Parallel Combination\n";
      Custom_R_Table += TD + "Actual<BR>Value (R)\n";
      Custom_R_Table += TD + "Delta\n";


      //*****************************************************************
      // Setup the line for R1. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R1 = " + comma_ins(Math.round(R1_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R1_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R1_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>1</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R1_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R1_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R1_Delta,2) + " %\n";


      //*****************************************************************
      // Setup the line for R2. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R2 = " + comma_ins(Math.round(R2_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R2_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R2_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>2</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R2_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R2_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R2_Delta,2) + " %\n";


      PREC_Resistors_Data += "</table>\n"


      Standard_R_Table += "            </table>\n";
      document.getElementById("Cust_R_Table").innerHTML = Custom_R_Table;
   } // End - if ( Fil_Type == "MFB" && Fil_Order == "Second" )


   //***********************************************************************
   // Choice 2 - Fourth-Order MFB Filter.
   //***********************************************************************


   else if ( Fil_Type == "MFB" && Fil_Order == "Fourth" ) {


      Prec_Res_Calc( R1_1_Init, Prec_Res_Tol );
      R1_1_A = RA_Std; R1_1_B = RB_Std; R1_1_Prec = RC_Prec; R1_1_Delta = R_Delta;
      Prec_Res_Calc( R2_1_Init, Prec_Res_Tol );
      R2_1_A = RA_Std; R2_1_B = RB_Std; R2_1_Prec = RC_Prec; R2_1_Delta = R_Delta;


      //*****************************************************************
      // Reverse calculation from the precision resistors formed by two
      // standard resistors in parallel, for each resistor.
      //*****************************************************************


      RP_K1_Value = C1_1_Init / C2_1_Init;
      RP_K2_Value = C1_2_Init / C2_2_Init;


      RP_1_W0 = (a1 * RP_K1_Value)/(C1_1_Init * R1_1_Prec * (2*RP_K1_Value + 1) );
      RP_1_F0 = RP_1_W0 / ( 2 * Math.PI );


      PREC_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      PREC_Resistors_Data += "  <tr>\n";
      PREC_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center><font color=\"#b22222\">\n";
      PREC_Resistors_Data += "    " + Fil_Order + "-Order " + Fil_Type + " High-Pass Filter, ";
      PREC_Resistors_Data += Fil_Char + " response characteristics.</font><br><br>\n";
      PREC_Resistors_Data += "    <font color=\"#b22222\">Filter Stage 1: -3 dB Cutoff Frequency = " + Rnd(RP_1_F0,1) + " Hz, ";
      PREC_Resistors_Data += "Gain (K) = " + Rnd(RP_K1_Value,3) + "</font><br><br>\n";


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Resistor\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra\n";

      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra || Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Deviation\n";


      Custom_R_Table += "<TD colspan=6><P class=std_10_fbrick align=center><BR>Precision ";
      Custom_R_Table += "Resistor Options Values calculated to yield a ";
      Custom_R_Table += Fil_Order + "-Order " + Fil_Type + " High-Pass Active Filter with "
      Custom_R_Table += Fil_Char + " response.<BR><BR>\n";
      Custom_R_Table += "<FONT color=\"#0000af\">-3db Cutoff Frequency (Fc) of " + Rnd(RP_1_F0,1) + " Hz and a \n";
      Custom_R_Table += "Stage 1 Gain (K) of " + Rnd(RP_K1_Value,3) + ".</font><br><br>\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "Resistor\n";
      Custom_R_Table += TD + "Intended<BR>Value\n";
      Custom_R_Table += "<TD colspan=2><P class=std_10_bold align=center>R<sub>A</sub> || R<sub>B</sub> Parallel Combination\n";
      Custom_R_Table += TD + "Actual<BR>Value (R)\n";
      Custom_R_Table += TD + "Delta\n";


      //*****************************************************************
      // Setup the line for R1. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R1 = " + comma_ins(Math.round(R1_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_1_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_1_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R1_1_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R1_1_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>1</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R1_1_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R1_1_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_1_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R1_1_Delta,2) + " %\n";


      //*****************************************************************
      // Setup the line for R2. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R2 = " + comma_ins(Math.round(R2_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_1_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_1_B,1,"off") + "\n";

      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R2_1_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R2_1_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>2</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R2_1_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R2_1_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_1_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R2_1_Delta,2) + " %\n";


      //*****************************************************************
      // Reverse calculation from the precision resistors formed by two
      // standard resistors in parallel, for each resistor.
      //*****************************************************************


      RP_2_W0 = (a1 * RP_K2_Value)/(C1_1_Init * R1_1_Prec * (2*RP_K2_Value + 1) );
      RP_2_F0 = RP_2_W0 / ( 2 * Math.PI );


      Prec_Res_Calc( R1_2_Init, Prec_Res_Tol );
      R1_2_A = RA_Std; R1_2_B = RB_Std; R1_2_Prec = RC_Prec; R1_2_Delta = R_Delta;
      Prec_Res_Calc( R2_2_Init, Prec_Res_Tol );
      R2_2_A = RA_Std; R2_2_B = RB_Std; R2_2_Prec = RC_Prec; R2_2_Delta = R_Delta;


      PREC_Resistors_Data += "  <tr>\n";
      PREC_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center><font color=\"#b22222\">\n";
      PREC_Resistors_Data += "<br>\n";
      PREC_Resistors_Data += "    <font color=\"#b22222\">Filter Stage 2: -3 dB Cutoff Frequency = " + Rnd(RP_2_F0,1) + " Hz, ";
      PREC_Resistors_Data += "Gain (K) = " + Rnd(RP_K2_Value,3) + "</font><br><br>\n";


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Resistor\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra || Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Deviation\n";


      Custom_R_Table += TR;
      Custom_R_Table += "<TD colspan=6><P class=std_10_fbrick align=center><BR>";
      Custom_R_Table += "<FONT color=\"#0000af\">-3db Cutoff Frequency (Fc) of " + Rnd(RP_2_F0,1) + " Hz and a \n";
      Custom_R_Table += "Stage 2 Gain (K) of " + Rnd(RP_K2_Value,3) + ".</font><br><br>\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "Resistor\n";
      Custom_R_Table += TD + "Intended<BR>Value\n";
      Custom_R_Table += "<TD colspan=2><P class=std_10_bold align=center>R<sub>A</sub> || R<sub>B</sub> Parallel Combination\n";
      Custom_R_Table += TD + "Actual<BR>Value (R)\n";
      Custom_R_Table += TD + "Delta\n";


      //*****************************************************************
      // Setup the line for R1. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R1 = " + comma_ins(Math.round(R1_2_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_2_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_2_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R1_2_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R1_2_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>1</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_2_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R1_2_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R1_2_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_2_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R1_2_Delta,2) + " %\n";


      //*****************************************************************
      // Setup the line for R2. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R2 = " + comma_ins(Math.round(R2_2_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_2_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_2_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R2_2_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R2_2_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>2</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_2_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R2_2_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R2_2_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_2_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R2_2_Delta,2) + " %\n";


      //*****************************************************************
      // Reverse calculation from the precision resistors formed by two
      // standard resistors in parallel, for each resistor.
      //*****************************************************************


      RP_2_K_Value = C1_2_Init / C2_2_Init;
      RP_2_W0 = (a2 * RP_2_K_Value)/(C1_2_Init * R1_2_Prec * (2*RP_2_K_Value + 1) );
      RP_2_F0 = RP_2_W0 / ( 2 * Math.PI );


      PREC_Resistors_Data += "</table><!----->\n"


      Standard_R_Table += "            </table>\n";
      document.getElementById("Cust_R_Table").innerHTML = Custom_R_Table;
   } // End - else if ( Fil_Type == "MFB" && Fil_Order == "Fourth" )


   //***********************************************************************
   // Choice 2 - Second-Order VCVS Filter.
   //***********************************************************************


   else if ( Fil_Type == "VCVS" && Fil_Order == "Second" ) {


      Prec_Res_Calc( R1_1_Init, Prec_Res_Tol );
      R1_A = RA_Std; R1_B = RB_Std; R1_Prec = RC_Prec; R1_Delta = R_Delta;
      Prec_Res_Calc( R2_1_Init, Prec_Res_Tol );
      R2_A = RA_Std; R2_B = RB_Std; R2_Prec = RC_Prec; R2_Delta = R_Delta;
      Prec_Res_Calc( R3_1_Init, Prec_Res_Tol );
      R3_A = RA_Std; R3_B = RB_Std; R3_Prec = RC_Prec; R3_Delta = R_Delta;
      Prec_Res_Calc( R4_1_Init, Prec_Res_Tol );
      R4_A = RA_Std; R4_B = RB_Std; R4_Prec = RC_Prec; R4_Delta = R_Delta;


      //********************************************************************
      // Reverse calculation from the precision resistors formed by two standard
      // resistors in parallel, for each resistor.
      //********************************************************************


      RP_W0 = Math.sqrt( 1 / ( b * Math.pow(C1_1_Init,2) * R1_Prec * R2_Prec ));
      RP_F0 = RP_W0 / ( 2 * Math.PI );


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {
         RP_K_Value = 1.0; }
      else {
         RP_K_Value = 1 + (R4_Prec / R3_Prec); }


      PREC_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      PREC_Resistors_Data += "  <tr>\n";
      PREC_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center><font color=\"#b22222\">\n";
      PREC_Resistors_Data += "    " + Fil_Order + "-Order " + Fil_Type + " High-Pass Filter, ";
      PREC_Resistors_Data += Fil_Char + " response characteristics.</font><br><br>\n";
      PREC_Resistors_Data += "    <font color=\"#b22222\">-3 dB Cutoff Frequency = " + Rnd(RP_F0,1) + " Hz, ";
      PREC_Resistors_Data += "Gain (K) = " + Rnd(RP_K_Value,3) + "</font><br><br>\n";


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Resistor\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra || Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Deviation\n";


      Custom_R_Table += "<TD colspan=6><P class=std_10_fbrick align=center><BR>Precision ";
      Custom_R_Table += "Resistor Options Values calculated to yield a ";
      Custom_R_Table += Fil_Order + "-Order " + Fil_Type + " High-Pass Active Filter with "
      Custom_R_Table += Fil_Char + " response.<BR><BR>\n";
      Custom_R_Table += "<FONT color=\"#0000af\">-3db Cutoff Frequency (Fc) of " + Rnd(RP_F0,1) + " Hz and a \n";
      Custom_R_Table += "Stage Gain (K) of " + Rnd(RP_K_Value,3) + ".</font><br><br>\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "Resistor\n";
      Custom_R_Table += TD + "Intended<BR>Value\n";
      Custom_R_Table += "<TD colspan=2><P class=std_10_bold align=center>R<sub>A</sub> || R<sub>B</sub> Parallel Combination\n";
      Custom_R_Table += TD + "Actual<BR>Value (R)\n";
      Custom_R_Table += TD + "Delta\n";


      //*****************************************************************
      // Setup the line for R1. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R1 = " + comma_ins(Math.round(R1_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R1_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R1_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>1</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R1_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R1_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R1_Delta,2) + " %\n";


      //*****************************************************************
      // Setup the line for R2. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R2 = " + comma_ins(Math.round(R2_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R2_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R2_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>2</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R2_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R2_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R2_Delta,2) + " %\n";


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R3 = Open - Omit\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>3</sub>\n";
         Custom_R_Table += TD + "Open - Omit\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R4 = Short\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>4</sub>\n";
         Custom_R_Table += TD + "Short\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         }
      else {


         //*****************************************************************
         // Setup the line for R3. The if statements increases the space for
         // numbers under 1,000,000.
         //*****************************************************************


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R3 = " + comma_ins(Math.round(R3_1_Init)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_A,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_B,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R3_Prec)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R3_Delta,2) + " %\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>3</sub>\n";
         Custom_R_Table += TD + comma_ins(Math.round(R3_1_Init)) + " Ohms\n";
         Custom_R_Table += TD + R_Format(R3_A,1,"on") + "\n";
         Custom_R_Table += TD + R_Format(R3_B,1,"on") + "\n";
         Custom_R_Table += TD + comma_ins(Math.round(R3_Prec)) + " Ohms\n";
         Custom_R_Table += TD + Rnd(R3_Delta,2) + " %\n";


         //*****************************************************************
         // Setup the line for R4. The if statements increases the space for
         // numbers under 1,000,000.
         //*****************************************************************


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R4 = " + comma_ins(Math.round(R4_1_Init)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_A,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_B,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R4_Prec)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R4_Delta,2) + " %\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>4</sub>\n";
         Custom_R_Table += TD + comma_ins(Math.round(R4_1_Init)) + " Ohms\n";
         Custom_R_Table += TD + R_Format(R4_A,1,"on") + "\n";
         Custom_R_Table += TD + R_Format(R4_B,1,"on") + "\n";
         Custom_R_Table += TD + comma_ins(Math.round(R4_Prec)) + " Ohms\n";
         Custom_R_Table += TD + Rnd(R4_Delta,2) + " %\n";
         }


      PREC_Resistors_Data += "</table>\n"


      Standard_R_Table += "            </table>\n";
      document.getElementById("Cust_R_Table").innerHTML = Custom_R_Table;
   } // End - else if ( Fil_Type == "VCVS" && Fil_Order == "Second" )


   //***********************************************************************
   // Choice 2 - Fourth-Order VCVS Filter.
   //***********************************************************************


   else if ( Fil_Type == "VCVS" && Fil_Order == "Fourth" ) {


      Prec_Res_Calc( R1_1_Init, Prec_Res_Tol );
      R1_1_A = RA_Std; R1_1_B = RB_Std; R1_1_Prec = RC_Prec; R1_1_Delta = R_Delta;
      Prec_Res_Calc( R2_1_Init, Prec_Res_Tol );
      R2_1_A = RA_Std; R2_1_B = RB_Std; R2_1_Prec = RC_Prec; R2_1_Delta = R_Delta;
      Prec_Res_Calc( R3_1_Init, Prec_Res_Tol );
      R3_1_A = RA_Std; R3_1_B = RB_Std; R3_1_Prec = RC_Prec; R3_1_Delta = R_Delta;
      Prec_Res_Calc( R4_1_Init, Prec_Res_Tol );
      R4_1_A = RA_Std; R4_1_B = RB_Std; R4_1_Prec = RC_Prec; R4_1_Delta = R_Delta;


      //********************************************************************
      // Reverse calculation from the precision resistors formed by two standard
      // resistors in parallel, for each resistor.
      //********************************************************************


      RP_1_W0 = Math.sqrt( 1 / ( b1 * Math.pow(C1_1_Init,2) * R1_1_Prec * R2_1_Prec ));
      RP_1_F0 = RP_1_W0 / ( 2 * Math.PI );


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {
         RP_1_K_Value = 1.0; }
      else {
         RP_1_K_Value = 1 + (R4_1_Prec / R3_1_Prec); }


      Prec_Res_Calc( R1_2_Init, Prec_Res_Tol );
      R1_2_A = RA_Std; R1_2_B = RB_Std; R1_2_Prec = RC_Prec; R1_2_Delta = R_Delta;
      Prec_Res_Calc( R2_2_Init, Prec_Res_Tol );
      R2_2_A = RA_Std; R2_2_B = RB_Std; R2_2_Prec = RC_Prec; R2_2_Delta = R_Delta;
      Prec_Res_Calc( R3_2_Init, Prec_Res_Tol );
      R3_2_A = RA_Std; R3_2_B = RB_Std; R3_2_Prec = RC_Prec; R3_2_Delta = R_Delta;
      Prec_Res_Calc( R4_2_Init, Prec_Res_Tol );
      R4_2_A = RA_Std; R4_2_B = RB_Std; R4_2_Prec = RC_Prec; R4_2_Delta = R_Delta;


      //********************************************************************
      // Reverse calculation from the precision resistors formed by two standard
      // resistors in parallel, for each resistor.
      //********************************************************************


      RP_2_W0 = Math.sqrt( 1 / ( b2 * Math.pow(C1_1_Init,2) * R1_2_Prec * R2_2_Prec ));
      RP_2_F0 = RP_2_W0 / ( 2 * Math.PI );


      if ( R3_2_Init == "Open - Omit" && R4_2_Init == "Short" ) {
         RP_2_K_Value = 1.0; }
      else {
         RP_2_K_Value = 1 + (R4_2_Prec / R3_2_Prec); }


      PREC_Resistors_Data = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"1\">\n"
      PREC_Resistors_Data += "  <tr>\n";
      PREC_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center><font color=\"#b22222\">\n";
      PREC_Resistors_Data += "    " + Fil_Order + "-Order " + Fil_Type + " High-Pass Filter, ";
      PREC_Resistors_Data += Fil_Char + " response characteristics.</font><br><br>\n";
      PREC_Resistors_Data += "    <font color=\"#b22222\">-3 dB Cutoff Frequency = " + Rnd(RP_1_F0,1) + " Hz, ";
      PREC_Resistors_Data += "Gain (K) = " + Rnd(RP_1_K_Value,3) + "</font><br><br>\n";


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Resistor\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra || Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Deviation\n";


      Custom_R_Table += "<TD colspan=6><P class=std_10_fbrick align=center><BR>Precision ";
      Custom_R_Table += "Resistor Options Values calculated to yield a ";
      Custom_R_Table += Fil_Order + "-Order " + Fil_Type + " High-Pass Active Filter with "
      Custom_R_Table += Fil_Char + " response.<BR><BR>\n";
      Custom_R_Table += "<FONT color=\"#0000af\">-3db Cutoff Frequency (Fc) of " + Rnd(RP_1_F0,1) + " Hz and a \n";
      Custom_R_Table += "Stage 1 Gain (K) of " + Rnd(RP_1_K_Value,3) + ".</font><br><br>\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "Resistor\n";
      Custom_R_Table += TD + "Intended<BR>Value\n";
      Custom_R_Table += "<TD colspan=2><P class=std_10_bold align=center>R<sub>A</sub> || R<sub>B</sub> Parallel Combination\n";
      Custom_R_Table += TD + "Actual<BR>Value (R)\n";
      Custom_R_Table += TD + "Delta\n";


      //*****************************************************************
      // Setup the line for R1. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R1 = " + comma_ins(Math.round(R1_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_1_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_1_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R1_1_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R1_1_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>1</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R1_1_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R1_1_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_1_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R1_1_Delta,2) + " %\n";


      //*****************************************************************
      // Setup the line for R2. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R2 = " + comma_ins(Math.round(R2_1_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_1_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_1_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R2_1_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R2_1_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>2</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_1_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R2_1_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R2_1_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_1_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R2_1_Delta,2) + " %\n";


      if ( R3_1_Init == "Open - Omit" && R4_1_Init == "Short" ) {
         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R3 = Open - Omit\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>3</sub>\n";
         Custom_R_Table += TD + "Open - Omit\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R4 = Short\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>4</sub>\n";
         Custom_R_Table += TD + "Short\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         }
      else {
         //*****************************************************************
         // Setup the line for R3. The if statements increases the space for
         // numbers under 1,000,000.
         //*****************************************************************


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>3</sub>\n";
         Custom_R_Table += TD + comma_ins(Math.round(R3_1_Init)) + " Ohms\n";
         Custom_R_Table += TD + R_Format(R3_1_A,1,"on") + "\n";
         Custom_R_Table += TD + R_Format(R3_1_B,1,"on") + "\n";
         Custom_R_Table += TD + comma_ins(Math.round(R3_1_Prec)) + " Ohms\n";
         Custom_R_Table += TD + Rnd(R3_1_Delta,2) + " %\n";


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R3 = " + comma_ins(Math.round(R3_1_Init)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_1_A,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_1_B,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R3_1_Prec)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R3_1_Delta,2) + " %\n";


         //*****************************************************************
         // Setup the line for R4. The if statements increases the space for
         // numbers under 1,000,000.
         //*****************************************************************


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R4 = " + comma_ins(Math.round(R4_1_Init)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_1_A,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_1_B,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R4_1_Prec)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R4_1_Delta,2) + " %\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>4</sub>\n";
         Custom_R_Table += TD + comma_ins(Math.round(R4_1_Init)) + " Ohms\n";
         Custom_R_Table += TD + R_Format(R4_1_A,1,"on") + "\n";
         Custom_R_Table += TD + R_Format(R4_1_B,1,"on") + "\n";
         Custom_R_Table += TD + comma_ins(Math.round(R4_1_Prec)) + " Ohms\n";
         Custom_R_Table += TD + Rnd(R4_1_Delta,2) + " %\n";
         }


      PREC_Resistors_Data += "  <tr>\n";
      PREC_Resistors_Data += "    <td colspan=7><p class=std_10_bold align=center><font color=\"#b22222\">\n";
      PREC_Resistors_Data += "      <BR><font color=\"#b22222\">-3 dB Cutoff Frequency = " + Rnd(RP_2_F0,1) + " Hz, ";
      PREC_Resistors_Data += "Gain (K) = " + Rnd(RP_2_K_Value,3) + "</font><br><br>\n";


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Resistor\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Ra || Rb\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>Deviation\n";


      Custom_R_Table += TR;
      Custom_R_Table += "<TD colspan=6><P class=std_10_fbrick align=center><BR>";
      Custom_R_Table += "<FONT color=\"#0000af\">-3db Cutoff Frequency (Fc) of " + Rnd(RP_2_F0,1) + " Hz and a \n";
      Custom_R_Table += "Stage 2 Gain (K) of " + Rnd(RP_2_K_Value,3) + ".</font><br><br>\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "Resistor\n";
      Custom_R_Table += TD + "Intended<BR>Value\n";
      Custom_R_Table += "<TD colspan=2><P class=std_10_bold align=center>R<sub>A</sub> || R<sub>B</sub> Parallel Combination\n";
      Custom_R_Table += TD + "Actual<BR>Value (R)\n";
      Custom_R_Table += TD + "Delta\n";


      //*****************************************************************
      // Setup the line for R1. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R1 = " + comma_ins(Math.round(R1_2_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_2_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R1_2_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R1_2_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R1_2_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>1</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_2_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R1_2_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R1_2_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R1_2_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R1_2_Delta,2) + " %\n";


      //*****************************************************************
      // Setup the line for R2. The if statements increases the space for
      // numbers under 1,000,000.
      //*****************************************************************


      PREC_Resistors_Data += "  <tr>\n"
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R2 = " + comma_ins(Math.round(R2_2_Init)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_2_A,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R2_2_B,1,"off") + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R2_2_Prec)) + "\n";
      PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R2_2_Delta,2) + " %\n";


      Custom_R_Table += TR;
      Custom_R_Table += TD + "R<sub>2</sub>\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_2_Init)) + " Ohms\n";
      Custom_R_Table += TD + R_Format(R2_2_A,1,"on") + "\n";
      Custom_R_Table += TD + R_Format(R2_2_B,1,"on") + "\n";
      Custom_R_Table += TD + comma_ins(Math.round(R2_2_Prec)) + " Ohms\n";
      Custom_R_Table += TD + Rnd(R2_2_Delta,2) + " %\n";


      if ( R3_2_Init == "Open - Omit" && R4_2_Init == "Short" ) {
         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R3 = Open - Omit\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>3</sub>\n";
         Custom_R_Table += TD + "Open - Omit\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R4 = Short\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>N/A\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>4</sub>\n";
         Custom_R_Table += TD + "Short\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         Custom_R_Table += TD + "N/A\n";
         }
      else {
         //*****************************************************************
         // Setup the line for R3. The if statements increases the space for
         // numbers under 1,000,000.
         //*****************************************************************


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R3 = " + comma_ins(Math.round(R3_2_Init)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_2_A,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R3_2_B,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R3_2_Prec)) + "\n";

         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R3_2_Delta,2) + " %\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>3</sub>\n";
         Custom_R_Table += TD + comma_ins(Math.round(R3_2_Init)) + " Ohms\n";
         Custom_R_Table += TD + R_Format(R3_2_A,1,"on") + "\n";
         Custom_R_Table += TD + R_Format(R3_2_B,1,"on") + "\n";
         Custom_R_Table += TD + comma_ins(Math.round(R3_2_Prec)) + " Ohms\n";
         Custom_R_Table += TD + Rnd(R3_2_Delta,2) + " %\n";


         //*****************************************************************
         // Setup the line for R4. The if statements increases the space for
         // numbers under 1,000,000.
         //*****************************************************************


         PREC_Resistors_Data += "  <tr>\n"
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>R4 = " + comma_ins(Math.round(R4_2_Init)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_2_A,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + R_Format(R4_2_B,1,"off") + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + comma_ins(Math.round(R4_2_Prec)) + "\n";
         PREC_Resistors_Data += "    <td><p class=std_10_bold align=center>" + Rnd(R4_2_Delta,2) + " %\n";


         Custom_R_Table += TR;
         Custom_R_Table += TD + "R<sub>4</sub>\n";
         Custom_R_Table += TD + comma_ins(Math.round(R4_2_Init)) + " Ohms\n";
         Custom_R_Table += TD + R_Format(R4_2_A,1,"on") + "\n";
         Custom_R_Table += TD + R_Format(R4_2_B,1,"on") + "\n";
         Custom_R_Table += TD + comma_ins(Math.round(R4_2_Prec)) + " Ohms\n";
         Custom_R_Table += TD + Rnd(R4_2_Delta,2) + " %\n";
         }
      PREC_Resistors_Data += "</table>\n"
      Standard_R_Table += "            </table>\n";
      document.getElementById("Cust_R_Table").innerHTML = Custom_R_Table;
   }


}


//**************************************************************************
// Calculate the value of two standard resistors that will be very close
// to a precision resistor value, when they are wired in parallel.
//**************************************************************************


function Prec_Res_Calc( R_Prec, Prec_Res_Tol ) {


   //**************************************************************************
   // Find next largest standard resistor.
   //**************************************************************************


   RA_Std = Get_Std_Res( R_Prec, "GT", Prec_Res_Tol );


   //**************************************************************************
   // Calculate the precise resistor value for the parallel resistor.
   //**************************************************************************


   RB_Prec = R_Prec * RA_Std / ( RA_Std - R_Prec );


   //**************************************************************************
   // Find the next hightest resistor for the previous calculation.
   //**************************************************************************


   RB_Std = Get_Std_Res( RB_Prec, "GT", Prec_Res_Tol );


   //**************************************************************************
   // Calculate the result of RA_Std and RB_Std in parallel.
   //**************************************************************************


   RC_Prec = 1 /( 1 / RA_Std + 1 / RB_Std );


   //**************************************************************************
   // Calculate difference from the required value using standard resistors
   // for RA and RB.
   //**************************************************************************


   R_Delta = Math.abs(R_Prec-RC_Prec)/R_Prec*100;
}


//**************************************************************************
// Display window with design information. This function does not do any
// calculations on its own. It simply outputs the information calculated
// in the previous functions.
//**************************************************************************


function View_Act_Hpfil() {


   Filter_View = window.open('','Des_Win',
      'menubar=yes,resizable=yes,scrollbars=yes,status=yes,width=700,height=650');


   with (Filter_View.document) {
      write("<HTML>\n")
      write("<HEAD>\n")
      write("<title>" + Fil_Type + ", " + Fil_Order + "-Order, " + Fil_Char + " Active High Pass Filter for " + F_C + "Hz</title>\n")


      write("<link rel=stylesheet type=\"text/css\" href=\"../../dg.css\">\n\n")


      write("</HEAD>\n\n")


      write("<BODY bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">\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(Fil_Type + ", " + Fil_Order + "-Order, " + Fil_Char + " Active High Pass Filter for " + F_C + "Hz</font><BR>\n")
      write("    by Martin E. Meserve</td>\n")
      write("  </tr>\n")
      write("</table>\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")


      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")




      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <tr valign=\"top\">\n")
      write("    <td width=\"100%\" height=\"100%\" bgcolor=\"#C6F7BD\" colspan=2>\n")




      write("<table width=\"100%\" cellpadding=\"15\" cellspacing=\"0\" bgcolor=\"#C6F7BD\" border=\"0\">\n")
      write("  <TR>\n")


      write("    <TD colspan=2><P class=std_16_fbrick ALIGN=\"center\">Initial Design Data\n")


      if ( Fil_Order == "Second" ) {
         write("<table align=center border=\"0\" cellpadding=\"10\" cellspacing=\"0\">\n")
         write("  <TR>\n")
         write("    <TD width=50%>\n")
         write("    <P class=std_10 align=justify>The drawing below is\n")
         write("    an example of the type of filter you have chosen. The data on the right\n")
         write("    lists the data you specified for the filter, followed by the\n")
         write("    resistor values that were calculated for the Stage 1 filter.</P>\n")


         if ( Fil_Type == "VCVS" ) {
            write("    <P class=std_10 align=center><IMG SRC=\"images_actfil/hpf_vcvs_sch.gif\" ALIGN=RIGHT HSPACE=10 >\n") }
         else {
            write("    <P class=std_10 align=center><IMG SRC=\"images_actfil/hpf_mfb_sch.gif\" ALIGN=RIGHT HSPACE=10 >\n") }
         }
      else {
         write("<table align=center border=\"0\" cellpadding=\"10\" cellspacing=\"0\">\n")
         write("  <TR>\n")
         write("    <TD width=50% valign=top>\n")
         write("    <P class=std_10 align=justify>The drawing below is\n")
         write("    an example of a single filter stage for the type of filter\n")
         write("    you have chosen. You will need to cascade two of these filters. The\n")
         write("    data on the right lists the data you specified for the filter,\n")
         write("    followed by the resistor values that were calculated for the\n")
         write("    Stage 1 and Stage 2 filters.</P>\n")


         if ( Fil_Type == "VCVS" ) {
            write("    <P class=std_10 align=center><IMG SRC=\"images_actfil/hpf_vcvs_sch.gif\" ALIGN=RIGHT HSPACE=10 >\n") }
         else {
            write("    <P class=std_10 align=center><IMG SRC=\"images_actfil/hpf_mfb_sch.gif\" ALIGN=RIGHT HSPACE=10  >\n") }
         }


      write("    <TD valign=top>\n")
      write("    <P class=std_10><B><pre>" + Filter_View_Data + "</pre></B>\n")


      write("  <TR>\n")
      if ( Res_Tol == "05" ) {
         write("    <TD colspan=2><P class=std_16_fbrick ALIGN=\"center\">Filter Options using 5% Tolerance Resistors\n")}
      else {
         write("    <TD colspan=2><P class=std_16_fbrick ALIGN=\"center\">Filter Options using 10% Tolerance Resistors\n")
         }


      write("  <TR valign=top>\n")
      write("    <TD><P class=std_10 align=justify>The table below lists ")


      if ( Fil_Type == "MFB" ) {
         write("8\n") }
      else {
         write("16\n") }


      write("    different combinations of standard resistors, that are near the calculated\n")
      write("    value, for each filter section defined. Scroll through the list(s) to see if one of the combinations\n")
      write("    may meet your needs, without resorting to other methods.\n\n")


      write("    <TD><P class=std_10 align=justify>")
      write("    Note that, <B>Gain (K)</B> also changes\n")
      write("    and may influence your decision. Entries are sorted by\n")
      write("    center frequency.\n")


      write("  <TR>\n")
      write("    <TD colspan=2><P class=std_10>\n" + STD_Resistors_Data + "\n")


      write("  <TR>\n")
      if ( Prec_Res_Tol == "05" ) {
         write("    <TD colspan=2><P class=std_16_fbrick ALIGN=\"center\">\n")
         write("    Calculated Precision Resistors<BR>Using Two Standard 5% Resistors\n") }
      else {
         write("    <TD colspan=2><P class=std_16_fbrick ALIGN=\"center\">\n")
         write("    Calculated Precision Resistors<BR>Using Two Standard 10% Resistors\n") }


      write("  <TR>\n")
      write("    <TD colspan=2><P class=std_10 align=justify>Each resistor in this filter\n")
      write("    can be very closely approximated by using two resistors in parallel. The\n")
      write("    listing below shows the standard resistor values that would be required\n")
      write("    to closly approximate the calculated values. The table header shows you the\n")
      write("    filter, if you use the resistors specified. The <B>Deviation</B> percentage\n")
      write("    listed is the percentage difference between the required/calculated value\n")
      write("    and the <B>Ra || Rb</B> conbination.\n")


      write("  <TR>\n")
      write("    <TD colspan=2><P class=std_10>\n" + PREC_Resistors_Data + "\n")


      write("</TABLE><!-- xxx -->\n\n")
      write("</TABLE>\n\n")
      write("</body>\n")
      write("</html>\n")
      close()
      } // End of "with (Des_Win.document)" statement
}



