                            {if $T_OP == course_info}
                                {capture name = 't_course_info_code'}
                                    <fieldset>
                                        <legend>{$smarty.const._COURSEINFORMATION}</legend>
                                        {$T_COURSE_INFO_HTML}
                                    </fieldset>
                                    <fieldset>
                                        <legend>{$smarty.const._COURSEMETADATA}</legend>
                                        {$T_COURSE_METADATA_HTML}
                                    </fieldset>
                                {/capture}
                                {eF_template_printInnerTable title = "`$smarty.const._INFORMATIONFORCOURSE`<span class = 'innerTableName'>&nbsp;&quot;`$T_CURRENT_COURSE->course.name`&quot;</span>" data = $smarty.capture.t_course_info_code image = '32x32/about.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
                            {elseif $T_OP == 'course_certificates'}
                                {if $smarty.get.edit_user}
                                    {capture name = 't_course_user_progress'}
                                    <fieldset>
                                        <legend>{$smarty.const._LESSONSPROGRESS}</legend>
                                        <table width = "100%">
                                            <tr>
                                        {foreach name = 'lessons_list' item = "lesson" key = "id" from = $T_USER_PROGRESS.lesson_status}
                                                <td width = "50%">
                                                <table>
                                                    <tr><td colspan = "2" style = "font-weight:bold">{$lesson.lesson_name}</td></tr>
                                                    <tr><td>{$smarty.const._COMPLETED}:&nbsp;</td><td>{if $lesson.completed}{$smarty.const._YES}{else}{$smarty.const._NO}{/if}</td></tr>
                                                    {if $lesson.score}<tr><td>{$smarty.const._SCORE}:&nbsp;</td><td>{$lesson.score}&nbsp;%</td></tr>{/if}
                                                    <tr><td>{$smarty.const._CONTENTDONE}:&nbsp;</td>
                                                        <td class = "progressCell" style = "vertical-align:top">
                                                            <span class = "progressNumber">{$lesson.overall_progress}%</span>
                                                            <span class = "progressBar" style = "width:{$lesson.percentage_done}px;">&nbsp;</span>
                                                        </td></tr>
                                                </table>
                                                </td>
                                            {if $smarty.foreach.lessons_list.iteration%2 == 0}</tr><tr>{/if}
                                        {/foreach}
                                            </tr>
                                        </table>
                                    </fieldset>
                                    <fieldset>
                                        <legend>{$smarty.const._COMPLETECOURSE}</legend>
                                        {$T_COMPLETE_LESSON_FORM.javascript}
                                        <form {$T_COMPLETE_COURSE_FORM.attributes}>
                                            {$T_COMPLETE_COURSE_FORM.hidden}
                                            <table class = "formElements">
                                                <tr><td class = "labelCell">{$T_COMPLETE_COURSE_FORM.completed.label}&nbsp;</td><td>{$T_COMPLETE_COURSE_FORM.completed.html}</td></tr>
                                                <tr><td class = "labelCell">{$T_COMPLETE_COURSE_FORM.score.label}&nbsp;</td><td>{$T_COMPLETE_COURSE_FORM.score.html}</td></tr>
                                                {if !$T_USER_PROGRESS.completed}<tr><td></td><td class = "infoCell">{$smarty.const._PROPOSEDSCOREISAVERAGELESSONSCORE}</td></tr>{/if}
                                                {if $T_COMPLETE_COURSE_FORM.score.error}<tr><td></td><td class = "formError">{$T_COMPLETE_COURSE_FORM.score.error}</td></tr>{/if}
                                                <tr><td class = "labelCell">{$T_COMPLETE_COURSE_FORM.comments.label}&nbsp;</td><td>{$T_COMPLETE_COURSE_FORM.comments.html}</td></tr>
                                                {if $T_COMPLETE_COURSE_FORM.comments.error}<tr><td></td><td class = "formError">{$T_COMPLETE_COURSE_FORM.comments.error}</td></tr>{/if}
                                                <tr><td colspan = "100%">&nbsp;</td></tr>
                                                <tr><td></td><td>{$T_COMPLETE_COURSE_FORM.submit_course_complete.html}</td></tr>
                                            </table>
                                        </form>
                                    </fieldset>
                                    {/capture}
                                    {eF_template_printInnerTable title = "`$T_USER_PROGRESS.name` `$T_USER_PROGRESS.surname`&#039s `$smarty.const._PROGRESS`" data = $smarty.capture.t_course_user_progress image = '32x32/books_preferences.png'}
                                {elseif $smarty.get.issue_certificate}

                                {else}
                                    {capture name = 't_course_certificates_code'}
                                                        <table>
                                                            <tr><td style = "padding-right:5px">
                                                                    <img src = "images/16x16/certificate_preferences.png" title = "{$smarty.const._FORMATCERTIFICATE}" alt = "{$smarty.const._FORMATCERTIFICATE}" border = "0" style = "vertical-align:middle"/>
                                                                    <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=format_certificate" >
                                                                        {$smarty.const._FORMATCERTIFICATE}
                                                                    </a>
                                                                </td>
                                                                <td style = "padding-right:5px;border-left:1px solid black;padding-left:5px;">
                                                                    <img src = "images/16x16/book_green.png" title = "{$smarty.const._AUTOCOMPLETE}" alt = "{$smarty.const._AUTOCOMPLETE}" border = "0" style = "vertical-align:middle"/>
                                                                    <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&auto_complete">
                                                                        {$smarty.const._AUTOCOMPLETE}: {if $T_CURRENT_COURSE->course.auto_complete}{$smarty.const._YES}{else}{$smarty.const._NO}{/if}
                                                                    </a>
                                                                </td>
                                                        {if $T_CURRENT_COURSE->course.auto_complete}
                                                                <td style = "padding-right:5px;border-left:1px solid black;padding-left:5px;">
                                                                    <img src = "images/16x16/certificate_refresh.png" title = "{$smarty.const._AUTOCERTIFICATES}" alt = "{$smarty.const._AUTOCERTIFICATES}" border = "0" style = "vertical-align:middle"/>
                                                                    <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&auto_certificate">
                                                                        {$smarty.const._AUTOMATICCERTIFICATES}: {if $T_CURRENT_COURSE->course.auto_certificate}{$smarty.const._YES}{else}{$smarty.const._NO}{/if}
                                                                    </a>
                                                                </td>
                                                        {/if}
                                                            </tr>
                                                        </table>
<!--ajax:usersTable-->
                                                        <table style = "width:100%" class = "sortedTable" size = "{$T_USERS_SIZE}" sortBy = "0" id = "usersTable" useAjax = "1" rowsPerPage = "{$smarty.const.G_DEFAULT_TABLE_SIZE}" url = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&">
                                                            <tr class = "topTitle">
                                                                <td class = "topTitle" name = "login">{$smarty.const._LOGIN}</td>
                                                                <td class = "topTitle" name = "name">{$smarty.const._NAME}</td>
                                                                <td class = "topTitle" name = "surname">{$smarty.const._SURNAME}</td>
                                                                <td class = "topTitle centerAlign" name = "conditions_passed">{$smarty.const._LESSONSCOMPLETED}</td>
                                                                <td class = "topTitle centerAlign" name = "completed" >{$smarty.const._COURSESTATUS}</td>
                                                                <td class = "topTitle centerAlign" name = "score">{$smarty.const._COURSESCORE}</td>
                                                                <td class = "topTitle centerAlign" name = "issued_certificate">{$smarty.const._CERTIFICATEISSUED}</td>
                                                                <td class = "topTitle centerAlign noSort">{$smarty.const._FUNCTIONS}</td>
                                                            </tr>
                                                {foreach name = 'users_progress_list' item = 'item' key = 'login' from = $T_USERS_PROGRESS}
                                                            <tr class = "defaultRowHeight {cycle values = "oddRowColor, evenRowColor"} {if !$item.active}deactivatedTableElement{/if}">
                                                                <td>{$item.login}</td>
                                                                <td>{$item.name}</td>
                                                                <td>{$item.surname}</td>
                                                                <td style = "text-align:center">
                                                                    {$item.completed_lessons}/{$item.total_lessons}
                                                                </td>
                                                                <td style = "text-align:center">
                                                                    {if $item.completed}
                                                                        <img src = "images/16x16/check.png" title = "{$smarty.const._COMPLETED}" alt = "{$smarty.const._COMPLETED}" />
                                                                    {elseif $item.completed_lessons == $item.total_lessons}
                                                                        <img src = "images/16x16/contract.png" title = "{$smarty.const._LESSONSCOMPLETED}" alt = "{$smarty.const._LESSONSCOMPLETED}" />
                                                                    {else}
                                                                        <img src = "images/16x16/forbidden.png" title = "{$smarty.const._NOTCOMPLETED}" alt = "{$smarty.const._NOTCOMPLETED}" />
                                                                    {/if}
                                                                </td>
                                                                <td style = "text-align:center">{if $item.score}{$item.score}{/if}</td>
                                                                <td style = "text-align:center">{if $item.issued_certificate}{$smarty.const._YES}{else}{$smarty.const._NO}{/if}</td>
                                                                <td style = "text-align:center">{strip}
                                                                    {if $item.completed && $item.issued_certificate}
                                                                        {* Create a write evaluation link for this employee *}
                                                                        <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&revoke_certificate={$item.login}" title = "{$smarty.const._REVOKECERTIFICATE}">
                                                                            <img src = "images/16x16/certificate_broken.png" title = "{$smarty.const._REVOKECERTIFICATE}" alt = "{$smarty.const._REVOKECERTIFICATE}" border = "0"/>
                                                                        </a>&nbsp;
                                                                        <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&export=rtf&user={$item.login}&course={$smarty.get.course}" target="_blank" title = "{$smarty.const._VIEWCERTIFICATE}">
                                                                            <img src = "images/16x16/certificate_view.png" title = "{$smarty.const._VIEWCERTIFICATE}" alt = "{$smarty.const._VIEWCERTIFICATE}" border = "0"/>
                                                                        </a>&nbsp;
                                                                    {elseif $item.completed}
                                                                        <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&issue_certificate={$item.login}&popup=1" title = "{$smarty.const._ISSUECERTIFICATE}">
                                                                            <img src = "images/16x16/certificate.png" title = "{$smarty.const._ISSUECERTIFICATE}" alt = "{$smarty.const._ISSUECERTIFICATE}" border = "0"/>
                                                                        </a>&nbsp;
                                                                    {else}
                                                                        <a href = "javascript:void(0)">
                                                                            <img src = "images/16x16/certificate_gray.png" title = "{$smarty.const._THEUSERHASNOTCOMPLETEDTHELESSON}" alt = "{$smarty.const._THEUSERHASNOTCOMPLETEDTHELESSON}" />&nbsp;
                                                                        </a>
                                                                    {/if}
                                                                        <a href = "{$smarty.server.PHP_SELF}?{$T_BASE_URL}&op=course_certificates&edit_user={$item.login}&popup=1" target = "POPUP_FRAME" onclick = "eF_js_showDivPopup('{$smarty.const._PROGRESS}', 2)" title = "{$smarty.const._VIEWUSERLESSONPROGRESS}">
                                                                            <img src = "images/16x16/clipboard.png" title = "{$smarty.const._VIEWUSERCOURSEPROGRESS}" alt = "{$smarty.const._VIEWUSERCOURSEPROGRESS}"/>
                                                                        </a>
                                                                {/strip}
                                                                </td>
                                                            </tr>
                                                {foreachelse}
                                                        <tr class = "{cycle values = "oddRowColor, evenRowColor"} defaultRowHeight"><td colspan = "100%" class = "emptyCategory centerAlign">{$smarty.const._NOUSERDATAFOUND}</td></tr>
                                                {/foreach}
                                                    </table>
<!--/ajax:usersTable-->

                                    {/capture}
                                    {eF_template_printInnerTable title = "`$smarty.const._CERTIFICATESFORCOURSE`<span class = 'innerTableName'>&nbsp;&quot;`$T_CURRENT_COURSE->course.name`&quot;</span>" data = $smarty.capture.t_course_certificates_code image = '32x32/certificate.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS options = $T_COURSE_OPTIONS}
                                {/if}
                            {elseif $T_OP == 'format_certificate'}
                                            {capture name = 't_certificate_code'}
                                                {$T_CERTIFICATE_FORM.javascript}
                                                <form {$T_CERTIFICATE_FORM.attributes}>
                                                    {$T_CERTIFICATE_FORM.hidden}
                                                    <table class = "formElements" style = "width:100%">
                                                        <tr><td class = "labelCell">{$T_CERTIFICATE_FORM.file_upload.label}:&nbsp;</td>
                                                            <td class = "elementCell" colspan="3">{$T_CERTIFICATE_FORM.file_upload.html}</td></tr>
                                                        <tr><td class = "labelCell">{$T_CERTIFICATE_FORM.existing_certificate.label}:&nbsp;</td>
                                                            <td class = "elementCell" colspan="1">{$T_CERTIFICATE_FORM.existing_certificate.html}&nbsp;</td>
                                                        </tr>
                                                        <tr><td colspan = "1"></td><td class = "infoCell" style = "white-space:normal;" colspan = "3">
                                                            {$smarty.const._CERTIFICATEINSTRUCTIONS}
                                                            </td>
                                                        </tr>
                                                        <tr><td></td>
                                                            <td colspan="3">{$T_CERTIFICATE_FORM.preview.html} &nbsp;
                                                                            {$T_CERTIFICATE_FORM.submit_certificate.html}
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </form>
                                            {/capture}
                                            {eF_template_printInnerTable title = $smarty.const._FORMATCERTIFICATE data = $smarty.capture.t_certificate_code image = '32x32/certificate_preferences.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
                            {elseif $T_OP == 'course_rules'}
                                    {capture name = 't_course_rules_code'}
                                                    {$T_COURSE_RULES_FORM.javascript}
                                                    <form {$T_COURSE_RULES_FORM.attributes}>
                                                    {$T_COURSE_RULES_FORM.hidden}
                                                    <table style = "max-width:100%">
                                            {foreach name = 'rules_list' item = 'item' key = 'key' from = $T_COURSE_LESSONS}
                                                        <tr class = "defaultRowHeight {if !$item.active}deactivatedTableElement{/if}">
                                                            <td id = "first_node_{$item.id}" style = "white-space:nowrap">{$item.name}</td>
                                                            <td id = "label_{$item.id}"      style = "white-space:nowrap;">&nbsp;{$smarty.const._GENERALLYAVAILABLE}&nbsp;</td>
                                                            <td id = "insert_node_{$item.id}"></td>
                                                            <td id = "last_node_{$item.id}"  style = "white-space:nowrap;text-align:right;vertical-align:bottom">
                                                                &nbsp;<img src = "images/16x16/delete.png" title = "{$smarty.const._DELETECONDITION}" alt = "{$smarty.const._DELETECONDITION}" border = "0" id = "delete_icon_{$item.id}" onclick = "eF_js_removeCourseRule({$item.id})" style = "display:none"/>
                                                                &nbsp;<img src = "images/16x16/add2.png"   title = "{$smarty.const._ADDCONDITION}"    alt = "{$smarty.const._ADDCONDITION}"    border = "0" id = "add_icon_{$item.id}" onclick = "eF_js_addCourseRule({$item.id})"/></td>
                                                        </tr>
                                            {/foreach}
                                                        <tr><td>&nbsp;</td></tr>
                                                        <tr><td></td><td class = "submitCell">{$T_COURSE_RULES_FORM.submit_rule.html}</td></tr>
                                                    </table>
                                                    </form>

                                                    {*Auxilliary select element, used below in building conditions*}
                                                    <select name = "condition" id = "conditions" style = "display:none;margin-left:5px;vertical-align:middle">
                                                        <option value = "and">{$smarty.const._AND}</option>
                                                        <option value = "or">{$smarty.const._OR}</option>
                                                    </select>

                                                    <script type = "text/javascript">
                                                    <!--
                                                    var lessonsIds   = new Array();
                                                    var lessonsNames = new Array();
                                            {foreach name = 'lessons_list' item = 'lesson' key = 'key' from = $T_COURSE_LESSONS}    {*Create javascript arrays*}
                                                        lessonsIds.push('{$lesson.id}');
                                                        lessonsNames.push('{$lesson.name}');
                                            {/foreach}

                                                    {literal}
                                                    Array.prototype.inArray = function (value)
                                                    {
                                                        var i;
                                                        for (i = 0; i < this.length; i++) {
                                                            if (this[i] === value) {
                                                                return true;
                                                            }
                                                        }
                                                        return false;
                                                    };

                                                    function eF_js_removeCourseRule(id) {
                                                        var insertCell    = document.getElementById('insert_node_'  + id);
                                                        var numConditions = Math.round(insertCell.parentNode.getElementsByTagName('select').length / 2);

                                                        if (numConditions > 0) {              //This means there are more than 1 conditions set
                                                            child = document.getElementById('lessonCell['+id+']['+numConditions+']');
                                                            child.parentNode.removeChild(child);

                                                            if (numConditions % 5 == 0) {       //This is for wrapping fields (since IE won't automatically wrap them)
                                                                insertCell.removeChild(insertCell.lastChild);
                                                            }
                                                        }
                                                        if (numConditions == 1) {
                                                            document.getElementById('delete_icon_' + id).style.display = 'none';
                                                            document.getElementById('label_' + id).innerHTML = '&nbsp;{/literal}{$smarty.const._GENERALLYAVAILABLE}{literal}&nbsp;';    //Set the correct label
                                                      }
                                                    }

                                                    function eF_js_addCourseRule(id, selectedLesson, selectedCondition) {

                                                        if (!selectedLesson) {
                                                            selectedLesson = 0;
                                                        }
                                                        if (!selectedCondition) {
                                                            selectedCondition = 0;
                                                        }
                                                        var insertCell    = document.getElementById('insert_node_'  + id);
                                                        var numConditions = Math.round(insertCell.parentNode.getElementsByTagName('select').length / 2 + 1);

                                                        selectedValues = new Array();
                                                        for (var i = 1; i < numConditions; i++) {           //Calculate selected options, to remove them from the new selects
                                                            previous_select = document.getElementById('rules['+id+'][lesson]['+(i)+']');
                                                            selectedValues.push(previous_select.options[previous_select.options.selectedIndex].value);
                                                        }

                                                        if (selectedValues.length == lessonsIds.length - 1) {       //This means no more options are left. so return without doing anything
                                                            return false;
                                                        }

                                                        document.getElementById('label_' + id).innerHTML = '&nbsp;{/literal}{$smarty.const._DEPENDSON}{literal}:&nbsp;';    //Set the correct label

                                                        var lessonsSpan = document.createElement('span');
                                                        lessonsSpan.id = 'lessonCell['+id+']['+numConditions+']';
                                                        insertCell.appendChild(lessonsSpan);
                                                        if (numConditions % 5 == 0) {       //This is for wrapping fields (since IE won't automatically wrap them)
                                                            insertCell.appendChild(document.createElement('br'));
                                                        }
                                                        if (numConditions > 1) {              //This means there are other conditions set
                                                            var conditionsSelect           = document.getElementById('conditions').cloneNode(true);
                                                            conditionsSelect.id            = 'rules['+id+'][condition]['+numConditions+']';
                                                            conditionsSelect.name          = conditionsSelect.id;
                                                            conditionsSelect.selectedIndex = selectedCondition;
                                                            conditionsSelect.style.display = '';
                                                            lessonsSpan.appendChild(conditionsSelect);
                                                        }
                                                        //var lessonsSelect  = document.getElementById('lessons_list').cloneNode(true);    //This is the right way to do it, but IE won't cloneNode correctly (sic) so we need to build the select list from scratch
                                                        lessonsSelect = document.createElement('select');
                                                        lessonsSelect.style.marginLeft    = '5px';
                                                        lessonsSelect.style.verticalAlign = 'middle';
                                                        lessonsSelect.id   = 'rules['+id+'][lesson]['+numConditions+']';
                                                        lessonsSelect.name = lessonsSelect.id;

                                                        for (var i = 0; i < lessonsIds.length; i++) {
                                                            if (!selectedValues.inArray(lessonsIds[i])) {
                                                                option           = document.createElement('option');
                                                                option.value     = lessonsIds[i];
                                                                option.innerHTML = lessonsNames[i];
                                                                lessonsSelect.appendChild(option);
                                                            }
                                                        }

                                                        for (i = 0; i < lessonsSelect.options.length; i++) {                                      //Remove selected lesson from list
                                                            if (lessonsSelect.options[i].value == selectedLesson) {
                                                                lessonsSelect.options[i].selected = true;
                                                            }
                                                        }
                                                        //In separate loop, because setting to null seems to reindex select options (in IE)
                                                        for (i = 0; i < lessonsSelect.options.length; i++) {                                      //Remove selected lesson from list
                                                            if (lessonsSelect.options[i].value == id) {
                                                                lessonsSelect.options[i] = null;
                                                            }
                                                        }
                                                        lessonsSelect.style.display = '';
                                                        lessonsSpan.appendChild(lessonsSelect);

                                                        document.getElementById('delete_icon_' + id).style.display = '';

                                                    }//-->
                                                    {/literal}
                                                    </script>
                                                {foreach name = 'course_rules_list' item = "rule" key = "key" from = $T_COURSE_RULES}
                                                    {foreach name = 'lesson_rules' item = "lesson_id" key = "index" from = $rule.lesson}
                                                        {if !$rule.condition.$index || $rule.condition.$index == 'and'}{assign var = 'condition' value = 0}{else}{assign var = 'condition' value = 1}{/if}
                                                        <script>eF_js_addCourseRule({$key}, {$lesson_id}, {$condition})</script>
                                                    {/foreach}
                                                {/foreach}

                                            {/capture}
                                            {eF_template_printInnerTable title = $smarty.const._COURSERULES data = $smarty.capture.t_course_rules_code image = '32x32/recycle.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
                            {elseif $T_OP == 'course_order'}
                                {assign var = "title" value = $title|cat:'&nbsp;&raquo;&nbsp;<a class = "titleLink" href = "'|cat:$smarty.server.PHP_SELF|cat:'?ctg=courses&course='|cat:$smarty.get.course|cat:'&op=course_order">'|cat:$smarty.const._ORDERFORCOURSE|cat:' &quot;'|cat:$T_CURRENT_COURSE->course.name|cat:'&quot;</a>'}
                                    {capture name = 't_course_rules_code'}
                                        <fieldset>
                                            <legend>{$smarty.const._DRAGITEMSTOCHANGELESSONSORDER}</legend>
                                            <ul id = "dhtmlgoodies_lessons_tree" class = "dhtmlgoodies_tree">
                                            {foreach name = 'lessons_list' key = 'key' item = 'lesson'  from = $T_COURSE_LESSONS}
                                                <li id = "dragtree_{$lesson.id}" noChildren = "true">
                                                    <a class = "{if !$lesson.active}deactivatedLinkElement{/if}" href = "javascript:void(0)">&nbsp;{$lesson.name|eF_truncate:100}</a>
                                                </li>
                                            {/foreach}
                                            </ul>
                                        </fieldset>
                                        <br/>
                                        <input id = "save_button" class = "flatButton" type="button" onclick="saveQuestionTree()" value="{$smarty.const._SAVECHANGES}">
                                    {/capture}
                                    {eF_template_printInnerTable title = $smarty.const._COURSEORDER data = $smarty.capture.t_course_rules_code image = '32x32/replace2.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
                                    <script>
                                    {literal}
                                    function saveQuestionTree() {
                                        Element.extend($('save_button'));
                                        progressImg = new Element('img', {id:'progress_image', src:'images/others/progress1.gif'}).setStyle({position:'absolute'});
                                        progressImg.style.top      = Element.positionedOffset($('save_button')).top + 1 + 'px';
                                        progressImg.style.left     = Element.positionedOffset($('save_button')).left + 6 + Element.getDimensions($('save_button')).width + 'px';
                                        document.body.appendChild(progressImg);
                                        //alert(treeObj.getNodeOrders());
                                        new Ajax.Request('{/literal}{$smarty.server.PHP_SELF}{literal}?{/literal}{$T_BASE_URL}{literal}&op=course_order&ajax=1&order='+treeObj.getNodeOrders(), {
                                            method:'get',
                                            asynchronous:true,
                                            onSuccess: function (transport) {
                                                progressImg.hide();
                                                progressImg.setAttribute('src', 'images/16x16/check.png');
                                                new Effect.Appear('progress_image');
                                                window.setTimeout('Effect.Fade("progress_image")', 2500);
                                            }
                                        });

                                    }
                                    {/literal}
                                    </script>

                            {elseif $T_OP == 'course_scheduling'}
                                {assign var = "title" value = $title|cat:'&nbsp;&raquo;&nbsp;<a class = "titleLink" href = "'|cat:$smarty.server.PHP_SELF|cat:'?ctg=courses&course='|cat:$smarty.get.course|cat:'&op=course_scheduling">'|cat:$smarty.const._SCHEDULINGFORCOURSE|cat:' &quot;'|cat:$T_CURRENT_COURSE->course.name|cat:'&quot;</a>'}

                                    {capture name = 't_course_scheduling_code'}
                                        <table>
                                        {foreach name = 'lessons_list' key = "id" item = "lesson" from = $T_COURSE_LESSONS}
                                            <tr {if !$lesson.active}class = "deactivatedTableElement"{/if}><td>{$lesson.name}:&nbsp;</td>
                                                <td id = "schedule_dates_{$id}">{if $lesson.from_timestamp}{$smarty.const._FROM} #filter:timestamp_time_nosec-{$lesson.from_timestamp}# {$smarty.const._TO} #filter:timestamp_time_nosec-{$lesson.to_timestamp}#{else}<span class = "emptyCategory">{$smarty.const._NOSCHEDULESET}</span>{/if}&nbsp;</td>
                                                <td>
                                                    <span id = "add_schedule_link_{$id}">
                                                        <a href = "javascript:void(0)" onclick = "showEdit({$id})"><img src = "images/16x16/{if $lesson.from_timestamp}edit.png{else}add2.png{/if}" alt = "{$smarty.const._ADDSCHEDULE}" title = "{$smarty.const._ADDSCHEDULE}" style = "vertical-align:middle" border = "0"/></a>
                                                        <a href = "javascript:void(0)" onclick = "deleteSchedule(this, {$id})" {if !$lesson.from_timestamp}style = "display:none"{/if}><img src = "images/16x16/delete.png" alt = "{$smarty.const._DELETESCHEDULE}" title = "{$smarty.const._DELETESCHEDULE}" style = "vertical-align:middle" border = "0"/></a>
                                                    </span>&nbsp;
                                                </td>
                                                <td id = "schedule_dates_form_{$id}" style = "display:none">
                                                    <table>
                                                        <tr><td>{$smarty.const._FROM}&nbsp;</td><td>{eF_template_html_select_date prefix="from_" time=$lesson.from_timestamp start_year="-2" end_year="+2" field_order = $T_DATE_FORMATGENERAL} {$smarty.const._TIME}: {html_select_time prefix="from_" time = $lesson.from_timestamp display_seconds = false}&nbsp;</td></tr>
                                                        <tr><td>{$smarty.const._TO}&nbsp;</td><td>{eF_template_html_select_date prefix="to_"   time=$lesson.to_timestamp   start_year="-2" end_year="+2" field_order = $T_DATE_FORMATGENERAL} {$smarty.const._TIME}: {html_select_time prefix="to_"   time = $lesson.to_timestamp   display_seconds = false}&nbsp;</td></tr>
                                                    </table>
                                                </td>
                                                <td>
                                                    <a id = "set_schedules_link_{$id}" style = "display:none" href = "javascript:void(0)" onclick = "setSchedule(this, {$id})">
                                                        <img src = "images/16x16/check2.png" alt = "{$smarty.const._SAVE}" title = "{$smarty.const._SAVE}" style = "vertical-align:middle" border = "0"/></a>&nbsp;
                                                    <a id = "remove_schedule_link_{$id}" href = "javascript:void(0)" onclick = "hideEdit({$id})" style = "display:none" onclick = ""><img src = "images/16x16/delete2.png" alt = "{$smarty.const._CANCEL}" title = "{$smarty.const._CANCEL}" style = "vertical-align:middle" border = "0"/></a>
                                                    </td>
                                                </tr>
                                        {/foreach}
                                        </table>
                                        <script>
                                        {literal}
                                        function showEdit(id) {
                                            $('add_schedule_link_'+id).hide();
                                            $('remove_schedule_link_'+id).show();
                                            $('schedule_dates_form_'+id).show();
                                            $('set_schedules_link_'+id).show();
                                        }
                                        function hideEdit(id) {
                                            $('remove_schedule_link_'+id).hide();
                                            $('add_schedule_link_'+id).show();
                                            $('schedule_dates_form_'+id).hide();
                                            $('set_schedules_link_'+id).hide();
                                        }
                                        function setSchedule(el, id) {
                                            Element.extend(el);
                                            url = '{/literal}{$smarty.server.PHP_SELF}{literal}?{/literal}{$T_BASE_URL}{literal}&op=course_scheduling&set_schedule='+id;
                                            $('schedule_dates_form_'+id).select('select').each(function (s) {url+='&'+s.name+'='+s.options[s.selectedIndex].value});

                                            el.down().src = 'images/others/progress1.gif';
                                            new Ajax.Request(url, {
                                                    method:'get',
                                                    asynchronous:true,
                                                    encoding: 'UTF-8',
                                                    onFailure: function (transport) {
                                                        el.down().writeAttribute({src:'images/16x16/delete.png', title:transport.responseText}).hide();
                                                        new Effect.Appear(el.down().identify());
                                                        window.setTimeout('Effect.Fade("'+el.down().identify()+'")', 10000);
                                                    },
                                                    onSuccess: function (transport) {
                                                        $('schedule_dates_'+id).update(transport.responseText);
                                                        hideEdit(id);
                                                        el.down().src = 'images/16x16/check2.png';
                                                        $('add_schedule_link_'+id).down().down().src = 'images/16x16/edit.png';
                                                        $('add_schedule_link_'+id).down().next().show();
                                                    }
                                            });
                                        }
                                        function deleteSchedule(el, id) {
                                            Element.extend(el);
                                            url = '{/literal}{$smarty.server.PHP_SELF}{literal}?{/literal}{$T_BASE_URL}{literal}&op=course_scheduling&delete_schedule='+id;
                                            el.down().src = 'images/others/progress1.gif';
                                            new Ajax.Request(url, {
                                                    method:'get',
                                                    asynchronous:true,
                                                    onFailure: function (transport) {
                                                        el.down().src = 'images/16x16/delete.png';
                                                        errorImg = new Element('img', {id: 'error_icon', src:'images/16x16/delete2.png', title: transport.responseText, border: 0}).setStyle({verticalAlign:'middle'}).hide();
                                                        el.insert(errorImg);
                                                        new Effect.Appear(errorImg.identify());
                                                        window.setTimeout('Effect.Fade("'+errorImg.identify()+'")', 10000);
                                                    },
                                                    onSuccess: function (transport) {
                                                        $('schedule_dates_'+id).update('<span class = "emptyCategory">{/literal}{$smarty.const._NOSCHEDULESET}{literal}</span>');
                                                        el.down().writeAttribute({src: 'images/16x16/delete.png'});
                                                        el.hide();
                                                        el.previous().down().src = 'images/16x16/add2.png';
                                                    }
                                            });

                                        }
                                        {/literal}
                                        </script>
                                    {/capture}
                                    {eF_template_printInnerTable title = $smarty.const._COURSEORDER data = $smarty.capture.t_course_scheduling_code image = '32x32/calendar.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
                            {elseif $T_OP == 'export_course'}
                                {capture name = 't_export_course_code'}
                                    <fieldset>
                                    <legend>{$smarty.const._EXPORTCOURSE}</legend>
                                    {$T_EXPORT_COURSE_FORM.javascript}
                                    <form {$T_EXPORT_COURSE_FORM.attributes}>
                                        {$T_EXPORT_COURSE_FORM.hidden}
                                        <table class = "formElements" style = "margin-left:0px">                                        {if $T_NEW_EXPORTED_FILE}
                                            <tr><td colspan = "2">{$smarty.const._DOWNLOADEXPORTED}:&nbsp; <a href = "view_file.php?file={$T_NEW_EXPORTED_FILE.id}&action=download">{$T_NEW_EXPORTED_FILE.name}</a> ({$T_NEW_EXPORTED_FILE.size} {$smarty.const.KB}, #filter:timestamp-{$T_NEW_EXPORTED_FILE.timestamp}#)</td></tr>
                                    {elseif $T_EXPORTED_FILE}
                                            <tr><td colspan = "2">{$smarty.const._EXISTINGFILE}:&nbsp;<a href = "view_file.php?file={$T_EXPORTED_FILE.id}&action=download">{$T_EXPORTED_FILE.name}</a> ({$T_EXPORTED_FILE.size} {$smarty.const.KB}, #filter:timestamp-{$T_EXPORTED_FILE.timestamp}#)</td></tr>
                                    {/if}
                                            <tr><td class = "labelCell">{$smarty.const._CLICKTOEXPORTCOURSE}:&nbsp;</td>
                                                <td class = "elementCell">{$T_EXPORT_COURSE_FORM.submit_export_course.html}</td></tr>
                                        </table>
                                    </form>
                                    </fieldset>
                                {/capture}
                                {eF_template_printInnerTable title = "`$smarty.const._EXPORTCOURSE`<span class = 'innerTableName'>&nbsp;&quot;`$T_CURRENT_COURSE->course.name`&quot;</span>" data = $smarty.capture.t_export_course_code image = '32x32/export1.png' main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
                            {elseif $T_OP == 'import_course'}
                                    {capture name = 't_import_course_code'}
                                        <fieldset>
                                        <legend>{$smarty.const._IMPORTCOURSE}</legend>
                                        {$T_IMPORT_COURSE_FORM.javascript}
                                        <form {$T_IMPORT_COURSE_FORM.attributes}>
                                            {$T_IMPORT_COURSE_FORM.hidden}
                                            <table class = "formElements">
                                            	<tr><td colspan = "2">{$smarty.const._COURSEIMPORTNOTICE}</td></tr>
                                                <tr><td class = "labelCell">{$smarty.const._COURSEDATAFILE}:&nbsp;</td>
                                                    <td>{$T_IMPORT_COURSE_FORM.file_upload.html}</td></tr>
                                                <tr><td></td><td class = "infoCell">{$smarty.const._EACHFILESIZEMUSTBESMALLERTHAN} <b>{$T_MAX_FILESIZE}</b> {$smarty.const._KB}</td></tr>
                                                <tr><td colspan = "100%">&nbsp;</td></tr>
                                                <tr><td></td><td>{$T_IMPORT_COURSE_FORM.submit_import_course.html}</td></tr>
                                            </table>
                                        </form>
                                        </fieldset>
                                    {/capture}
                                    {eF_template_printInnerTable title = $smarty.const._IMPORTCOURSE data = $smarty.capture.t_import_course_code image = '32x32/import2.png'  main_options = $T_TABLE_OPTIONS options = $T_COURSE_OPTIONS}
{/if}