--- loncom/interface/londocs.pm	2011/07/04 13:01:53	1.454
+++ loncom/interface/londocs.pm	2011/09/10 03:18:34	1.459
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.454 2011/07/04 13:01:53 raeburn Exp $
+# $Id: londocs.pm,v 1.459 2011/09/10 03:18:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -681,7 +681,8 @@ sub build_package {
                     $currdirpath = 'Top';
                     my $pcslist = $curRes->map_hierarchy();
                     if ($pcslist ne '') {
-                        foreach my $pc (split(/,/,$pcslist)) {
+                        foreach my $pc (split(/,/,$pcslist),$curRes->map_pc()) {
+                            next if ($pc <= 1);
                             my $res = $navmap->getByMapPc($pc);
                             if (ref($res)) {
                                 my $encloser = $res->title();
@@ -896,7 +897,8 @@ sub replicate_content {
                              grade_courseid => $cdom.'_'.$cnum,
                              grade_domain   => $env{'user.domain'},
                              grade_username => $env{'user.name'},
-                             grade_imsexport => 1, 
+                             grade_imsexport => 1,
+                             instructor_comments => 'hide',
                            );
                 my $feedurl=&Apache::lonnet::clutter($url);
                 my ($userview,$response)=&Apache::lonnet::ssi_body($feedurl,%form);
@@ -917,11 +919,11 @@ sub replicate_content {
                                     $foilcounter ++;
                                 } elsif ($line =~ m{(|\Q</label>\E)\Q<br />Correct:<b><label>\E}) {
                                     $foilcounter ++;
-                                    $mc_answer = $alphabet[$foilcounter];
-                                } elsif ($line !~ m{</label><br />}) {
+                                    $mc_answer = $alphabet[$foilcounter-1];
+                                } elsif ($line !~ m{\Q</label>\E(|\Q</b>\E)\Q<br />\E}) {
                                     $line =~ s/^(\s+|\s+)$//g;
                                     $line =~ s{^\Q<b>\E([^<]+)\Q</b>\E$}{1};
-                                    push(@tosave,$line);
+                                    $tosave[$foilcounter] .= $line.' ';
                                 }
                                 $content = join("\t",@tosave);
                                 if ($mc_answer) {
@@ -929,10 +931,15 @@ sub replicate_content {
                                 }
                             }
                             if (@tosave) {
-                                $content = $currdirpath."\t".$title."\t".join("\t",@tosave);
+                                my $qtype;
                                 if ($mc_answer) {
-                                    $content .= "\t".$mc_answer."\n";
+                                    $qtype = 'MC';
                                 }
+                                $content = $currdirpath."\t".$title."\t$qtype\t".join("\t",@tosave);
+                                if ($mc_answer) {
+                                    $content .= "\t".$mc_answer;
+                                } 
+                                $content .= "\n";
                             }
                         } else {
                             $content = '<html><body>'.$content.'</body></html>';
@@ -1606,7 +1613,8 @@ sub handle_edit_cmd {
 }
 
 sub editor {
-    my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_;
+    my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
+        $supplementalflag,$orderhash)=@_;
     my $container= ($env{'form.pagepath'}) ? 'page'
 		                           : 'sequence';
 
@@ -1735,7 +1743,7 @@ sub editor {
         $r->print('</div>');
     }
 
-    my $output;  
+    my ($to_show,$output);
 
     &Apache::loncommon::start_data_table_count(); #setup a row counter 
     foreach my $res (@LONCAPA::map::order) {
@@ -1752,28 +1760,34 @@ sub editor {
     &Apache::loncommon::end_data_table_count();
     
     if ($shown) {
-        $r->print(&Apache::loncommon::start_scrollbox('900px','880px','400px')
-                 .&Apache::loncommon::start_data_table());
+        $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
+                  .&Apache::loncommon::start_data_table(undef,'contentlist');
         if ($allowed) {
-            $r->print(&Apache::loncommon::start_data_table_header_row()
+            $to_show .= &Apache::loncommon::start_data_table_header_row()
                      .'<th colspan="2">'.&mt('Move').'</th>'
                      .'<th>'.&mt('Actions').'</th>'
-                     .'<th colspan="2">'.&mt('Document').'</th>');
+                     .'<th colspan="2">'.&mt('Document').'</th>';
             if ($folder !~ /^supplemental/) {
-                $r->print('<th colspan="4">'.&mt('Settings').'</th>');
+                $to_show .= '<th colspan="4">'.&mt('Settings').'</th>';
             }
-            $r->print(&Apache::loncommon::end_data_table_header_row());
+            $to_show .= &Apache::loncommon::end_data_table_header_row();
         }
-        $r->print($output
+        $to_show .= $output.' '
                  .&Apache::loncommon::end_data_table()
-                 .&Apache::loncommon::end_scrollbox()
-        );
+                 .'<br style="line-height:2px;" />'
+                 .&Apache::loncommon::end_scrollbox();
     } else {
-        $r->print('<p class="LC_info">'
+        $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
+                 .'<div class="LC_info" id="contentlist">'
                  .&mt('Currently no documents.')
-                 .'</p>'
-        );
+                 .'</div>'
+                 .&Apache::loncommon::end_scrollbox();
     }
+    my $tid = 1;
+    if ($supplementalflag) {
+        $tid = 2;
+    }
+    $r-print(&generate_edit_table($tid,$orderhash,$to_show));
     if ($allowed) {
         &print_paste_buffer($r,$container);
     }
@@ -1805,7 +1819,7 @@ sub process_file_upload {
             $LONCAPA::map::resources[1]='';
         }
         if ($fatal) {
-            $$upload_output = '<p><span class="LC_error">'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'</span></p>';
+            $$upload_output = '<div class="LC_error" id="uploadfileresult">'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'</div>';
             return;
         }
         my $destination = 'docs/';
@@ -1831,7 +1845,7 @@ sub process_file_upload {
         } else {
             my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$});
             
-            $$upload_output = '<p><span class="LC_error">'.&mt('Unable to save file [_1].','<span class="LC_filename">'.$filename.'</span>').'</span></p>';
+            $$upload_output = '<div class="LC_error" id="uploadfileresult">'.&mt('Unable to save file [_1].','<span class="LC_filename">'.$filename.'</span>').'</div>';
             return;
         }
         my $ext='false';
@@ -1850,7 +1864,7 @@ sub process_file_upload {
         ($errtext,$fatal)=&storemap($coursenum,$coursedom,
 				    $folder.'.'.$container);
         if ($fatal) {
-            $$upload_output = '<p><span class="LC_error">'.$errtext.'</span></p>';
+            $$upload_output = '<div class="LC_error" id="uploadfileresult">'.$errtext.'</div>';
             return;
         } else {
             if ($parseaction eq 'parse' && $mimetype eq 'text/html') {
@@ -1877,6 +1891,7 @@ sub process_file_upload {
                 } else {
                     $$upload_output .= &mt('No embedded items identified').'<br />';
                 }
+                $$upload_output = '<div id="uploadfileresult">'.$$upload_output.'</div>';
             }
         }
     }
@@ -2203,14 +2218,13 @@ END
     $form_start
     <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">
+    <br />
     $form_start
     <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>
-  <td class="LC_docs_entry_parameter">$form_start $parameterset $form_end</td>
+  <td class="LC_docs_entry_parameter">$form_start $parameterset $form_end<br />
+                                      $form_start $rand_order_text $form_end</td>
 ENDPARMS
     }
     $line.=&Apache::loncommon::end_data_table_row();
@@ -2745,15 +2759,15 @@ sub startContentScreen {
 
     if ($allowed) {
         $r->print('<li '.(($mode eq 'docs')?' class="active"':'').
-               '><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
+               ' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
     }
     $r->print('<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
     $r->print('<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
     $r->print('<li '.(($mode eq 'supdocs')?' class="active"':'').
            '><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Documents').'</b></a></li>');
     $r->print('</ul>');
-    $r->print('<div class="LC_Box" style="clear:both;margin:0;">'
-             .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
+    $r->print('<div class="LC_DocsBox" style="clear:both;margin:0;" id="contenteditor">'
+             .'<div id="maincoursedoc" style="margin:0 0;padding:0 0">');
     $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
 }
 
@@ -2852,6 +2866,7 @@ sub handler {
 
     my $script='';
     my $showdoc=0;
+    my $addentries = {};
     my $containertag;
     my $uploadtag;
 
@@ -2952,7 +2967,22 @@ sub handler {
     $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
 
     if ($allowed) {
-	$script .= &editing_js($udom,$uname);
+        my @tabids;
+        if ($supplementalflag) {
+            @tabids = ('002','ee2','ff2');
+        } else {
+            @tabids = ('aa1','bb1','cc1','ff1');
+            unless ($env{'form.pagepath'}) {
+                unshift(@tabids,'001');
+                push(@tabids,('dd1','ee1'));
+            }
+        }
+        my $tabidstr = join("','",@tabids);
+	$script .= &editing_js($udom,$uname).
+                   &resize_contentdiv_js($tabidstr);
+        $addentries = {
+                        onload   => "javascript:resize_contentdiv('contentscroll','1','1');",
+                      };
     }
 # -------------------------------------------------------------------- Body tag
     $script = '<script type="text/javascript">'."\n"
@@ -2968,7 +2998,9 @@ sub handler {
             href=>"/adm/coursedocs",text=>"$crstype Contents"});
 
         $r->print(&Apache::loncommon::start_page("$crstype Contents", $script,
-                                                 {'force_register' => $showdoc,})
+                                                 {'force_register' => $showdoc,
+                                                  'add_entries'    => $addentries,
+                                                 })
                  .&Apache::loncommon::help_open_menu('','',273,'RAT')
                  .&Apache::lonhtmlcommon::breadcrumbs(
                      'Editing the Table of Contents for your '.$crstype,
@@ -3077,22 +3109,22 @@ FIUP
 	</label>
 CHBO
 
-    my $fileuploada = "<input type='submit' value='".$lt{'upld'}."' /> $help{'Uploading_From_Harddrive'}";
+    my $fileuploada = "<br clear='all' /><input type='submit' value='".$lt{'upld'}."' /> $help{'Uploading_From_Harddrive'}";
 	my $fileuploadform=(<<FUFORM);
 	<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
 	<input type="hidden" name="active" value="aa" />
 	$fileupload
 	<br />
 	$lt{'title'}:<br />
-	<input type="text" size="80" name="comment" />
+	<input type="text" size="60" name="comment" />
 	$uploadtag
 	<input type="hidden" name="cmd" value="upload_default" />
 	<br />
-	<span class="LC_nobreak">
+	<span class="LC_nobreak" style="float:left">
 	$checkbox
 	</span>
 FUFORM
-    $fileuploadform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$fileuploada,{class => 'LC_menubuttons_inline_text'})).'</form>';
+    $fileuploadform .= $fileuploada.'</form>';
 
 	my $simpleeditdefaultform=(<<SEDFFORM);
 	<form action="/adm/coursedocs" method="post" name="simpleeditdefault">
@@ -3105,15 +3137,13 @@ SEDFFORM
 	);
 	$simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));
 	$simpleeditdefaultform .=(<<SEDFFORM);
-	<hr />
-	<p>
+	<hr id="bb_hrule" style="width:0px;text-align:left;margin-left:0" />
 	$lt{'copm'}<br />
 	<input type="text" size="40" name="importmap" /><br />
-	<span class="LC_nobreak"><input type="button"
+	<span class="LC_nobreak" style="float:left"><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
 
@@ -3360,7 +3390,7 @@ NGFFORM
         my @importdoc = (
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'newext\');" />'=>$extresourcesform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:makeims();" />'=>$imspform},);
-        $fileuploadform =  &create_form_ul(&create_list_elements(@importdoc)) . '<hr/>' . $fileuploadform;
+        $fileuploadform =  &create_form_ul(&create_list_elements(@importdoc)) . '<hr id="cc_hrule" style="width:0px;text-align:left;margin-left:0" />' . $fileuploadform;
 
         @gradingforma=(
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simpprob.png" alt="'.$lt{sipr}.'" onclick="javascript:makesmpproblem();" />'=>$newsmpproblemform},
@@ -3401,7 +3431,8 @@ unless ($env{'form.pagepath'}) {
 
  $hadchanges=0;
        unless ($supplementalflag) {
-          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+                              $supplementalflag,\%orderhash);
           if ($error) {
              $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }
@@ -3410,10 +3441,8 @@ unless ($env{'form.pagepath'}) {
           }
 
           &changewarning($r,'');
-          $r->print(&generate_edit_table('1',\%orderhash));
         }
-
-	}
+    }
 
 # Supplemental documents start here
 
@@ -3507,21 +3536,22 @@ my @supimportdoc = (
 		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'supnewext\');" />'
             =>$supnewextform},
         );
-$supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc)) . '<hr/>' . $supupdocform;
+$supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc)) . '<hr id="ee_hrule" style="width:0px;text-align:left;margin-left:0" />' . $supupdocform;
 my %suporderhash = (
 		'00' => ['Supnewfolder', $supnewfolderform],
                 'ee' => ['Import Documents',$supupdocform],
                 'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))]
                 );
         if ($supplementalflag) {
-           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+                               $supplementalflag,\%suporderhash);
            if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
            }
