function getSubmitURL() {
    return "extpcontrol.action";
}

function do_pricerange( frm, fdid ) {
  nextAction( rqtControl_FDFV, 998, 0, frm.pricerange.value );
}
function do_finishcolor( frm, fdid ) {
  nextAction( rqtControl_FDFV, fdid, frm.finish.value );
}

function new_design() {
    nextAction( 1, 0 );
}

var startoverURL = "frcontrol.action?type=3&ags=frhd";
function nextAction() {
//  var elmt = document.getElementById( "load" );
//  elmt.style.visibility = "show";
  var args = nextAction.arguments;

  if ( args[0] == 1 && args[1] == 0 ) { //price wizard special process
      location.href = location.href + "/../" + startoverURL;
      return;
  }

  ajaxObject = createAjaxObj();
  ajaxObject.onreadystatechange=function() {
    if (ajaxObject.readyState == 4) { 
        if (ajaxObject.status==200) {
            parasData(); 
        }
        else {
            alert( "error: " + ajaxObject.status );
        }
    }
  }
  var submitURL = getSubmitURL() + "?" + tokenName + "=" + token;
  if ( args.length >= 1 ) {
     submitURL +="&control="+args[0];
     for ( var i = 1; i < args.length; i++ ) {
        submitURL += "&arg" + i + "=" + args[i];
     }
  }
  else {
     alert( "Invalid argument" );
  }
// alert( submitURL );
  ajaxObject.open('GET', submitURL, true);
  ajaxObject.send(null);
}

function parasData() {
   var xmlData = ajaxObject.responseXML;
   var root = xmlData.getElementsByTagName("root")[0];
   if ( root != null ) {
        step = getXMLValue( root, "step" );
        var viewstatus = getXMLValue( root, "viewstatus" );
        var view = getXMLNode( root, "view" );
        var select = getXMLNode( root, "select" );
        var info = getXMLNode( root, "info" );
        var pricing = getXMLNode( root, "pricing" );
        var control = getXMLNode( root, "control" );
        var navigation = getXMLNode( root, "navigation" );
        var select2 = getXMLNode( root, "select2" );
        var size = getXMLNode( root, "size" );
        var searchCriteria = getXMLNode( root, "searchcriteria" );
        var option = getXMLNode( root, "option" );
        var optionSelect = getXMLNode( root, "optionselect" );
        var paintMatch = getXMLNode( root, "paintmatch" );
        var paintSame = getXMLNode( root, "paintsame" );
        var paintExt = getXMLNode( root, "paintext" );
        var paintInt = getXMLNode( root, "paintint" );
        var colorView = getXMLNode( root, "colorview" );

        if ( control != null ) refreshControl( control );
        if ( pricing != null ) refreshPricing( pricing );
        if ( size != null ) refreshSize( size );

        if ( option != null ) refreshOption( option );
        if ( step == 'CBINFO_FINISH' ) {
            finish();
        }
        else if ( step == 'CBINFO_OPTION' ) {
            if ( optionSelect != null ) {
                showOptionSelect( optionSelect );
                return;
            }
            else {
                overlay( "OFF" );
            }
        }
        if ( view != null ) {
            refreshExtView( view, step, viewstatus );
        }
        else {
            if ( step != 'CBINFO_OPTION' && step != 'CBINFO_FINISH' ) {
                refreshViewstatus( viewstatus );
            }
        }

        if ( select != null ) refreshSelect( select, searchCriteria );
        refreshInstructions( step );
        if ( info != null ) refreshInfo( info );
        if ( navigation != null ) refreshStepNavigation( navigation, step );            
        if ( select2 != null ) refreshSelect2( select2 );

        if ( paintMatch != null ) refreshPaintMatch( paintMatch );
        if ( paintSame != null ) refreshPaintSame( paintSame );
        if ( paintExt != null ) refreshPaintExt( paintExt );
        if ( paintInt != null ) refreshPaintInt( paintInt );
        if ( colorView != null ) refreshColorView( colorView );
   }
   else {
        location.reload();
   }
//   var elmt = document.getElementById( "load" );
//   elmt.style.visibility = "hidden";
}


