--- loncom/interface/londocs.pm	2010/05/24 12:20:16	1.325.2.10
+++ loncom/interface/londocs.pm	2009/02/03 14:16:39	1.334
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.325.2.10 2010/05/24 12:20:16 raeburn Exp $
+# $Id: londocs.pm,v 1.334 2009/02/03 14:16:39 muellerd Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,6 @@ my $hadchanges;
 my %help=();
 
 
-
 sub mapread {
     my ($coursenum,$coursedom,$map)=@_;
     return
@@ -117,17 +116,15 @@ sub authorhosts {
 
 sub dumpbutton {
     my ($home,$other,%outhash)=&authorhosts();
-    my $crstype = &Apache::loncommon::course_type();
+    my $type = &Apache::loncommon::course_type();
     if ($home+$other==0) { return ''; }
     if ($home) {
-	return '<div>'.
-	    '<input type="submit" name="dumpcourse" value="'.
-	    &mt('Dump '.$crstype.' DOCS to Construction Space').'" />'.
-	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').
-	    '</div>';
+	return '<input type="submit" name="dumpcourse" value="'.
+	    &mt('Dump '.$type.' DOCS to Construction Space').'" />'.
+	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
     } else {
 	return '<div>'.
-     &mt('Dump '.$crstype.
+     &mt('Dump '.$type.
 	 ' DOCS to Construction Space: available on other servers').
 	 '</div>';
     }
@@ -143,10 +140,10 @@ sub clean {
 
 sub dumpcourse {
     my ($r) = @_;
-    my $crstype = &Apache::loncommon::course_type();
-    $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' DOCS to Construction Space').
-	      '<form name="dumpdoc" action="" method="post">');
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' DOCS to Construction Space'));
+    my $type = &Apache::loncommon::course_type();
+    $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
+	      '<form name="dumpdoc" method="post">');
+    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space'));
     my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }
     my $origcrsid=$env{'request.course.id'};
@@ -257,46 +254,35 @@ sub dumpcourse {
 	$r->print(&Apache::loncommon::end_data_table());
 	&untiehash();
 	$r->print(
-  '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $crstype DOCS").'" /></p></form>');
+  '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $type DOCS").'" /></p></form>');
     }
 }
 
 
 
 sub exportbutton {
-    my $crstype = &Apache::loncommon::course_type();
-    return '<div><input type="submit" name="exportcourse"'
-          .' value="'.&mt('IMS Export').'"'
-          .' title="'.&mt('Export '.$crstype.' to IMS Package').'" />'.
-    &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'</div>';
+    my $type = &Apache::loncommon::course_type();
+    return '<input type="submit" name="exportcourse" value="'.
+            &mt('Export '.$type.' to IMS').'" />'.
+    &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
 }
 
 
 
 sub exportcourse {
     my $r=shift;
-    my $crstype = &Apache::loncommon::course_type();
+    my $type = &Apache::loncommon::course_type();
     my %discussiontime = &Apache::lonnet::dump('discussiontimes',
                                                $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
     my $numdisc = keys(%discussiontime);
     my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {
-        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
-                  '<h2>'.&mt('IMS Export Failed').'</h2>'.
-                  '<div class="LC_error">');
-        if ($crstype eq 'Community') {
-            $r->print(&mt('Unable to retrieve information about community contents'));
-        } else {
-            $r->print(&mt('Unable to retrieve information about course contents'));
-        }
-        $r->print('</div><a href="/adm/coursedocs">');
-        if ($crstype eq 'Community') {
-            $r->print(&mt('Return to Community Editor'));
-        } else {
-            $r->print(&mt('Return to Course Editor'));
-        }
-        $r->print('</a>');
-        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
+        $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package').
+                  '<h2>IMS Export Failed</h2>'.
+                  '<div class="LC_error">'.
+                  &mt('Unable to retrieve information about course contents').
+                  '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');
+        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
         return;
     }
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
@@ -312,17 +298,7 @@ sub exportcourse {
         my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
         my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
         if (@exportitems == 0 && @discussions == 0) {
-            $outcome = 
-                '<p class="LC_warning">'
-               .&mt('As you did not select any content items or discussions'
-                   .' for export, an IMS package has not been created.')
-               .'</p>'
-               .'<p>'
-               .&mt('Please [_1]go back[_2] to select either content items'
-                   .' or discussions for export.'
-                       ,'<a href="javascript:history.go(-1)">'
-                       ,'</a>')
-               .'</p>';
+            $outcome = '<br />As you did not select any content items or discussions for export, an IMS package has not been created.  Please <a href="javascript:history.go(-1)">go back</a> to select either content items or discussions for export';
         } else {
             my $now = time;
             my %symbs;
@@ -345,53 +321,35 @@ sub exportcourse {
                 open(OUTPUT, "zip -r $imszip *  2> /dev/null |");
                 close(OUTPUT);
                 chdir $cwd;
-                $outcome .= '<p>'
-                           .&mt('[_1]Your IMS package[_2] is ready for download.'
-                               ,'<a href="'.$imszipfile.'">','</a>')
-                           .'</p>';
+                $outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,);
                 if ($copyresult) {
-                    $outcome .= '<p class="LC_error">'
-                               .&mt('The following errors occurred during export - [_1]'
-                                   ,$copyresult)
-                               .'</p>';
+                    $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult);
                 }
             } else {
-                $outcome = '<p class="LC_error">'
-                          .&mt('Unfortunately you will not be able to retrieve'
-                              .' an IMS archive of this posts at this time,'
-                              .' because there was a problem creating a'
-                              .' manifest file.')
-                          .'</p>'
-                          .'<p><a href="javascript:history.go(-1)">'
-                          .&mt('Go Back')
-                          .'</a></p>';
+                $outcome = '<br />'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'<br />';
             }
         }
