<html>
<head><title>Add Option</title>
<style><%include editor_dialog.css%></style>
<SCRIPT>
<!--

var text, value, selected;

function initDialog () {
    text  = document.getElementById('text');
    value = document.getElementById('value');
    selected = document.getElementById('selected');
    if (opener.edit_row > 0) {
      text.value = opener.edit_text;
      value.value = opener.edit_value;
      selected.checked = (opener.edit_selected == 'Yes') ? true : false;
    }
}

function done () {
/* ---------------------------------------------------------
 * Called when the OK buttun is pressed. Sets the window 
 * return value to an object containsing the user input
 * and closes the window.
 */
    var checked = (selected.checked) ? 1 : 0;
    if (text.value == '') {
      alert("The Option field is requied!")
      return;
    }
    opener.dialogWindow.returnFunc(text.value, value.value, checked);
    window.close ();
}

function get_args () {
/* ---------------------------------------------------------
 * Called onload to recieve the arguments passed in.
 */
        obj = window.dialogArguments;
        if (!obj) alert ("No object");
        if (!obj.children (0)) alert ("No children");
        if (obj.children (0).innerText) {
                text.value = obj.children (0).innerText;
        }
        if (obj.children (1).innerText != 'Yes') {
                opts[1].checked = true;
        }
        if (obj.children (2).innerText) {
                value.value = obj.children (2).innerText;
        }

}

//-->
</SCRIPT>
<body onload="initDialog()" class=body>
<table border=0 cellpadding=3 align=center>
    <tr class=body>
        <td>Option: </td><td><input type=text id=text size=30 class=botton></td>
    </tr>
    <tr class=body>
        <td>Value: </td><td><input type=text id=value size=30 class=botton></td>
    </tr>
    <tr class=body>
        <td>Selected: </td>
        <td>
          <input type=radio value=yes name=opts id=selected>Yes
          <input type=radio name=opts id=not_selected checked>No
        </td>
    </tr>
</table>
<hr>
<div align=right>
        <button onclick="done()" class=button>OK</button> &nbsp;
        <button onclick="window.close();" class=button>Cancel</button>
</div>
</body>
</html>
