  // show/hide the "other" or "custom" field when the corrresponding option is chosen
  $('select.other')
    .next('p').hide().end()
    .change(showOther).each(showOther);
  $('div.other').next('p').hide().end()
    .find('input:checkbox[@value=custom]').click(showOther).each(showOther);
    
  function showOther() {
    var $this = $(this);
    if ($this.is('select')) {
      if ((/(custom|other)/i).test($this.val())) {
        $this.next().show().find('input').focus();
      } else {
        $this.next().hide();
      }
    } else if ($this.is('input:checkbox')) {
      if ($this.is(':checked')) {
        $this.parents('div:first').next().show().find('input').focus();
      } else {
        $this.parents('div:first').next().hide();
      }
    }
  }  
  // choose a product
  $('div.request-quote').hide();
  var prodOptions = "\n" + '<option value="">Product Choice</option>';
  $('#product-choice')
    .find('a').each(function() {
      var $thisLink = $(this);
      prodOptions += "\n" + '<option value="' + this.hash + '">' + $thisLink.text() + '</option>';
  }).end()
    .find('ul').remove().end()
    .append('<select>' + prodOptions + '</select>');

  $('#product-choice select').change(function() {
      $('div.request-quote').hide();
      $($(this).val()).show();
  });
  