-        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'));
-        $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
+        $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
+	$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
         $r->print($outcome);
         $r->print(&Apache::loncommon::end_page());
     } else {
-        my $display='<form name="exportdoc" action="" method="post">'."\n".
-                    '<p>'.
-                    &mt('Choose which items you wish to export from your '.$crstype.'.').
-                    '</p>'.
-                    '<div class="LC_columnSection"><fieldset>'.
-                    '<legend>'.&mt('Content items').'</legend>'.
-                    '<input type="button" value="'.&mt('check all').'" '.
+        my $display;
+        $display = '<form name="exportdoc" method="post">'."\n";
+        $display .= &mt('Choose which items you wish to export from your '.$type.'.<br /><br />');
+        $display .= '<table border="0" cellspacing="0" cellpadding="3">'.
+                    '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.
+                    '<input type="button" value="check all" '.
                     'onclick="javascript:checkAll(document.exportdoc.archive)" />'.
-                    '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
-                    ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset>';
-        if ($numdisc > 0) {
-            $display .= '<fieldset>'.
-                        '<legend>'.&mt('Discussion posts').'</legend>'.
-                        '<input type="button" value="'.&mt('check all').'"'.
-                        ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
-                        '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
-                        ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" />'.
-                        '</fieldset>';
-        }
-        $display .= '</div>';
+                    '&nbsp;&nbsp;<input type="button" value="uncheck all"'.
+                    ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset></td>'.
+                    '<td>&nbsp;</td><td>&nbsp;</td>'.
+                    '<td align="right"><fieldset><legend>&nbsp;<b>Discussion posts'.
+                    '</b></legend><input type="button" value="check all"'.
+                    ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
+                    '&nbsp;&nbsp;<input type="button" value="uncheck all"'.
+                    ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" /></fieldset></td>'.
+                    '</tr></table>';
         my $curRes;
         my $depth = 0;
         my $count = 0;
@@ -400,13 +358,13 @@ sub exportcourse {
         my %parent = ();
         my %children = ();
         my $lastcontainer = $startcount;
-        $display .= &Apache::loncommon::start_data_table()
-                   .&Apache::loncommon::start_data_table_header_row()
-                   .'<th>'.&mt('Export content item?').'</th>';
+        my @bgcolors = ('#F6F6F6','#FFFFFF');
+        $display .= '<table cellspacing="0"><tr>'.
+            '<td><b>Export content item?<br /></b></td><td>&nbsp;</td><td align="right">'."\n";
         if ($numdisc > 0) {
-            $display .= '<th>'.&mt('Export discussion posts?').'</th>';
+            $display.='<b>Export&nbsp;discussion posts?</b>'."\n";
         }
-        $display .= &Apache::loncommon::end_data_table_header_row();
+        $display.='&nbsp;</td></tr>';
         while ($curRes = $it->next()) {
             if (ref($curRes)) {
                 $count ++;
@@ -427,43 +385,38 @@ sub exportcourse {
                         $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
                     }
                 }
-                my $currelem = $count+$boards+$startcount;
-                $display .= &Apache::loncommon::start_data_table_row()
-                           .'<td>'."\n"
-                           .'<input type="checkbox" name="archive" value="'.$count.'" ';
+                my $color = $count%2;
+                $display .='<tr bgcolor='.$bgcolors[$color].'><td>'."\n".
+                    '<input type="checkbox" name="archive" value="'.$count.'" ';
                 if (($curRes->is_sequence()) || ($curRes->is_page())) {
-                    $lastcontainer = $currelem;
-                    $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"';
+                    my $checkitem = $count + $boards + $startcount;
+                    $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"';
                 }
                 $display .= ' />'."\n";
                 for (my $i=0; $i<$depth; $i++) {
-                    $display .= ('<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" />' x2)."\n";
+                    $display .= '<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" /><img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" />'."\n";
                 }
                 if ($curRes->is_sequence()) {
-                    $display .= '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />&nbsp;'."\n";
+                    $display .= '<img src="/adm/lonIcons/navmap.folder.open.gif">&nbsp;'."\n";
+                    $lastcontainer = $count + $startcount + $boards;
                 } elsif ($curRes->is_page()) {
-                    $display .= '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />&nbsp;'."\n";
+                    $display .= '<img src="/adm/lonIcons/navmap.page.open.gif">&nbsp;'."\n";
+                    $lastcontainer = $count + $startcount + $boards;
                 }
+                my $currelem = $count+$boards+$startcount;
                 $children{$parent{$depth}} .= $currelem.':';
-                $display .= '&nbsp;'.$curRes->title().'</td>'."\n";
-
-                # Existing discussion posts?
-
+                $display .= '&nbsp;'.$curRes->title().'</td>';
                 if ($discussiontime{$ressymb} > 0) {
                     $boards ++;
-                    $display .= '<td align="right">'
-                               .'<input type="checkbox" name="discussion" value="'.$count.'" />'
-                               .'</td>'."\n";
+                    $currelem = $count+$boards+$startcount;
+                    $display .= '<td>&nbsp;</td><td align="right"><input type="checkbox" name="discussion" value="'.$count.'" />&nbsp;</td>'."\n";
                 } else {
-                    $display .= '<td>&nbsp;</td>'."\n";
+                    $display .= '<td colspan="2">&nbsp;</td>'."\n";
                 }
-                $display .= &Apache::loncommon::end_data_table_row();
             }
         }
-        $display .= &Apache::loncommon::end_data_table();
         my $scripttag = qq|
-<script type="text/javascript">
-// <![CDATA[
+<script>
 
 function checkAll(field) {
     if (field.length > 0) {
@@ -515,16 +468,15 @@ function containerCheck(item) {
      }   
 }
 
-// ]]>
 </script>
         |;
-        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package',
- 						 $scripttag));
-	$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($crstype).' to IMS content package'));
-	$r->print($display.
-                  '<p><input type="hidden" name="finishexport" value="1" />'.
+	$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package',
+						 $scripttag));
+	$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
+	$r->print($display.'</table>'.
+                  '<p><input type="hidden" name="finishexport" value="1">'.
                   '<input type="submit" name="exportcourse" value="'.
-                  &mt('Export').'" /></p></form>');
+                  &mt('Export '.$type.' DOCS').'" /></p></form>');
     }
 }
 