function refreshSelect( select, searchCriteria ) {
//alert( "select" );
      var result="";
      var title="";
      var fvid = [];
      var fvcode = [];
      var fvname = [];
      var fvimg = [];
      var fvstatus = [];

      var tab1content = document.getElementById( "ConfigurationContent" );
      var tab2container = document.getElementById( "Configuration2container" );
      var tab2content = document.getElementById( "Configuration2content" );

      var etitle = document.getElementById( "ConfigurationTabTitle" );
      var elmt = document.getElementById( "ConfigurationSelect" );

      title = getXMLValue( select, "title" );
      etitle.innerHTML = title.toUpperCase();

      var fd = getXMLNode( select, "fd" );
      var fdid = getXMLValue( fd, "fdid" );
      var fdcode = getXMLValue( fd, "fdcode" );
      var fdname = getXMLValue( fd, "fdname" );
      var choices = getXMLNodes( fd, "choice" );
      for (var i=0;i<choices.length;i++) {
        fvid[i] = getXMLValue( choices[i], "fvid" );
        fvcode[i] = getXMLValue( choices[i], "fvcode" );
        fvname[i] = getXMLValue( choices[i], "fvname" );
        fvimg[i] = getXMLValue( choices[i], "fvimg" );
        fvstatus[i] = getXMLValue( choices[i], "status" );
      }

      var index;

      if ( step == "CBINFO_SWING" ) {
          tab2container.style.display = "none";
          tab1content.style.height = "340px";

          result += '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
  	  result += '<tr>';
  	  result += '<td align="center" valign="middle" height="30" class="BlkBold15px">AS VIEWED FROM THE OUTSIDE</td>';
  	  result += '</tr>';
          result += '</table>';
          result += '<table border="0" cellpadding="0" cellspacing="0" align="center" width="500px">';
  	  result += '<tr>';
          for (var i=0;i<choices.length;i++) {
            if ( i%2 == 0 ) {
                result += '<td width="150" align="center" valign="middle" class="Blk15px"><a href="javascript:nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )"><img src="' + rpath + fvimg[i] + '" alt="' + fvname[i] + '" title="' + fvname[i] + '" border="0" /></a></td>';
                result += '<td width="100" align="left" valign="bottom" class="Blk15px">' + fvname[i] + '<br/><br/></td>';
            }
            else {
                result += '<td width="100" align="right" valign="bottom" class="Blk15px">' + fvname[i] + '<br/><br/></td>';
                result += '<td width="150" align="center" valign="middle" class="Blk15px"><a href="javascript:nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )"><img src="' + rpath + fvimg[i] + '" alt="' + fvname[i] + '" title="' + fvname[i] + '" border="0" /></a></td>';
            }
            if ( i%2 == 1 && i != choices.length - 1 ) {
                result += "</tr><tr>";
            }
          }        
  	  result += '</tr>';
          result += '</table>';
      }
      else if ( step == "CBINFO_SIZE" ) {
          etitle.innerHTML = '<a href="javascript:MM_showHideLayers(\'content1-2\',\'\',\'hide\')" ><strong>' + title.toUpperCase() + '</strong></a>';

          tab2container.style.display = "none";
          tab1content.style.height = "340px";

          var bgcolor1 = "#dddddd";
          var bgcolor2 = "#dddddd";
          var bgcolor3 = "#dddddd";
          var bgcolor4 = "#dddddd";
          var section1 = "";
          var section2 = "";
          var section3 = "";
          var section4 = "";
          var height;
          for (var i=0;i<choices.length;i++) {
            height = getXMLValue( choices[i], "attrs4" );
            if ( height == '80"' ) {
                section1 += '<tr valign="middle" bgcolor="' + bgcolor1 + '" >';
                section1 += '<td width="6%"  align="center" class="Blk10px"><input type="radio" name="dmsn" onclick="nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )" /></td>';
                section1 += '<td width="27%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs3" ) + ' x ' + getXMLValue( choices[i], "attrs4" ) + '</td>';
                section1 += '<td width="35%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs1" ) + '</td>';
                section1 += '<td width="32%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs2" ) + '</td>';
                section1 += '</tr>';
                if ( bgcolor1 == "#dddddd" ) {
                    bgcolor1 = "#ffffff";
                }
                else {
                    bgcolor1 = "#dddddd";
                }
            }
            else if ( height == '84"' ) {
                section2 += '<tr valign="middle" bgcolor="' + bgcolor2 + '" >';
                section2 += '<td width="6%"  align="center" class="Blk10px"><input type="radio" name="dmsn" onclick="nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )" /></td>';
                section2 += '<td width="27%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs3" ) + ' x ' + getXMLValue( choices[i], "attrs4" ) + '</td>';
                section2 += '<td width="35%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs1" ) + '</td>';
                section2 += '<td width="32%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs2" ) + '</td>';
                section2 += '</tr>';
                if ( bgcolor2 == "#dddddd" ) {
                    bgcolor2 = "#ffffff";
                }
                else {
                    bgcolor2 = "#dddddd";
                }
            }
            else if ( height == '96"' ) {
                section3 += '<tr valign="middle" bgcolor="' + bgcolor3 + '" >';
                section3 += '<td width="6%"  align="center" class="Blk10px"><input type="radio" name="dmsn" onclick="nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )" /></td>';
                section3 += '<td width="27%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs3" ) + ' x ' + getXMLValue( choices[i], "attrs4" ) + '</td>';
                section3 += '<td width="35%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs1" ) + '</td>';
                section3 += '<td width="32%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs2" ) + '</td>';
                section3 += '</tr>';
                if ( bgcolor3 == "#dddddd" ) {
                    bgcolor3 = "#ffffff";
                }
                else {
                    bgcolor3 = "#dddddd";
                }
            }
            else {
                section4 += '<tr valign="middle" bgcolor="' + bgcolor4 + '" >';
                section4 += '<td width="6%"  align="center" class="Blk10px"><input type="radio" name="dmsn" onclick="nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )" /></td>';
                section4 += '<td width="27%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs3" ) + ' x ' + getXMLValue( choices[i], "attrs4" ) + '</td>';
                section4 += '<td width="35%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs1" ) + '</td>';
                section4 += '<td width="32%" align="center" class="BlkBold10px">' + getXMLValue( choices[i], "attrs2" ) + '</td>';
                section4 += '</tr>';
                if ( bgcolor4 == "#dddddd" ) {
                    bgcolor4 = "#ffffff";
                }
                else {
                    bgcolor4 = "#dddddd";
                }
            }
          }  

          result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" rules="cols" bordercolor="#FFFFFF">';
  	  result += '<tr>';
  	  result += '<td width="15%" height="25" align="center" valign="middle" bgcolor="#999999" class="BlkBold10px" >Door Height</td>';
  	  result += '<td width="5%"  height="25" align="center" valign="middle" bgcolor="#999999" class="BlkBold10px" ></td>';
  	  result += '<td width="23%" height="25" align="center" valign="middle" bgcolor="#999999" class="BlkBold10px" >Nominal Door Size</td>';
  	  result += '<td width="30%" height="25" align="center" valign="middle" bgcolor="#999999" class="BlkBold10px" >Prehung Unit Size</td>';
  	  result += '<td width="27%" height="25" align="center" valign="middle" bgcolor="#999999" class="BlkBold10px" >Rough Opening</td>';
          result += '</tr>';
          if ( section1 != "" ) {
            result += '<tr>';
            result += '<td height="25" ></td>';
            result += '</tr>';            
            result += '<tr>';
            result += '<td align="Center" valign="middle" bgcolor="#ffffff" class="OrangeBold15px">6\'8"<br/>Height</td>';
            result += '<td colspan="4" >';
            result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" rules="cols" bordercolor="#FFFFFF">';
            result += section1;
            result += '</table>';
            result += '</td>';
            result += '</tr>';            
          }
          if ( section2 != "" ) {
            result += '<tr>';
            result += '<td height="25" ></td>';
            result += '</tr>';            
            result += '<tr>';
            result += '<td align="Center" valign="middle" bgcolor="#ffffff" class="OrangeBold15px">7\'0"<br/>Height</td>';
            result += '<td colspan="4" >';
            result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" rules="cols" bordercolor="#FFFFFF">';
            result += section2;
            result += '</table>';
            result += '</td>';
            result += '</tr>';            
          }
          if ( section3 != "" ) {
            result += '<tr>';
            result += '<td height="25" ></td>';
            result += '</tr>';            
            result += '<tr>';
            result += '<td align="Center" valign="middle" bgcolor="#ffffff" class="OrangeBold15px">8\'0"<br/>Height</td>';
            result += '<td colspan="4" >';
            result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" rules="cols" bordercolor="#FFFFFF">';
            result += section3;
            result += '</table>';
            result += '</td>';
            result += '</tr>';            
          }
          if ( section4 != "" ) {
            result += '<tr>';
            result += '<td height="25" ></td>';
            result += '</tr>';            
            result += '<tr>';
            result += '<td align="Center" valign="middle" bgcolor="#ffffff" class="OrangeBold15px"></td>';
            result += '<td colspan="4" >';
            result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" rules="cols" bordercolor="#FFFFFF">';
            result += section4;
            result += '</table>';
            result += '</td>';
            result += '</tr>';            
          }
          result += '</table>';
      }
      else if ( step == "CBINFO_STYLE" ) {
          tab2container.style.display = "none";
          tab1content.style.height = "36px";

          var currentValues = [];
          var priceRangeList;
          if ( searchCriteria != null ) {
             var conditions = getXMLNodes( searchCriteria, "condition" );
             for ( var i = 0; i < conditions.length; i++ ) {
                currentValues[ getXMLValue( conditions[i], "key" ) ] = getXMLValue( conditions[i], "value" );
                if ( getXMLValue( conditions[i], "key" ) == "PRICERANGE" ) {
                    priceRangeList = getXMLNodes( conditions[i], "choice" );
                }
             }
          }

	  result += '<div style="height:34px; overflow: hidden; " >';
          result += '<form id="pricefrm" name="pricefrm" >';
          result += '<table width="100%" height="34" class="style10" >';
          result += '<tr >';
          result += '<td align="right" width="120" ><strong>Price Range</strong>&nbsp;</td>';
          result += '<td align="left" width="120">';
          result += '<select name="pricerange" onchange="do_pricerange( this.form,' + fdid + ')" >';
          var cvalue, cname;
          for (var i=0;i<priceRangeList.length;i++) {
              cvalue = getXMLValue( priceRangeList[i], "cvalue" )
              cname = getXMLValue( priceRangeList[i], "cname" )
              result += '<option value="' + cvalue + '" ' + (currentValues["PRICERANGE"]==cvalue?'selected':'') + ' >' + cname + '</option>';
          }
          result += '</select>';
          result += '</td>';
          result += '<td align="right" width="10">&nbsp;</td>';
          result += '<td align="right" width="120"><strong>Finish Color</strong>&nbsp;</td>';
          result += '<td align="left" width="150">';
          result += '<select name="finish" onchange="do_finishcolor( this.form,' + fdid + ')" >';
          for (var i=0;i<choices.length;i++) {
              if ( fvstatus[i] == 2 ) {
                result += '<option value="' + fvid[i] + '" ' + (currentValues["DS_FHCR"]==fvcode[i]?'selected':'')  + ' >' + fvname[i] + '</option>';
              }
          }
          result += '</select>';
          result += '</td>';
          result += '<td align="right" width="10">&nbsp;</td>';
          result += '</tr>';
          result += '</table>';
          result += '</form>';
	  result += '</div>';

      }
      else if ( step == "CBINFO_PREPAINT" ) {
          tab2container.style.display = "none";
          tab1content.style.height = "30px";
          result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" rules="cols" bordercolor="#FFFFFF">';
          result += '<tr>';
          result += '<td height="25" width="60%" align="left" valign="middle" class="BlkBold14px">&nbsp;&nbsp;Would you like your door painted?</td>';
          for (var i=0;i<choices.length;i++) {
              result += '<td width="5%" align="left" valign="top" class="Blk14px"><input name="painted" type="radio" class="Blk10px" onclick="nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' ) "/></td><td width="11%" align="left" valign="middle" class="Blk14px">' + fvname[i] + '</td>';
          }
          result += '</tr>';
          result += '</table>';

      }
      elmt.innerHTML = result;

}

