<script type="text/javascript">
  function styleChange(obj) {

    var style = $(obj).val();
    if (style == '') { return false; }

    if (style == 'Road') {
      $('.account-bikes .dtable.form').addClass('road-bike');
    }
    else {
      $('.account-bikes .dtable.form').removeClass('road-bike');
    }
    return;
  }
</script>
<a href="#" rel="close" class="sprite-close">Close</a>
<form method="post" action="<%GForum::SEO::url()%>">
  <input type="hidden" name="do" value="user_view">
  <input type="hidden" name="action" value="bike_form">
  <input type="hidden" name="user" value="<%user_id%>">
  <input type="hidden" name="delete_it" value="0">
  <input type="hidden" name="formsubmit" value="1">
  <%~if select_bike_id%>
  <input type="hidden" name="bike_edit" value="1">
  <input type="hidden" name="select_bike_id" value="<%select_bike_id%>">
  <%else%>
  <input type="hidden" name="bike_add" value="1">
  <%endif%>
  <%hidden_form%>

  <h4><%if select_bike_id%>Edit<%else%>Add<%endif%> Bike</h4>
  <p class="error hide"></p>
  <div class="dtable form<%if bike_style eq 'Road'%> road-bike<%endif%>">
    <div class="drow">
      <div class="dcell name">Bike Name</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_name" value="<%bike_name || ''%>" class="txt midtext" />
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Style</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <%Plugins::GForum::Bikes::get_field_def('bike_style')%>
        <select name="bike_style" onchange="styleChange(this)">
          <option value="">Select a Style</option>
          <%loop selected_values%>
          <option value="<%value%>"<%if value eq $bike_style%> selected="selected"<%endif%>><%name%></option>
          <%endloop%>
        </select>
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Brand/Models</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <select id="bike_brand" name="bike_brand" onchange="loadSub('bike_model', level2, this.options[this.selectedIndex].value)">
          <option value="">Select a Brand</option>
        </select>
        <select id="bike_model" name="bike_model">
          <option value="">Select a Model</option>
        </select>
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Size</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <%Plugins::GForum::Bikes::get_field_def('bike_size')%>
        <select name="bike_size">
          <option value="">Select a Size</option>
          <%loop selected_values%>
          <option value="<%value%>"<%if value eq $bike_size%> selected="selected"<%endif%>><%name%></option>
          <%endloop%>
        </select>
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Saddle height</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_saddle_height" value="<%bike_saddle_height || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Plumb line, saddle nose to BB</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <%Plugins::GForum::Bikes::get_field_def('bike_plumb_line_pos')%>
        <select name="bike_plumb_line_pos">
          <%loop selected_values%>
          <option value="<%value%>"<%if checked%> selected<%endif%>><%name%></option>
          <%endloop%>
        </select>
        <input type="text" name="bike_plumb_line" value="<%bike_plumb_line || ''%>" size="2" maxlength="3" class="txt smatext"/>
      </div>
    </div>
    <div class="drow tri">
      <div class="dcell name">Cockpit (nose to extension tip)</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_cockpit" value="<%bike_cockpit || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow tri">
      <div class="dcell name">Armrests to extension tip </div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_armrest_exttip" value="<%bike_armrest_exttip || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow tri">
      <div class="dcell name">Armrests drop</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <%Plugins::GForum::Bikes::get_field_def('bike_armrestdrop_pos')%> 
        <select name="bike_armrestdrop_pos">
          <%loop selected_values%>
          <option value="<%value%>"<%if checked%> selected<%endif%>><%name%></option>
          <%endloop%>
        </select>
        <input type="text" name="bike_armrestdrop" value="<%bike_armrestdrop || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow tri">
      <div class="dcell name">Saddle nose to armrest back</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_nose_armrest" value="<%bike_nose_armrest || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Armrest width</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_armrest_width" value="<%bike_armrest_width || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow tri">
      <div class="dcell name">Saddle nose to stem clamp</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_nose_clamp" value="<%bike_nose_clamp || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow tri">
      <div class="dcell name">Handlebar drop</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <input type="text" name="bike_handlebar_drop" value="<%bike_handlebar_drop || ''%>" size="2" maxlength="3" class="txt smatext" />
      </div>
    </div>
    <div class="drow">
      <div class="dcell name">Comments</div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <textarea name="bike_comments" class="txt lngtext"><%bike_comments || ''%></textarea>
      </div>
    </div>
    <div class="drow actions">
      <div class="dcell name"></div>
      <div class="dcell divider"></div>
      <div class="dcell value">
        <%~if select_bike_id%>
        <input type="submit" name="bupdate" value="Update" class="btn default" />
        <input type="button" name="bdelete" value="Delete" class="btn default" />
        <%~else%>
        <input type="submit" name="bupdate" value="Add Bike" class="btn default" />
        <%~endif%>
      </div>
    </div>
  </div><%--end dtable--%>
  <p><em>All values in millimeters</em></p>
</form>
<%include include_bike_js.html%>