-           $r->print(&generate_edit_table('2',\%suporderhash));
         }
     } elsif ($supplementalflag) {
-        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
+        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+                            $supplementalflag);
         if ($error) {
             $r->print('<p><span class="LC_error">'.$error.'</span></p>');
         }
@@ -3624,7 +3654,7 @@ sub generate_admin_options {
 
 
 sub generate_edit_table {
-    my ($tid,$orderhash_ref) = @_;
+    my ($tid,$orderhash_ref,$to_show) = @_;
     return unless(ref($orderhash_ref) eq 'HASH');
     my %orderhash = %{$orderhash_ref};
     my $form;
@@ -3633,31 +3663,35 @@ sub generate_edit_table {
     if($env{'form.active'} ne ''){
         $activetab = $env{'form.active'};
     }
-    $form = '<div class="LC_Box" style="margin-right:0">';
-    $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';
-    foreach my $name (sort(keys(%orderhash))){
+    $form = '<div class="LC_Box" style="margin:0;">'.
+             '<ul id="navigation'.$tid.'" class="LC_TabContent">';
+    foreach my $name (reverse(sort(keys(%orderhash)))) {
         if($name ne '00'){
             if($activetab eq '' || $activetab ne $name){
                $active = '';
             }elsif($activetab eq $name){
                $active = 'class="active"';
             }
-            $form .= '<li '.$active
+            $form .= '<li style="float:right" '.$active
                 .' onmouseover="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');"'
                 .' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');"><a href="javascript:;"><b>'.&mt(${$orderhash{$name}}[0]).'</b></a></li>';
         } else {
-	    $form .= '<li '.$active.'>'.${$orderhash{$name}}[1].'</li>';
+	    $form .= '<li '.$active.' style="float:right">'.${$orderhash{$name}}[1].'</li>';
 
 	}
     }
     $form .= '</ul>';
-    $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0; clear: both;">';
+    $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0; overflow: hidden; clear:right">';
+
+    if ($to_show ne '') {
+        $form .= '<div style="padding:0;margin:0;float:left">'.$to_show.'</div>';
+    }
     foreach my $field (keys(%orderhash)){
 	if($field ne '00'){
             if($activetab eq '' || $activetab ne $field){
-                $active = 'style="display: none;"';
+                $active = 'style="display: none;float:left"';
             }elsif($activetab eq $field){
-                $active = 'style="display:block;"';
+                $active = 'style="display:block;float:left"';
             }
             $form .= '<div id="'.$field.$tid.'"'
                     .' class="LC_ContentBox" '.$active.'>'.${$orderhash{$field}}[1]
@@ -3936,6 +3970,7 @@ function showPage(current, pageId, nav,
 	current.className = 'active';
 	currentData = document.getElementById(pageId);
 	currentData.style.display = 'block';
+        activeTab = pageId;
         if (nav == 'mainnav') {
             var storedpath = "$docs_folderpath";
             if (storedpath == '') {
@@ -3970,6 +4005,7 @@ function showPage(current, pageId, nav,
                 }
             }
         }
+        resize_contentdiv('contentscroll','1','0');
 	return false;
 }
 
@@ -3982,6 +4018,197 @@ function injectData(current, hiddenField
 
 ENDNEWSCRIPT
 }
+
+sub resize_contentdiv_js {
+    my ($tabidstr) = @_;
+    my $viewport_js = &Apache::loncommon::viewport_geometry_js();
+    return <<ENDRESIZESCRIPT;
+
+window.onresize=resizeContentEditor;
+
+var activeTab;
+
+$viewport_js
+
+function resize_contentdiv(scrollboxname,chkw,chkh) {
+    var scrollboxid = 'div_'+scrollboxname;
+    var scrolltableid = 'table_'+scrollboxname;
+    var scrollbox;
+    var scrolltable;
+
+    if (document.getElementById("contenteditor") == null) {
+        return;
+    }
+
+    if (document.getElementById(scrollboxid) == null) {
+        return;
+    } else {
+        scrollbox = document.getElementById(scrollboxid);
+    }
+
+    if (document.getElementById(scrolltableid) == null) {
+        return;
+    } else {
+        scrolltable = document.getElementById(scrolltableid);
+    }
+
+    init_geometry();
+    var vph = Geometry.getViewportHeight();
+    var vpw = Geometry.getViewportWidth();
+
+    var alltabs = ['$tabidstr'];
+    var listwchange;
+    if (chkw == 1) {
+        var contenteditorw = document.getElementById("contenteditor").offsetWidth;
+        var contentlistw;
+        var contentlistid = document.getElementById("contentlist");
+        if (contentlistid != null) {
+            contentlistw = document.getElementById("contentlist").offsetWidth;
+        }
+        var contentlistwstart = contentlistw;
+
+        var scrollboxw = scrollbox.offsetWidth;
+        var scrollboxscrollw = scrollbox.scrollWidth;
+
+        var offsetw = parseInt(vpw * 0.015);
+        var paddingw = parseInt(vpw * 0.09);
+
+        var minscrollboxw = 250;
+
+        var maxtabw = 0;
+        var actabw = 0;
+        for (var i=0; i<alltabs.length; i++) {
+            if (activeTab == alltabs[i]) {
+                actabw = document.getElementById(alltabs[i]).offsetWidth;
+                if (actabw > maxtabw) {
+                    maxtabw = actabw;
+                }
+            } else {
+                if (document.getElementById(alltabs[i]) != null) {
+                    var thistab = document.getElementById(alltabs[i]);
+                    thistab.style.visibility = 'hidden';
+                    thistab.style.display = 'block';
+                    var tabw = document.getElementById(alltabs[i]).offsetWidth;
+                    thistab.style.display = 'none';
+                    thistab.style.visibility = '';
+                    if (tabw > maxtabw) {
+                        maxtabw = tabw;
+                    }
+                }
+            }
+        }
+
+        if (maxtabw > 0) {
+            var newscrollboxw;
+            if (maxtabw+paddingw+scrollboxscrollw<contenteditorw) {
+                newscrollboxw = contenteditorw-paddingw-maxtabw;
+                if (newscrollboxw < minscrollboxw) {
+                    newscrollboxw = minscrollboxw;
+                }
+                scrollbox.style.width = newscrollboxw+"px";
+                if (newscrollboxw != scrollboxw) {
+                    var newcontentlistw = newscrollboxw-offsetw;
+                    contentlistid.style.width = newcontentlistw+"px";
+                }
+            } else {
+                newscrollboxw = contenteditorw-paddingw-maxtabw;
+                if (newscrollboxw < minscrollboxw) {
+                    newscrollboxw = minscrollboxw;
+                }
+                scrollbox.style.width = newscrollboxw+"px";
+                if (newscrollboxw != scrollboxw) {
+                    var newcontentlistw = newscrollboxw-offsetw;
+                    contentlistid.style.width = newcontentlistw+"px";
+                }
+            }
+
+            if (newscrollboxw != scrollboxw) {
+                var newscrolltablew = newscrollboxw+offsetw;
+                scrolltable.style.width = newscrolltablew+"px";
+            }
+        }
+
+        if (contentlistid.offsetWidth != contentlistwstart) {
+            listwchange = 1;
+        }
+
+        if (activeTab == 'cc1') {
+            if (document.getElementById('cc_hrule') != null) {
+                document.getElementById('cc_hrule').style.width=actabw+"px";
+            }
+        } else {
+            if (activeTab == 'bb1') {
+                if (document.getElementById('bb_hrule') != null) {
+                    document.getElementById('bb_hrule').style.width=actabw+"px";
+                }
+            } else {
+                if (activeTab == 'ee2') {
+                    if (document.getElementById('ee_hrule') != null) {
+                        document.getElementById('ee_hrule').style.width=actabw+"px";
+                    }
+                }
+            }
+        }
+    }
+    if ((chkh == 1) || (listwchange)) {
+        var primaryheight = document.getElementById("LC_nav_bar").offsetHeight;
+        var secondaryheight = document.getElementById("LC_secondary_menu").offsetHeight;
+        var crumbsheight = document.getElementById("LC_breadcrumbs").offsetHeight;
+        var dccidheight = document.getElementById("dccid").offsetHeight;
+
+        var uploadresultheight = 0;
+        if (document.getElementById("uploadfileresult") != null) {
+            uploadresultheight = document.getElementById("uploadfileresult").offsetHeight;
+        }
+        var tabbedheight = document.getElementById("tabbededitor").offsetHeight;
+        var contenteditorheight = document.getElementById("contenteditor").offsetHeight;
+        var scrollboxheight = scrollbox.offsetHeight;
+        var scrollboxscrollheight = scrollbox.scrollHeight;
+        var freevspace = vph-(primaryheight+secondaryheight+crumbsheight+dccidheight+uploadresultheight+tabbedheight+contenteditorheight);
+
+        var minvscrollbox = 200;
+        var offsetv = 20;
+        var newscrollboxheight;
+        if (freevspace < 0) {
+            newscrollboxheight = scrollboxheight+freevspace-offsetv;
+            if (newscrollboxheight < minvscrollbox) {
+                newscrollboxheight = minvscrollbox;
+            }
+            scrollbox.style.height = newscrollboxheight + "px";
+        } else {
+            if (scrollboxscrollheight > scrollboxheight) {
+                if (freevspace > offsetv) {
+                    newscrollboxheight = scrollboxheight+freevspace-offsetv;
+                    if (newscrollboxheight < minvscrollbox) {
+                        newscrollboxheight = minvscrollbox;
+                    }
+                    scrollbox.style.height = newscrollboxheight+"px";
+                }
+            }
+        }
+        scrollboxheight = scrollbox.offsetHeight;
+        var contentlistheight = document.getElementById("contentlist").offsetHeight;
+
+        if (scrollboxscrollheight <= scrollboxheight) {
+            if ((contentlistheight+offsetv)<scrollboxheight) {
+                newscrollheight = contentlistheight+offsetv;
+                scrollbox.style.height = newscrollheight+"px";
+            }
+        }
+    }
+    return;
+}
+
+function resizeContentEditor() {
+    var timer;
+    clearTimeout(timer)
+    timer=setTimeout('resize_contentdiv("contentscroll","1","1")',500);
+}
+
+ENDRESIZESCRIPT
+    return;
+}
+
 1;
 __END__