function refreshInstructions( step ) {
//alert( "default instructions" );
      var result="";

      var elmt = document.getElementById( "instcontent" );
      var elmt2 = document.getElementById( "tab1-2" );

      // default set
//      elmt.style.height = "164px";
//      elmt.style.width = "239px";
      elmt2.style.display = "none";

      if ( step != "CBINFO_PREPAINT" ) {
        MM_showHideLayers(div_PaintMatch,'','hide');
        MM_showHideLayers(div_samePaint,'','hide');
        MM_showHideLayers(div_extPaint,'','hide');
        MM_showHideLayers(div_intPaint,'','hide');
      }

      if ( step == "CBINFO_SWING" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong>SWING &amp; HANDING<br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'Choose how you would like your door to open (Viewed from the outside).<br/><br/>Left Hand Inswing: Hinges on the left. Door opens into your home.<br/>Left Hand Outswing: Hinges on the left, Door opens away from your home.<br/>Right Hand Inswing: Hinges on the right. Door opens into your home.<br/>Right Hand Outswing: Hinges on the right. Door opens away from your home.';
        result += '</td>';
        result += '</tr>';
        result += '</table>';
      }
      else if ( step == "CBINFO_SIZE" ) {
        elmt2.style.display = "block";
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong>DIMENSIONS<br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'It is important to have the correct measurement of the rough opening before installing a new door. Please refer to the diagram to measure your door and openings correctly.<br/><br/>Nominal Door Size: Rounded up door width and height measurement referenced by the Industry (actual Slab and Prehung Size is different).<br/>Ex: Nominal door size: 36"(width) x 80"(height)= Actual slab size: 35-3/4" (width) x 79"(height)<br/>Prehung Unit Size: Measurement of the door/sidelite with frame (jamb).<br/>Rough Opening: Measurement of the opening (width x height) the prehung* door unit is designed to fit into.<br/><br/>*Slab - Door unit without frame(jamb)<br/>*Prehung Door - A door with frame(jamb).';
        result += '</td>';
        result += '</tr>';
        result += '</table>';
      }
      else if ( step == "CBINFO_STYLE" || step == "999" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong>FINISH &amp; STYLE<br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'Browse through your options by clicking on the Price Range and Finish Color. <br/><br/>* Base Price = Prehung, 4-9/16" Primed Jamb, Inswing, Double Bore, Brickmold.';
        result += '</td>';
        result += '</tr>';
        result += '</table>';
      }
      else if ( step == "CBINFO_GLASS" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong>GLASS &amp; CAMING<br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'Select the glass style/collection that you would like for your door. Grayed out glass style/collections are not available in the door style that your have selected. After the glass has been selected you may have the option of selected different camings. Caming is the metal that goes in between the glass the holds the glass design together.';
        result += '</td>';
        result += '</tr>';
        result += '</table>';
      }
      else if ( step == "CBINFO_FINISH" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong><br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'To create another design, press the "START OVER" button or to print out the entryway that you designed select the "PRINT VIEW" button. After printing your design, please take it to your nearest Home Depot sales associate that can complete your order and answer any questions that you may have.';
        result += '</td>';
        result += '</tr>';
        result += '</table>';

      }
      else if ( step == "CBINFO_PREPAINT" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong>PAINTED<br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'Paint option is available with Unfinished Oak Woodgrain and Smooth White doors. Answer each step to finalize your selection from 12 color choices. ';
        result += '</td>';
        result += '</tr>';
        result += '</table>';
      }
      else if ( step == "CBINFO_OPTION" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong>OPTIONS<br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'Choose various upgrades or options for your door. Each option will be explained in more detail. ';
        result += '</td>';
        result += '</tr>';
        result += '</table>';
      }
      else if ( step == "CBINFO_FINISH" ) {
        result += '<table width="100%" >';
        result += '<tr>';
        result += '<td width="87%" height="20" align="left" valign="top" class="style10"><strong><br />';
        result += '</strong></td>';
        result += '</tr>';
        result += '<tr>';
        result += '<td align="left" valign="top" class="style10">';
        result += 'There are two ways to order your door: <br/>In-Person: Print your final door selection and take it to the nearest Home Depot to complete your order. <br/>Online: click on "PURCHASE" button and your order will be placed through the Home Depot website to complete the transaction. <br/><br/>Use the "HOME VIEW" function to visualize the door in a house most similar to your own home. ';
        result += '</td>';
        result += '</tr>';
        result += '</table>';

      }
      else {
      }
      elmt.innerHTML = result;
}