@@ -551,7 +503,7 @@ sub create_ims_store {
     my $manifestfilename = $$tempexport.$manifest;
     if ($ims_manifest = Apache::File->new('>'.$manifestfilename)) {
         $$manifestok=1;
-        print $ims_manifest 
+        print $ims_manifest
 '<?xml version="1.0" encoding="UTF-8"?>'."\n".
 '<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1"'.
 ' xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2"'.
@@ -1009,7 +961,7 @@ sub group_import {
 }
 
 sub breadcrumbs {
-    my ($allowed,$crstype)=@_;
+    my ($where,$allowed,$type)=@_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     my (@folders);
     if ($env{'form.pagepath'}) {
@@ -1044,9 +996,9 @@ sub breadcrumbs {
 	    if ($4 ne '') { $is_random_order = 1; }
             if ($folder eq 'supplemental') {
                 if ($allowed) {
-                    $name = &mt('Supplemental '.$crstype.' Documents');
+                    $name = &mt('Supplemental '.$type.' Documents');
                 } else {
-                    $name = &mt($crstype.' Documents');
+                    $name = &mt($type.' Documents');
                 }
             }
 	    &Apache::lonhtmlcommon::add_breadcrumb(
@@ -1271,7 +1223,7 @@ sub update_paste_buffer {
         &Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title});
 	($title) = &parse_supplemental_title($title);
     } elsif ($env{'docs.markedcopy_supplemental'}) {
-        &Apache::lonnet::delenv('docs.markedcopy_supplemental');
+        &Apache::lonnet::delenv('docs\\.markedcopy_supplemental');
     }
     $url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};
 
@@ -1375,7 +1327,7 @@ sub do_paste_from_buffer {
     }
 # published maps can only exists once, so remove it from paste buffer when done
     if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) {
-	&Apache::lonnet::delenv('docs.markedcopy');
+	&Apache::lonnet::delenv('docs\\.markedcopy');
     }
     if ($url=~ m{/smppg$}) {
 	my $db_name = &Apache::lonsimplepage::get_db_name($url);
@@ -1503,7 +1455,7 @@ sub handle_edit_cmd {
 }
 
 sub editor {
-    my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_;
+    my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;
 
     my $container= ($env{'form.pagepath'}) ? 'page'
 		                           : 'sequence';
@@ -1520,7 +1472,7 @@ sub editor {
     }
     
     my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
-	&breadcrumbs($allowed,$crstype);
+	&breadcrumbs($folder,$allowed,$type);
     $r->print($breadcrumbtrail);
     
 # ------------------------------------------------------------ Process commands
@@ -1619,7 +1571,7 @@ sub editor {
 	unless ($name) {  $name=(split(/\//,$url))[-1]; }
 	unless ($name) { $idx++; next; }
 	$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res,
-			     $coursenum,$crstype));
+			     $coursenum));
 	$idx++;
 	$shown++;
     }
@@ -1697,7 +1649,7 @@ sub process_file_upload {
             return 'failed';
         } else {
             if ($parseaction eq 'parse') {
-                my $total_embedded = scalar(keys(%{$allfiles}));
+                my $total_embedded = keys(%{$allfiles});
                 if ($total_embedded > 0) {
                     my $num = 0;
 		    my $state = '
@@ -1758,7 +1710,6 @@ sub parse_supplemental_title {
 	$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
 	my $name =  &Apache::loncommon::plainname($uname,$udom);
 	$name = &HTML::Entities::encode($name,'"<>&\'');
-        $renametitle = &HTML::Entities::encode($renametitle,'"<>&\'');
 	$title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.
 	    $name.': <br />'.$foldertitle;
     }
@@ -1771,7 +1722,7 @@ sub parse_supplemental_title {
 # --------------------------------------------------------------- An entry line
 
 sub entryline {
-    my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_;
+    my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
 
     my ($foldertitle,$pagetitle,$renametitle);
     if (&is_supplemental_title($title)) {
@@ -1824,7 +1775,7 @@ sub entryline {
 		'<select name="newpos" onChange="this.form.submit()">';
 	    for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) {
 		if ($i==$incindex) {
-		    $selectbox.='<option value="" selected="selected">('.$i.')</option>';
+		    $selectbox.='<option value="" selected="1">('.$i.')</option>';
 		} else {
 		    $selectbox.='<option value="'.$i.'">'.$i.'</option>';
 		}
@@ -1948,7 +1899,6 @@ END
     }
     
     my $orig_url = $url;
-    $orig_url=~s{http(&colon;|:)//https(&colon;|:)//}{https$2//};
     my $external = ($url=~s{^http(|s)(&colon;|:)//}{/adm/wrapper/ext/});
     if ((!$isfolder) && ($residx) && ($folder!~/supplemental/) && (!$ispage)) {
 	my $symb=&Apache::lonnet::symbclean(
@@ -2011,7 +1961,7 @@ END
     	my $ro_set=
 	    ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
 	$rand_order_text ='
-<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>';   
+<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>';   
     }
     if ($ispage) {
         my $pagename=&escape($pagetitle);
@@ -2037,36 +1987,30 @@ END
     } else {
 	undef($external);
     }
-    my $reinit;
-    if ($crstype eq 'Community') {
-        $reinit = &mt('(re-initialize community to access)');
-    } else {
-        $reinit = &mt('(re-initialize course to access)');
-    }  
     $line.='
   <td class="LC_docs_entry_icon">
     '.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'
   </td>
   <td class="LC_docs_entry_title">
-    '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.$reinit.'</span>').$external."
+    '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.&mt('(re-initialize course to access)').'</span>').$external."
   </td>";
     if (($allowed) && ($folder!~/^supplemental/)) {
  	my %lt=&Apache::lonlocal::texthash(
  			      'hd' => 'Hidden',
  			      'ec' => 'URL hidden');
 	my $enctext=
-	    ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':'');
+	    ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');
 	my $hidtext=
-	    ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':'');
+	    ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
 	$line.=(<<ENDPARMS);
   <td class="LC_docs_entry_parameter">
     $form_start
-    <label><input type="checkbox" name="hiddenresource_$orderidx" onclick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>
+    <label><input type="checkbox" name="hiddenresource_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>
     $form_end
   </td>
   <td class="LC_docs_entry_parameter">
     $form_start
-    <label><input type="checkbox" name="encrypturl_$orderidx" onclick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>
+    <label><input type="checkbox" name="encrypturl_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>
     $form_end
   </td>
   <td class="LC_docs_entry_parameter">$form_start $rand_order_text $form_end</td>
@@ -2149,7 +2093,7 @@ sub checkonthis {
                  if (($errorcount) ||
                      ($warningcount)) {
 		     if ($errorcount) {
-                        $r->print('<img src="/adm/lonMisc/bomb.gif" alt="'.&mt('bomb').'" /><span class="LC_error">'.
+                        $r->print('<img src="/adm/lonMisc/bomb.gif" /><span class="LC_error">'.
                           &mt('[quant,_1,error]',$errorcount).'</span>');
                      }
 		     if ($warningcount) {
@@ -2174,7 +2118,7 @@ sub checkonthis {
 	      unless ($url=~/\$/) {
 		  $r->print('<span class="LC_error">'.&mt('not found').'</b></span>');
 	      } else {
-		  $r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>');
+		  $r->print('<span class="LC_unknown">'.&mt('unable to verify variable URL').'</span>');
 	      }
           } else {
              $r->print('<span class="LC_error">'.&mt('access denied').'</span>');
@@ -2196,7 +2140,7 @@ List Symbs
 sub list_symbs {
     my ($r) = @_;
 
-    my $crstype = &Apache::loncommon::course_type();
+    my $type = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Symb List'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
     my $navmap = Apache::lonnavmaps::navmap->new();
@@ -2205,7 +2149,7 @@ sub list_symbs {
                   '<div class="LC_error">'.
                   &mt('Unable to retrieve information about course contents').
                   '</div>');
-        &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
+        &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
     } else {
         $r->print("<pre>\n");
         foreach my $res ($navmap->retrieveResources()) {
@@ -2219,11 +2163,11 @@ sub list_symbs {
 
 sub verifycontent {
     my ($r) = @_;
-    my $crstype = &Apache::loncommon::course_type();
+    my $type = &Apache::loncommon::course_type();
    my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }
-   $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
-   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
+   $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
+   $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -2232,7 +2176,7 @@ sub verifycontent {
        if ($hash{$key}=~/\.(page|sequence)$/) {
 	   if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
 	       $r->print('<hr /><span class="LC_error">'.
-                         &mt('The following sequence or page is included more than once in your '.$crstype.': ').
+			 &mt('The following sequence or page is included more than once in your '.$type.': ').
 			 &unescape($hash{$key}).'</span><br />'.
 			 &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
 	   }
@@ -2255,9 +2199,9 @@ sub devalidateversioncache {
 
 sub checkversions {
     my ($r) = @_;
-    my $crstype = &Apache::loncommon::course_type();
-    $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
+    my $type = &Apache::loncommon::course_type();
+    $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
+    $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions"));
     my $header='';
     my $startsel='';
     my $monthsel='';
@@ -2318,7 +2262,7 @@ sub checkversions {
     &changewarning($r,'');
     if ($env{'form.timerange'} eq 'all') {
 # show all documents
-        $header=&mt('All Documents in '.$crstype);
+	$header=&mt('All Documents in '.$type);
 	$allsel=1;
 	foreach my $key (keys(%hash)) {
 	    if ($key=~/^ids\_(\/res\/.+)$/) {
@@ -2363,7 +2307,7 @@ sub checkversions {
 			  $env{'course.'.$env{'request.course.id'}.'.domain'},
 			  $env{'course.'.$env{'request.course.id'}.'.num'});
     my %lt=&Apache::lonlocal::texthash
-              ('st' => 'Version changes since start of '.$crstype,
+	      ('st' => 'Version changes since start of '.$type,
 	       'lm' => 'Version changes since last Month',
 	       'lw' => 'Version changes since last Week',
 	       'sy' => 'Version changes since Yesterday',
@@ -2372,9 +2316,9 @@ sub checkversions {
 	       'fi' => 'File',
 	       'md' => 'Modification Date',
                'mr' => 'Most recently published Version',
-	       've' => 'Version used in '.$crstype,
-               'vu' => 'Set Version to be used in '.$crstype,
-'sv' => 'Set Versions to be used in '.$crstype.' according to Selections below',
+	       've' => 'Version used in '.$type,
+               'vu' => 'Set Version to be used in '.$type,
+'sv' => 'Set Versions to be used in '.$type.' according to Selections below',
 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
 'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
 	       'di' => 'Differences');
@@ -2421,7 +2365,7 @@ ENDHEADERS
                       '<td title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.
                       '<font size="+1">'.$currentversion.'</font>'.
                       '</span></td>'.
-                      '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$crstype.': '.
+                      '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$type.': '.
                       '<font size="+1">');
 # Used in course
 	    my $usedversion=$hash{'version_'.$linkurl};
@@ -2438,7 +2382,7 @@ ENDHEADERS
 						      ('select_form_order' =>
 						       ['',1..$currentversion,'mostrecent'],
 						       '' => '',
-						       'mostrecent' => &mt('most recent'),
+						       'mostrecent' => 'most recent',
 						       map {$_,$_} (1..$currentversion))));
 	    $r->print('</span></td></tr><tr><td></td>');
 	    my $lastold=1;
@@ -2539,19 +2483,14 @@ sub changewarning {
 	$message='Changes will become active for your current session after [_1], or the next time you log in.';
     }
     $r->print("\n\n".
-'<script type="text/javascript">'."\n".
-'// <![CDATA['."\n".
-'function reinit(tf) { tf.submit();'.$postexec.' }'."\n".
-'// ]]>'."\n".
-'</script>'."\n".
+'<script type="text/javascript">function reinit(tf) { tf.submit();'.$postexec.' }</script>'."\n". 
 '<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'.
 '<input type="hidden" name="orgurl" value="'.$url.
-'" /><input type="hidden" name="selectrole" value="1" /><p class="LC_warning">'.
+'" /><input type="hidden" name="selectrole" value="1" /><h3><span class="LC_warning">'.
 &mt($message,' <input type="hidden" name="'.
     $env{'request.role'}.'" value="1" /><input type="button" value="'.
-    &mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />').
-$help{'Caching'}.'</p></form>'."\n\n");
-
+    &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').
+$help{'Caching'}.'</span></h3></form>'."\n\n");
 }
 
 
@@ -2559,7 +2498,7 @@ sub init_breadcrumbs {
     my ($form,$text)=@_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
-					    text=>&Apache::loncommon::course_type().' Editor',
+					    text=>"Edit ".&Apache::loncommon::course_type(),
 					    faq=>273,
 					    bug=>'Instructor Interface',
                                             help => 'Docs_Adding_Course_Doc'});
@@ -2577,7 +2516,8 @@ sub handler {
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
     return OK if $r->header_only;
-    my $crstype = &Apache::loncommon::course_type();
+    my $type = &Apache::loncommon::course_type();
+
 
 # --------------------------------------------- Initialize help topics for this
     foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
@@ -2620,7 +2560,7 @@ sub handler {
       &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
       &dumpcourse($r);
   } elsif ($allowed && $env{'form.exportcourse'}) {
-      &init_breadcrumbs('exportcourse','IMS Export');
+      &init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS');
       &exportcourse($r);
   } else {
 # is this a standard course?
@@ -2632,6 +2572,8 @@ sub handler {
     my $showdoc=0;
     my $containertag;
     my $uploadtag;
+
+
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 					    ['folderpath','pagepath',
 					     'pagesymb']);
@@ -2649,7 +2591,7 @@ sub handler {
     }
     if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
         $env{'form.folderpath'} = 'supplemental&'.
-                                  &escape(&mt('Supplemental '.$crstype.' Documents')).'&'.
+                                  &escape(&mt('Supplemental '.$type.' Documents')).'&'.
                                   $env{'form.folderpath'};
     }
     &Apache::loncommon::store_course_settings('docs_folderpath',
@@ -2704,13 +2646,9 @@ sub handler {
 	$script .= &editing_js($udom,$uname);
     }
 # -------------------------------------------------------------------- Body tag
-    $script = '<script type="text/javascript">'."\n"
-              .'// <![CDATA['."\n"
-              .$script."\n"
-              .'// ]]>'."\n"
-              .'</script>'."\n";
-    my $brcrum = [{href=>"/adm/createuser",text=>"$crstype Editor"}];
-    $r->print(&Apache::loncommon::start_page("$crstype Editor", $script,
+    $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';
+    my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
+    $r->print(&Apache::loncommon::start_page("$type Documents", $script,
 				    {'force_register' => $showdoc,
                                      'bread_crumbs' => $brcrum}).
 	      &Apache::loncommon::help_open_menu('','',273,'RAT'));
@@ -2805,12 +2743,11 @@ sub handler {
   unless ($showdoc ||  $upload_result eq 'phasetwo') {
 # -----------------------------------------------------------------------------
        my %lt=&Apache::lonlocal::texthash(
-                'uplm' => 'Upload a new main '.lc($crstype).' document',
-                'upls' => 'Upload a new supplemental '.lc($crstype).' document',
+                'uplm' => 'Upload a new main '.lc($type).' document',
+                'upls' => 'Upload a new supplemental '.lc($type).' document',
                 'impp' => 'Import a document',
-                'pubd' => 'Published documents',
+                'pubd' => 'Published Documents',
 		'copm' => 'All documents out of a published map into this folder',
-                'spec' => 'Special documents',
                 'upld' => 'Upload Document',
                 'srch' => 'Search',
                 'impo' => 'Import',
@@ -2823,37 +2760,99 @@ sub handler {
                 'extr' => 'External Resource',
                 'syll' => 'Syllabus',
                 'navc' => 'Navigate Contents',
-                'sipa' => 'Simple Course Page',
+                'sipa' => 'Simple Page',
                 'sipr' => 'Simple Problem',
                 'drbx' => 'Drop Box',
                 'scuf' => 'Score Upload Form',
-                'bull' => 'Discussion Board',
-                'mypi' => 'My Personal Information Page',
-                'grpo' => 'Group Portfolios',
+                'bull' => 'Bulletin Board',
+                'mypi' => 'My Personal Info',
+                'grpo' => 'Group Files',
                 'rost' => 'Course Roster',
 		'abou' => 'About User',
-                'imsf' => 'IMS Import',
-                'imsl' => 'Import IMS package',
+                'imsf' => 'Import IMS package',
                 'file' =>  'File',
                 'title' => 'Title',
                 'comment' => 'Comment',
-                'parse' => 'If HTML file, upload embedded images/multimedia files'
+                'parse' => 'Upload embedded images/multimedia files if HTML file!',
+		'nd' => 'New Document',
+		'pm' => 'Published Map',
+		'sd' => 'Special Document',
+		'mo' => 'More Options',
+		'hao' => 'Hide all Options'
 					  );
 # -----------------------------------------------------------------------------
-    my %tabtitles = (
-                       main => {
-                                 Course => &mt('Main Course Documents'),
-                                 Community => &mt('Main Community Documents'),
-                               },
-                       supplemental => {
-                                 Course => &mt('Supplemental Course Documents'),        
-                                 Community => &mt('Supplemental Community Documents'),
-                               },
-                    );
+	my $fileupload=(<<FIUP);
+	$lt{'file'}:<br />
+	<input type="file" name="uploaddoc" size="40" />
+FIUP
+
+	my $checkbox=(<<CHBO);
+	<!-- <label>$lt{'parse'}?
+	<input type="checkbox" name="parserflag" />
+	</label> -->
+	<label>
+	<input type="checkbox" name="parserflag" checked="checked" /> $lt{'parse'}
+	</label>
+CHBO
+
+	my $fileuploadform=(<<FUFORM);
+	<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
+	$fileupload
+	<br />
+	$lt{'title'}:<br />
+	<input type="text" size="50" name="comment" />
+	$uploadtag
+	<input type="hidden" name="cmd" value="upload_default" />
+	<br />
+	<span class="LC_nobreak">
+	$checkbox
+	</span>
+	<br />
+	<br />
+	<span class="LC_nobreak">
+	<input type="submit" value="$lt{'upld'}" />
+	 $help{'Uploading_From_Harddrive'}
+	</span>
+	</form>
+FUFORM
+
+	my $simpleeditdefaultform=(<<SEDFFORM);
+	<form action="/adm/coursedocs" method="post" name="simpleeditdefault">
+	$lt{'pubd'}<br />
+	$uploadtag
+	<input type="button" onClick="javascript:groupsearch()" value="$lt{'srch'}" />
+	<br />
+	<span class="LC_nobreak">
+	<input type="button" onClick="javascript:groupimport();" value="$lt{'impo'}" />
+	$help{'Importing_LON-CAPA_Resource'}
+	</span>
+	<br />
+	<input type="button" onClick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
+	<hr />
+	<p>
+	$lt{'copm'}<br />
+	<input type="text" size="40" name="importmap" /><br />
+	<span class="LC_nobreak"><input type="button" 
+	onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
+	value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
+	$help{'Load_Map'}</span>
+	</p>
+	</form>
+SEDFFORM
+
+	my $extresourcesform=(<<ERFORM);
+	<form action="/adm/coursedocs" method="post" name="newext">
+	$uploadtag
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newext" type="button" onClick="javascript:makenewext('newext');"
+	value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
+	</span>
+	</form>
+ERFORM
+
     if ($allowed) {
 	&update_paste_buffer($coursenum,$coursedom);
-       my $dumpbut=&dumpbutton();
-       my $exportbut=&exportbutton();
        my %lt=&Apache::lonlocal::texthash(
 					 'vc' => 'Verify Content',
 					 'cv' => 'Check/Set Resource Versions',
@@ -2865,7 +2864,8 @@ sub handler {
        if (!$folderpath) {
 	   if ($env{'form.folder'} eq '' ||
 	       $env{'form.folder'} eq 'supplemental') {
-	       $folderpath='default&'.&escape($tabtitles{'main'}{$crstype});
+	       $folderpath='default&'.
+		   &escape(&mt('Main '.$type.' Documents'));
 	   }
        }
        unless ($env{'form.pagepath'}) {
@@ -2873,71 +2873,28 @@ sub handler {
            $uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
        }
 
-       $r->print(<<ENDCOURSEVERIFY);
-<form name="renameform" method="post" action="/adm/coursedocs">
-  <input type="hidden" name="title" />
-  <input type="hidden" name="cmd" />
-  <input type="hidden" name="markcopy" />
-  <input type="hidden" name="copyfolder" />
-  $containertag
-</form>
-<form name="simpleedit" method="post" action="/adm/coursedocs">
-  <input type="hidden" name="importdetail" value="" />
-  $uploadtag
-</form>
-<form action="/adm/coursedocs" method="post" name="courseverify">
-  <div class="LC_docs_course_commands">
-
-      <div>
-        <input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}
-      </div>
-      <div>
-        <input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}
-      </div>
-        $dumpbut
-        $exportbut
-      <div>
-        <input type="submit" name="listsymbs" value="$lt{'ls'}" />
-      </div>
-      <div>
-        <input type="hidden" name="folder" value="$env{'form.folder'}" />
-        <input type="submit" name="docslog" value="$lt{'sl'}" />
-      </div>
-  </div>
-</form>
-<div style="clear: both; height: 0px;">&nbsp;</div>
-ENDCOURSEVERIFY
+       $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env));
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
-		     &mt('Editing the Table of Contents for your '.$crstype)));
+		     &mt('Editing the Table of Contents for your '.$type)));
     }
 # --------------------------------------------------------- Standard documents
-    $r->print('<table class="LC_docs_documents">');
-
     if (($standard) && ($allowed) && (!$forcesupplement)) {
-	$r->print('<tr><td class="LC_docs_document">');
-#  '<h2>'.&mt('Main Course Documents').
-#  ($allowed?' '.$help{'Main_Course_Documents'}:'').'</h2>');
        my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder eq 'supplemental') {
            $folder='default';
-	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$crstype.' Documents'));
+	   $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
            $uploadtag = '<input type="hidden" name="folderpath" value="'.
 	       &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        }
        my $postexec='';
        if ($folder eq 'default') {
-           $r->print('<script type="text/javascript">'."\n"
-                    .'// <![CDATA['."\n"
-                    .'this.window.name="loncapaclient";'."\n"
-                    .'// ]]>'."\n"
-                    .'</script>'."\n"
-       );
+	   $r->print('<script type="text/javascript">this.window.name="loncapaclient";</script>');
        } else {
            #$postexec='self.close();';
        }
        $hadchanges=0;
        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,
-			   $upload_output,$crstype);
+			   $upload_output,$type);
        if ($error) {
 	   $r->print('<p><span class="LC_error">'.$error.'</span></p>');
        }
@@ -2954,230 +2911,220 @@ ENDCOURSEVERIFY
 	    $container='page';
 	}
 	my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container;
-       $r->print(<<ENDFORM);
-<table class="LC_docs_adddocs">
-<tr>
-<th>$lt{'uplm'}</th>
-<th>$lt{'impp'}</th>
-<th>$lt{'spec'}</th>
-</tr>
-<tr>
-<td>
-$lt{'file'}:<br />
-<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
-<input type="file" name="uploaddoc" size="40" />
-<br />
-$lt{'title'}:<br />
-<input type="text" size="50" name="comment" />
-$uploadtag
-<input type="hidden" name="cmd" value="upload_default" />
-<br />
-<span class="LC_nobreak">
-<label>$lt{'parse'}?
-<input type="checkbox" name="parserflag" checked="checked" />
-</label>
-</span>
-<br />
-<br />
-<span class="LC_nobreak">
-<input type="submit" value="$lt{'upld'}" />
- $help{'Uploading_From_Harddrive'}
-</span>
-</form>
-</td>
-<td>
-<form action="/adm/coursedocs" method="post" name="simpleeditdefault">
-$lt{'pubd'}<br />
-$uploadtag
-<input type="button" onclick="javascript:groupsearch()" value="$lt{'srch'}" />
-<br />
-<span class="LC_nobreak">
-<input type="button" onclick="javascript:groupimport();" value="$lt{'impo'}" />
-$help{'Importing_LON-CAPA_Resource'}
-</span>
-<br />
-<input type="button" onclick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
-<hr />
-<p>
-$lt{'copm'}<br />
-<input type="text" size="40" name="importmap" /><br />
-<span class="LC_nobreak"><input type="button" 
-onclick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
-value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
-$help{'Load_Map'}</span>
-</p>
-</form>
-<hr />
-<form action="/adm/groupsort" method="post" name="recover">
-<input type="button" name="recovermap" onclick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
-</form>
-ENDFORM
-       unless ($env{'form.pagepath'}) {
-	   $r->print(<<ENDFORM);
-<hr />
-<form action="/adm/coursedocs" method="post" name="newext">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newext" type="button" onclick="javascript:makenewext('newext');"
-value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
-</span>
-</form>
-<br /><form action="/adm/imsimportdocs" method="post" name="ims">
-<input type="hidden" name="folder" value="$folder" />
-<input name="imsimport" type="button" value="$lt{'imsf'}" title="$lt{imsl}" onclick="javascript:makeims();" />
-</form>
-ENDFORM
-       }
-       $r->print('</td><td>');
+
+
+
+	my $recoverform=(<<RFORM);
+	<form action="/adm/groupsort" method="post" name="recover">
+	<input type="button" name="recovermap" onClick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
+	</form>
+RFORM
+
+	my $imspform=(<<IMSPFORM);
+	<form action="/adm/imsimportdocs" method="post" name="ims">
+	<input type="hidden" name="folder" value="$folder" />
+	<input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" />
+	</form>
+IMSPFORM
+
+	my $newnavform=(<<NNFORM);
+	<form action="/adm/coursedocs" method="post" name="newnav">
+	$uploadtag
+	<input type="hidden" name="importdetail" 
+	value="$lt{'navc'}=/adm/navmaps" />
+	<span class="LC_nobreak">
+	<input name="newnav" type="submit" value="$lt{'navc'}" />
+	$help{'Navigate_Content'}
+	</span>
+	</form>
+NNFORM
+	my $newsmppageform=(<<NSPFORM);
+	<form action="/adm/coursedocs" method="post" name="newsmppg">
+	$uploadtag
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newsmppg" type="button" value="$lt{'sipa'}"
+	onClick="javascript:makesmppage();" /> $help{'Simple Page'}
+	</span>
+	</form>
+NSPFORM
+
+	my $newsmpproblemform=(<<NSPROBFORM);
+	<form action="/adm/coursedocs" method="post" name="newsmpproblem">
+	$uploadtag
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newsmpproblem" type="button" value="$lt{'sipr'}"
+	onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}
+	</span>
+	</form>
+
+NSPROBFORM
+
+	my $newdropboxform=(<<NDBFORM);
+	<form action="/adm/coursedocs" method="post" name="newdropbox">
+	$uploadtag      
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">          
+	<input name="newdropbox" type="button" value="$lt{'drbx'}"
+	onClick="javascript:makedropbox();" />
+	</span>         
+	</form> 
+NDBFORM
+
+	my $newexuploadform=(<<NEXUFORM);
+	<form action="/adm/coursedocs" method="post" name="newexamupload">
+	$uploadtag
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newexamupload" type="button" value="$lt{'scuf'}"
+	onClick="javascript:makeexamupload();" />
+	$help{'Score_Upload_Form'}
+	</span>
+	</form>
+NEXUFORM
+
+	my $newbulform=(<<NBFORM);
+	<form action="/adm/coursedocs" method="post" name="newbul">
+	$uploadtag
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newbulletin" type="button" value="$lt{'bull'}"
+	onClick="javascript:makebulboard();" />
+	$help{'Bulletin Board'}
+	</span>
+	</form>
+NBFORM
+
+	my $newaboutmeform=(<<NAMFORM);
+	<form action="/adm/coursedocs" method="post" name="newaboutme">
+	$uploadtag
+	<input type="hidden" name="importdetail" 
+	value="$plainname=/adm/$udom/$uname/aboutme" />
+	<span class="LC_nobreak">
+	<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
+	$help{'My Personal Info'}
+	</span>
+	</form>
+NAMFORM
+
+	my $newaboutsomeoneform=(<<NASOFORM);
+	<form action="/adm/coursedocs" method="post" name="newaboutsomeone">
+	$uploadtag
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newaboutsomeone" type="button" value="$lt{'abou'}" 
+	onClick="javascript:makeabout();" />
+	</span>
+	</form>
+NASOFORM
+
+
+	my $newrosterform=(<<NROSTFORM);
+	<form action="/adm/coursedocs" method="post" name="newroster">
+	$uploadtag
+	<input type="hidden" name="importdetail" 
+	value="$lt{'rost'}=/adm/viewclasslist" />
+	<span class="LC_nobreak">
+	<input name="newroster" type="submit" value="$lt{'rost'}" />
+	$help{'Course Roster'}
+	</span>
+	</form>
+NROSTFORM
+
        unless ($env{'form.pagepath'}) {
 	   my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
-           $r->print(<<ENDFORM);
-<br /><form action="/adm/coursedocs" method="post" name="newfolder">
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newfolder" type="button"
-onclick="javascript:makenewfolder(this.form,'$folderseq');"
-value="$lt{'newf'}" />$help{'Adding_Folders'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newpage">
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newpage" type="button"
-onclick="javascript:makenewpage(this.form,'$pageseq');"
-value="$lt{'newp'}" />$help{'Adding_Pages'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newsyl">
-$uploadtag
-<input type="hidden" name="importdetail" 
-value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
-<span class="LC_nobreak">
-<input name="newsyl" type="submit" value="$lt{'syll'}" /> 
- $help{'Syllabus'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newnav">
-$uploadtag
-<input type="hidden" name="importdetail" 
-value="$lt{'navc'}=/adm/navmaps" />
-<span class="LC_nobreak">
-<input name="newnav" type="submit" value="$lt{'navc'}" />
-$help{'Navigate_Content'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newsmppg">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newsmppg" type="button" value="$lt{'sipa'}"
-onclick="javascript:makesmppage();" /> $help{'Simple Page'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newsmpproblem">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newsmpproblem" type="button" value="$lt{'sipr'}"
-onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newdropbox">
-$uploadtag      
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">          
-<input name="newdropbox" type="button" value="$lt{'drbx'}"
-onclick="javascript:makedropbox();" />
-</span>         
-</form> 
-<br /><form action="/adm/coursedocs" method="post" name="newexamupload">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newexamupload" type="button" value="$lt{'scuf'}"
-onclick="javascript:makeexamupload();" />
-$help{'Score_Upload_Form'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newbul">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newbulletin" type="button" value="$lt{'bull'}"
-onclick="javascript:makebulboard();" />
-$help{'Bulletin Board'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newaboutme">
-$uploadtag
-<input type="hidden" name="importdetail" 
-value="$plainname=/adm/$udom/$uname/aboutme" />
-<span class="LC_nobreak">
-<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
-$help{'My Personal Info'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newaboutsomeone">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newaboutsomeone" type="button" value="$lt{'abou'}" 
-onclick="javascript:makeabout();" />
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newgroupfiles">
-$uploadtag
-<input type="hidden" name="importdetail"
-value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
-<span class="LC_nobreak">
-<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" />
-$help{'Group Files'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newroster">
-$uploadtag
-<input type="hidden" name="importdetail" 
-value="$lt{'rost'}=/adm/viewclasslist" />
-<span class="LC_nobreak">
-<input name="newroster" type="submit" value="$lt{'rost'}" />
-$help{'Course Roster'}
-</span>
-</form>
-ENDFORM
-       }
+
+	my $newpageform=(<<NPFORM);
+	<form action="/adm/coursedocs" method="post" name="newpage">
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newpage" type="button"
+	onClick="javascript:makenewpage(this.form,'$pageseq');"
+	value="$lt{'newp'}" />$help{'Adding_Pages'}
+	</span>
+	</form>
+NPFORM
+
+	my $newfolderform=(<<NFFORM);
+	<form action="/adm/coursedocs" method="post" name="newfolder">
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newfolder" type="button"
+	onClick="javascript:makenewfolder(this.form,'$folderseq');"
+	value="$lt{'newf'}" />$help{'Adding_Folders'}
+	</span>
+	</form>
+NFFORM
+
+	my $newsylform=(<<NSYLFORM);
+	<form action="/adm/coursedocs" method="post" name="newsyl">
+	$uploadtag
+	<input type="hidden" name="importdetail" 
+	value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
+	<span class="LC_nobreak">
+	<input name="newsyl" type="submit" value="$lt{'syll'}" /> 
+	$help{'Syllabus'}
+	</span>
+	</form>
+NSYLFORM
+	
+	my $newgroupfileform=(<<NGFFORM);
+	<form action="/adm/coursedocs" method="post" name="newgroupfiles">
+	$uploadtag
+	<input type="hidden" name="importdetail"
+	value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
+	<span class="LC_nobreak">
+	<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" />
+	$help{'Group Files'}
+	</span>
+	</form>
+NGFFORM
+
+
+        my $specialdocumentsform=(<<SPDOFORM);
+	<br />$newfolderform
+	<br />$newpageform
+	<br />$newsylform
+	<br />$newnavform
+	<br />$newsmppageform
+	<br />$newsmpproblemform
+	<br />$newdropboxform
+	<br />$newexuploadform
+	<br />$newbulform
+	<br />$newaboutmeform
+	<br />$newaboutsomeoneform
+	<br />$newgroupfileform
+	<br />$newrosterform
+SPDOFORM
+
+
+my %orderhash = (
+                'aa' => 'New Document',
+                'bb' => 'Published Documents',
+                'cc' => 'Special Documents',
+		'dd' => 'More Options',
+                'zz' => 'Hide all Options',
+                );
+my %namehash = (
+                'New Document' => $fileuploadform,
+                'Published Documents' => $simpleeditdefaultform,
+                'Special Documents' => $specialdocumentsform,
+		'More Options' => $extresourcesform.'<br />'.$imspform.'<br />'.$recoverform,
+                );
+my $tid='1';
+my $content='content';
+my $navigation='navigation';
+my $varcd = 'Main Course Documents';
+$r->print(&generate_edit_table($tid,$content,$navigation,$varcd,\%namehash,\%orderhash)); 
+      }
        if ($env{'form.pagepath'}) {
-           $r->print(<<ENDBLOCK);
-<form action="/adm/coursedocs" method="post" name="newsmpproblem">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newsmpproblem" type="button" value="$lt{'sipr'}"
-onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="newexamupload">
-$uploadtag
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newexamupload" type="button" value="$lt{'scuf'}"
-onclick="javascript:makeexamupload();" />
-$help{'Score_Upload_Form'}
-</span>
-</form>
-ENDBLOCK
        }
-       $r->print('</td></tr>'."\n".
-'</table>');
-       $r->print('</td></tr>');
     }
 # ----------------------------------------------------- Supplemental documents
     if (!$forcestandard) {
-       $r->print('<tr><td class="LC_docs_document">');
-# '<h2>'.&mt('Supplemental Course Documents').
-#  ($allowed?' '.$help{'Supplemental'}:'').'</h2>');
        my $folder=$env{'form.folder'};
        unless ($folder=~/^supplemental/) {
 	   $folder='supplemental';
@@ -3185,9 +3132,9 @@ ENDBLOCK
        if ($folder =~ /^supplemental$/ &&
 	   (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
           $env{'form.folderpath'} = 'supplemental&'.
-                                    &escape($tabtitles{'supplemental'}{$crstype});
+                                    &escape(&mt('Supplemental '.$type.' Documents'));
        }
-       my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+       my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
        if ($error) {
 	   $r->print('<p><span class="LC_error">'.$error.'</span></p>');
        }
@@ -3197,77 +3144,100 @@ ENDBLOCK
 	       '.sequence';
 
 	   my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
-	   $r->print(<<ENDSUPFORM);
-<table class="LC_docs_adddocs"><tr>
-<th>$lt{'upls'}</th>
-<th>$lt{'spec'}</th>
-</tr>
-<tr><td>
-<form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
-<input type="file" name="uploaddoc" size="40" />
-<br />
-<br />
-<span class="LC_nobreak">
-<label>$lt{'parse'}?
-<input type="checkbox" name="parserflag" />
-</label>
-</span>
-<br /><br />
-$lt{'comment'}:<br />
-<textarea cols="50" rows="4" name="comment">
-</textarea>
-<br />
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="cmd" value="upload_supplemental" />
-<span class="LC_nobreak">
-<input type="submit" value="$lt{'upld'}" />
- $help{'Uploading_From_Harddrive'}
-</span>
-</form>
-</td>
-<td>
-<form action="/adm/coursedocs" method="post" name="supnewfolder">
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newfolder" type="button"
-onclick="javascript:makenewfolder(this.form,'$folderseq');"
-value="$lt{'newf'}" /> $help{'Adding_Folders'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="supnewext">
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="importdetail" value="" />
-<span class="LC_nobreak">
-<input name="newext" type="button" 
-onclick="javascript:makenewext('supnewext');"
-value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="supnewsyl">
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="importdetail" 
-value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
-<span class="LC_nobreak">
-<input name="newsyl" type="submit" value="$lt{'syll'}" />
-$help{'Syllabus'}
-</span>
-</form>
-<br /><form action="/adm/coursedocs" method="post" name="subnewaboutme">
-<input type="hidden" name="folderpath" value="$path" />
-<input type="hidden" name="importdetail" 
-value="$plainname=/adm/$udom/$uname/aboutme" />
-<span class="LC_nobreak">
-<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
-$help{'My Personal Info'}
-</span>
-</form>
-</td></tr>
-</table></td></tr>
-ENDSUPFORM
-       }
-    }
-    $r->print('</table>');
+
+	my $supupdocform=(<<SUPDOCFORM);
+	<form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
+	$fileupload
+	<br />
+	<br />
+	<span class="LC_nobreak">
+	$checkbox
+	</span>
+	<br /><br />
+	$lt{'comment'}:<br />
+	<textarea cols=50 rows=4 name='comment'>
+	</textarea>
+	<br />
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="cmd" value="upload_supplemental" />
+	<span class="LC_nobreak">
+	<input type="submit" value="$lt{'upld'}" />
+	 $help{'Uploading_From_Harddrive'}
+	</span>
+	</form>
+SUPDOCFORM
+
+	my $supnewfolderform=(<<SNFFORM);
+	<form action="/adm/coursedocs" method="post" name="supnewfolder">
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newfolder" type="button"
+	onClick="javascript:makenewfolder(this.form,'$folderseq');"
+	value="$lt{'newf'}" /> $help{'Adding_Folders'}
+	</span>
+	</form>
+SNFFORM
+
+
+	my $supnewextform=(<<SNEFORM);
+	<form action="/adm/coursedocs" method="post" name="supnewext">
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="importdetail" value="" />
+	<span class="LC_nobreak">
+	<input name="newext" type="button" 
+	onClick="javascript:makenewext('supnewext');"
+	value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
+	</span>
+	</form>
+SNEFORM
+
+	my $supnewsylform=(<<SNSFORM);
+	<form action="/adm/coursedocs" method="post" name="supnewsyl">
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="importdetail" 
+	value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
+	<span class="LC_nobreak">
+	<input name="newsyl" type="submit" value="$lt{'syll'}" />
+	$help{'Syllabus'}
+	</span>
+	</form>
+SNSFORM
+
+	my $supnewaboutmeform=(<<SNAMFORM);
+	<form action="/adm/coursedocs" method="post" name="subnewaboutme">
+	<input type="hidden" name="folderpath" value="$path" />
+	<input type="hidden" name="importdetail" 
+	value="$plainname=/adm/$udom/$uname/aboutme" />
+	<span class="LC_nobreak">
+	<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
+	$help{'My Personal Info'}
+	</span>
+	</form>
+SNAMFORM
+
+
+
+my %suporderhash = (
+                'ee' => 'New Document',
+                'ff' => 'Special Documents',
+                'zz' => 'Hide all Options',
+                );
+
+my %supnamehash = (
+                'New Document' => $supupdocform,
+                'Special Documents' => $supnewfolderform.'<br />'.$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform,
+                );
+
+my $tid='2';
+my $content='content';
+my $navigation='navigation';
+my $varscd = 'Supplemental Course Documents';
+
+$r->print(&generate_edit_table($tid,$content,$navigation,$varscd,\%supnamehash,\%suporderhash));
+
+	} 
+   }
     if ($allowed) {
 	$r->print('
 <form method="post" name="extimport" action="/adm/coursedocs">
@@ -3291,6 +3261,79 @@ ENDSUPFORM
  return OK;
 } 
 
+sub generate_admin_options {
+  my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_;
+  my %lt = %{$lt_ref};
+  my %help = %{$help_ref};
+  my %env = %{$env_ref};
+  my $dumpbut=&dumpbutton();
+  my $exportbut=&exportbutton();
+  return (<<ENDOPTIONFORM);
+ <form name="renameform" method="post" action="/adm/coursedocs">
+   <input type="hidden" name="title" />
+   <input type="hidden" name="cmd" />
+   <input type="hidden" name="markcopy" />
+   <input type="hidden" name="copyfolder" />
+   $containertag
+ </form>
+ <form name="simpleedit" method="post" action="/adm/coursedocs">
+   <input type="hidden" name="importdetail" value="" />
+   $uploadtag
+ </form>
+ <form action="/adm/coursedocs" method="post" name="courseverify">
+   <ul style="list-style-type:none">
+       <li>
+           <input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}
+       </li>
+       <li>
+           <input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}
+       </li>
+       <li>
+           $dumpbut
+       </li>
+       <li>
+           $exportbut
+       </li>
+       <li>
+          <input type="submit" name="listsymbs" value="$lt{'ls'}" />
+        </li>
+        <li>
+          <input type="hidden" name="folder" value="$env{'form.folder'}" />
+          <input type="submit" name="docslog" value="$lt{'sl'}" />
+        </li>
+   </ul>
+ </form>
+ <div style="clear: both; height: 0px;">&nbsp;</div>
+ENDOPTIONFORM
+
+}
+
+
+sub generate_edit_table {
+    my ($tid,$content,$navigation,$varcd,$namehash_ref,$orderhash_ref) = @_;
+    my %namehash = %{$namehash_ref};             #name verlinkt mit id
+    my %orderhash = %{$orderhash_ref};           #name mit kürzel verlinkt mit name
+    my $form;
+
+    
+
+    $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt($varcd).'</h4>';
+    $form .= '<ul id="'.$navigation.$tid.'" class="LC_TabContent">';
+    foreach my $name (sort(keys(%orderhash))){
+        if($name eq 'zz'){
+            $form .= '<li onclick="javascript:hideAll(this, \''.$navigation.$tid.'\' ,\''.$content.$tid.'\');" class="active">'.&mt($orderhash{$name}).'</li>';
+        }else{
+            $form .= '<li onclick="javascript:showPage(this, \''.$tid.$orderhash{$name}.'\', \''.$navigation.$tid.'\',\''.$content.$tid.'\');">'.&mt($orderhash{$name}).'</li>';
+        }
+    }
+    $form .= '<div id="'.$content.$tid.'" style="padding: 0 0; margin: 0 0;">';
+    foreach my $field (keys(%namehash)){
+        $form .= '<div id="'.$tid.$field.'" class="LC_ContentBox" style="display: none;">'.$namehash{$field}.'</div>';
+      }
+    $form .= '</div></div>';
+    
+    return $form;
+}
 
 sub editing_js {
     my ($udom,$uname) = @_;
@@ -3301,10 +3344,10 @@ sub editing_js {
                                           p_mnp => 'Name of New Page',
                                           t_mnp => 'New Page',
                                           p_mxu => 'Title for the Uploaded Score',
-                                          p_msp => 'Name of the Simple Course Page',
+                                          p_msp => 'Title for the Page',
                                           p_msb => 'Title for the Problem',
                                           p_mdb => 'Title for the Drop Box',
-                                          p_mbb => 'Title for the Discussion Board',
+                                          p_mbb => 'Title for the Bulletin Board',
                                           p_mab => "Enter user:domain for User's 'About Me' Page",
                                           p_mab2 => "About [_99]",
                                           p_mab_alrt1 => 'Not a valid user:domain',
@@ -3493,6 +3536,33 @@ function markcopy(folderpath,index,oldti
     this.document.forms.renameform.submit();
 }
 
+function unselectInactive(nav) {
+	currentNav = document.getElementById(nav);
+	currentLis = currentNav.getElementsByTagName('LI');
+	for (i = 0; i < currentLis.length; i++) {
+		currentLis[i].className = 'i';
+	}
+}
+
+function hideAll(current, nav, data) {
+	unselectInactive(nav);
+	current.className = 'active';
+	currentData = document.getElementById(data);
+	currentDivs = currentData.getElementsByTagName('DIV');
+	for (i = 0; i < currentDivs.length; i++) {
+		currentDivs[i].style.display = 'none';
+	}
+}
+
+function showPage(current, pageId, nav, data) {
+	hideAll(current, nav, data);
+	unselectInactive(nav);
+	current.className = 'active';
+	currentData = document.getElementById(pageId);
+	currentData.style.display = 'block';
+	return false;
+}
+
 ENDNEWSCRIPT
 }
 1;