<script>
  function check_submit(frm) {
    var obj = frm.lst_opt_template
    if (typeof(lst_opt_template) == 'undefined') 
      return;
    if ( frm.lst_opt[0].checked ) {
      if ( typeof(obj) == 'undefined' ) {
        alert("Please create the email templates before adding a list");
        return false;
      }
      else {
        if (obj.selectedIndex == 0) {
          alert("Please select Opt In Template before updating!");
          return false;
        }
      }
    }
    else {
      obj.selectedIndex = 0;
    }
  }

  function set_default() {
    document.myform.lst_url_subscribe_success.value = "<%static_url%>/page/subscribe_success.html";
    document.myform.lst_url_unsubscribe_success.value = "<%static_url%>/page/unsubscribe_success.html";
    document.myform.lst_url_validate_success.value = "<%static_url%>/page/validate_success.html";
    document.myform.lst_url_subscribe_failure.value = "<%static_url%>/page/subscribe_failure.html";
    document.myform.lst_url_unsubscribe_failure.value = "<%static_url%>/page/unsubscribe_failure.html";
  }
</script>
<table border="0" cellspacing="1" cellpadding="2" align=center>
  <tr class=body>
    <td class=body>List Name</td>
    <td>
      <input type="text" name="lst_title" size="<%if is_ie or is_mozilla%>45<%else%>30<%endif%>" value="<%if lst_title%><%lst_title%><%endif%>" class="object" /> *
    </td>
  </tr>
  <tr class=body>
    <td class=body valign="top">Description</td>
    <td>
      <textarea type="text" class="object" name="lst_description" cols="43" rows="3"><%if lst_description%><%lst_description%><%endif%></textarea>
    </td>
  </tr>
  <%--
  <tr class=body>
    <td class=body>Move to List</td>
    <td>
        <%fetch_lists%>
        <%set selected_list_id = $lst_move_to_id_fk%>
        <select name="lst_move_to_id_fk">
        <option value="0">---</option>
        <%loop lists_loop%>
        <option value="<%lst_id%>"<%if lst_id == $selected_list_id%> selected="selected"<%endif%>><%lst_title%></option>
        <%endloop%>
        </select>
    </td>
  </tr>
  --%>
  <%set tpl_opt_in = GList::Tools::_current_select('lst_opt_template')%>
  <%if tpl_opt_in%>
  <tr class=body>
    <td class=body>Require Double Opt In</td>
    <td>
      <input name="lst_opt" type=radio value='1' <%if lst_opt%>checked<%endif%> />Yes
      <input name="lst_opt" type=radio value='0' <%ifnot lst_opt%>checked<%endif%> />No
    </td>
  </tr>
  <tr class=body>
    <td valign=top class=body>Opt In Template</td>
    <td><%tpl_opt_in%></td>
  </tr>
  <%endif%>
  <%set tpl_subscribe = GList::Tools::_current_select('lst_subs_template')%>
  <%if tpl_subscribe%>
  <tr class=body>
    <td valign=top class=body>Subscribe Template</td>
    <td><%tpl_subscribe%></td>
  </tr>
  <%endif%>
  <%set tpl_unsubscribe = GList::Tools::_current_select('lst_unsubs_template')%>
  <%if tpl_unsubscribe%>
  <tr class=body>
    <td valign=top class=body>Unsubscribe Template</td>
    <td><%tpl_unsubscribe%></td>
  </tr>
  <%endif%>
  <tr>
    <td class=body colspan="2"><b>Success URLs</b></td>
  </tr>
  <tr class=body>
    <td class=body>- Subscribe</td>
    <td>
      <input type="text" class="object" name="lst_url_subscribe_success" size="<%if is_ie or is_mozilla%>45<%else%>30<%endif%>" value="<%if lst_url_subscribe_success%><%lst_url_subscribe_success%><%endif%>" />
    </td>
  </tr>
  <tr class=body>
    <td class=body>- Unsubscribe</td>
    <td>
      <input type="text" class="object" name="lst_url_unsubscribe_success" size="<%if is_ie or is_mozilla%>45<%else%>30<%endif%>" value="<%if lst_url_unsubscribe_success%><%lst_url_unsubscribe_success%><%endif%>" />
    </td>
  </tr>
  <tr class=body>
    <td class=body>- Validate</td>
    <td>
      <input type="text" class="object" name="lst_url_validate_success" size="<%if is_ie or is_mozilla%>45<%else%>30<%endif%>" value="<%if lst_url_validate_success%><%lst_url_validate_success%><%endif%>" />
    </td>
  </tr>
  <tr>
    <td class=body colspan="2"><b>Failure URLs</b></td>
  </tr>
  <tr class=body>
    <td class=body>- Subscribe</td>
    <td>
      <input type="text" class="object" name="lst_url_subscribe_failure" size="<%if is_ie or is_mozilla%>45<%else%>30<%endif%>" value="<%if lst_url_subscribe_failure%><%lst_url_subscribe_failure%><%endif%>" />
    </td>
  </tr>
  <tr class=body>
    <td class=body>- Unsubscribe</td>
    <td>
      <input type="text" class="object" name="lst_url_unsubscribe_failure" size="<%if is_ie or is_mozilla%>45<%else%>30<%endif%>" value="<%if lst_url_unsubscribe_failure%><%lst_url_unsubscribe_failure%><%endif%>" />
    </td>
  </tr>
  <tr class=body>
    <td class=body align=right colspan=2><font size=2 color=green>*: required</font></td>
  </tr>
</table>