function refreshSelect2( select ) {
      var result="";
      var title="";
      var fvid = [];
      var fvcode = [];
      var fvname = [];
      var fvimg = [];

      var etitle = document.getElementById( "Configuration2title" );
      var elmt = document.getElementById( "Configuration2select" );
      var tab2container = document.getElementById( "Configuration2container" );
      var tab2content = document.getElementById( "Configuration2content" );

      title = getXMLValue( select, "title" );

      if ( title == "null" ) {
        etitle.innerHTML = "";
        elmt.innerHTML = "";
        return
      }

      var fd = getXMLNode( select, "fd" );
      var fdid = getXMLValue( fd, "fdid" );
      var fdcode = getXMLValue( fd, "fdcode" );
      var fdname = getXMLValue( fd, "fdname" );

      var choices = getXMLNodes( fd, "choice" );
      for (var i=0;i<choices.length;i++) {
        fvid[i]= getXMLValue( choices[i], "fvid" );
        fvcode[i]= getXMLValue( choices[i], "fvcode");
        fvname[i]= getXMLValue( choices[i], "fvname" );
        fvimg[i]= getXMLValue( choices[i], "fvimg" );
      }

      var index;
      if ( step == "CBINFO_STYLE" ) {
          tab2container.style.display = "block";
          tab2container.style.top = "195px";
          tab2content.style.height = "262px";

          result += '<div id="Configuration2resultstitle" align="left" >';
          result += '<table width="497" border="0" class="style10">';
          result += '<tr bgcolor="#CCCCCC" align="center">';
          result += '<th width="16%" scope="col">Base Price</th>';
          result += '<th width="36%" scope="col">Glass Design</th>';
          result += '<th width="28%" scope="col">Door Style</th>';
          result += '<th width="20%" scope="col">Sidelite Style</th>';
          result += '</tr>';
          result += '</table>';
          result += '</div>';

          result += '<div id="Configuration2scroll" align="left" >';
          result += '<table width="497" border="0" class="style10">';
          
          var bgcolor,attrs1,attrs2,attrs3,attrs4;
          for (var i=0;i<choices.length;i++) {
            if ( i%2 == 0 ) {
                bgcolor = "#efefef";
            }
            else {
                bgcolor = "#ffffff";
            }
            attrs1 = getXMLValue( choices[i], "attrs1" ); // glass ( glassstyle + caming )
// caming           attrs2 = getXMLValue( choices[i], "attrs2" );
            attrs3 = getXMLValue( choices[i], "attrs3" );
            attrs4 = getXMLValue( choices[i], "attrs4" );
            result += '<tr valign="top" bgcolor="' + bgcolor + '" onclick="selectLine( this,\'#B8DBFA\' ); nextAction(' + rqtControl_FDFV + ',' + fdid + ',' + fvid[i] + ')" ONMOUSEOVER="activeLine(this,\'#D8EBFC\')" ONMOUSEOUT="inactiveLine(this)" onselectstart="return false" ondragstart="return false" oncontextmenu="return false" onmousedown="return false" >';
            result += '<td width="16%" align="left" > $' + fvcode[i] + '</td>';
//            result += '<td width="36%" align="left" >' + attrs1 + ' ' + attrs2 + '</td>';
            result += '<td width="36%" align="left" >' + attrs1 + '</td>';
            result += '<td width="28%" align="left" >' + attrs3 + '</td>';
            result += '<td width="20%" align="left" >' + attrs4 + '</td>';
            result += '</tr>';
          }
          result += '</table>';
          result += '</div>';
          title += ' ( TOTAL: ' + choices.length + ' )';

      }
      else if ( step == "CBINFO_PREPAINT" ) {
          tab2container.style.display = "block";
          tab2container.style.top = "310px";
          tab2content.style.height = "135px";

          result += '<table width="100%">';
          result += '<tr valign="top">';
          result += '<td align="left" >';
          result += '<div id="DS_PREPAINT_STYL" >';
          result += '<ul>';
          for (var i=0;i<choices.length;i++) {
              if ( getXMLValue( choices[i], "status" ) == "2" ) {  
                   result += '<li><div class="style11" ><a href="javascript:nextAction( ' + rqtControl_FDFV + ','  + fdid + ',' + fvid[i] + ' )"><img src="' + rpath + fvimg[i] + '" alt="' + fvname[i] + '" title="' + fvname[i] + '" width="80" height="21" border="0"  /><br>' + fvname[i] + '</a></div></li>';
              }
              else if ( getXMLValue( choices[i], "status" ) == "3" ) {  //skip NA answer included in all answer
              }
              else {
                   result += '<li><div class="style22" ><img src="' + rpath + fvimg[i] + '" alt="' + fvname[i] + '" title="' + fvname[i] + '" width="80" height="21" border="0"  /><br>' + fvname[i] + '</a></div></li>';
              }
         }
          result += '</ul>';
          result += '</div>';
          result += '</td>';
          result += '</tr>';
          result += '</table>';

      }
   
      etitle.innerHTML = title.toUpperCase();
      elmt.innerHTML = result;
}


