<script language="javascript">
    function showhide (id, set) {
        divobj = document.getElementById(id);
        butobj = document.getElementById(id+'button');
        prefobj = document.getElementById(id+'pref');
        if (set == true) {
            if (prefobj.value == '1') {
                divobj.style.display = 'block';
                butobj.value = '<?php print_string("hidesettings") ?>';
            } else {
                divobj.style.display = 'none';
                butobj.value = '<?php print_string("showsettings") ?>...';
            }
        } else {
            if (prefobj.value == '1') {
                divobj.style.display = 'none';
                butobj.value = '<?php print_string("showsettings") ?>...';
                prefobj.value = '0';
            } else {
                divobj.style.display = 'block';
                butobj.value = '<?php print_string("hidesettings") ?>';
                prefobj.value = '1';
            }
        }
    }
</script>



<tr valign="top">
    <td align="right" nowrap>
        <p><b><?php print_string("fulltext", "resource") ?>:</b></p><br />
        <font size="1">
            <?php  helpbutton("writing", get_string("helpwriting"), "moodle", true, true) ?><br />
            <?php  emoticonhelpbutton("theform", "alltext") ?> <br />
        </font>
    </td>
    <td>
        <?php print_textarea(false, 30, 65, 680, 400, "alltext", $form->alltext); ?>
    </td>
</tr> 
<tr valign="top">
    <td align="right" nowrap>
        <p><b><?php print_string("formattexttype") ?>:</b></p><br />
    </td>
    <td>
        <?php 
            choose_from_menu($format_array, "options", $form->options, '');
            helpbutton("textformat", get_string("formattexttype"));
        ?>
    </td>
</tr> 

<tr><td colspan="2"><hr /></td></tr>


<tr>
    <td align="right"><p><b><?php print_string("display", "resource") ?>:</b></p></td>
    <td>
        <input type="button" value="hide settings" id="windowsettingsbutton" onClick="javascript: return showhide('windowsettings');" />
        <input type="hidden" name="windowsettingspref" id="windowsettingspref" 
               value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" />
        <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?>
    </td>
</tr>   
<tr><td colspan="2">

    <div id="windowsettings">
        
<table align="center">
        

<tr valign="top">

    <td colspan="2">
        <script>
            var popupitems = [<?php echo $popupoptions; ?>];
            var allitems = [<?php echo $alloptions; ?>];
        </script>
        <input type="radio" name="windowpopup" value=0 <?php echo ($windowtype != "popup") ? "checked" : "" ?> 
        onClick="return lockoptions('form', 'windowpopup[1]', popupitems);">
        <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b>
        <?php print_string("pagedisplay", "resource") ?>
    </td>
</tr>

<tr valign="top">
    
    <td colspan="2">
        <input name="windowpopup" type=radio value=1 <?php echo ($windowtype == "popup") ? "checked" : "" ?>
        onclick=" return lockoptions('form', 'windowpopup[1]', popupitems);">
        <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b>
        <?php p($strnewwindowopen) ?>
        <ul>
        <?php
            foreach ($window as $name => $value) {
                if ($name == "height" or $name == "width") {
                    continue;
                }
                echo "<input name=\"h$name\" type=hidden value=0>";
                echo "<input name=\"$name\" type=checkbox value=1 ".$window->$name.">";
                $stringname = "str$name";
                echo $$stringname."<br />";
            }
        ?>

        <input name="hwidth" type=hidden value=0>
        <input name="width" type=text size=4 value="<?php p($window->width) ?>">
        <?php p($strwidth) ?><br />

        <input name="hheight" type=hidden value=0>
        <input name="height" type=text size=4 value="<?php p($window->height) ?>">
        <?php p($strheight) ?><br />
        <?php
            if ($windowtype == "page") {
                echo "<script>";
                echo "lockoptions('form','windowpopup[1]', popupitems);";
                echo "</script>";
            }
        ?>
        </ul>
    </td>
</tr>

</table>

    </div>

</td></tr>


<script language="javascript">
    showhide('windowsettings', true);
</script>