// overload/new design functions
function refreshStepNavigation( navigation, step ) {
      var pages = [];
      if ( navigation != null ) pages = getXMLNodes( navigation, "page" );

      var result = "";
      var elmt;
// alert( "refreshStepNavigation: " + step );      
      result += '<table align="left" border="0" height="15px" cellpadding="0" cellspacing="0">';
      result += '<tr>';
      result += getNavStep( pages, step, "CBINFO_CONF", "CONFIGURATION", "160px" );
      result += getNavStep( pages, step, "CBINFO_SWING", "SWING &amp; HANDING", "193px" );
      result += getNavStep( pages, step, "CBINFO_SIZE", "DIMENSIONS", "147px" );
      result += getNavStep( pages, step, "CBINFO_STYLE", "DOOR STYLE", "154px" );
      result += getNavStep( pages, step, "CBINFO_PREPAINT", "PAINTED", "120px" );
      result += getNavStep( pages, step, "CBINFO_OPTION", "OPTIONS", "108px" );
      result += getNavStep( pages, step, "CBINFO_FINISH", "FINISH", "84px" );

      result += '</tr>';
      result += '</table>';
      elmt = document.getElementById( "StepNav" );
      elmt.innerHTML = result;

      var ballClass;
      switch ( step ) {
         case "CBINFO_CONF": ballClass = "NumberBall-1p";
                  break;
         case "CBINFO_SWING": ballClass = "NumberBall-2p";
                  break;
         case "CBINFO_SIZE": ballClass = "NumberBall-3p";
                  break;
         case "CBINFO_STYLE": ballClass = "NumberBall-4p";
                  break;
         case "CBINFO_PREPAINT": ballClass = "NumberBall-5p";
                  break;
         case "CBINFO_OPTION": ballClass = "NumberBall-6p";
                  break;
         case "CBINFO_FINISH": ballClass = "NumberBall-7p";
                  break;
         otherwise: ballClass = "";
     }
     ballElmt = document.getElementById( "NumberBall" );
     ballElmt.className = ballClass;
}

