--- loncom/interface/lonhtmlcommon.pm	2012/10/08 10:47:34	1.327
+++ loncom/interface/lonhtmlcommon.pm	2012/11/03 23:32:37	1.329
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.327 2012/10/08 10:47:34 foxr Exp $
+# $Id: lonhtmlcommon.pm,v 1.329 2012/11/03 23:32:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2925,29 +2925,6 @@ PARAMSONE
         if (itemid.offsetWidth != itemwstart) {
             listwchange = 1;
         }
-THIRD
-    if ($context eq 'docs') {
-        $output .= <<"DOCSTWO";
-        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";
-                    }
-                }
-            }
-        }
-DOCSTWO
-    }
-    $output .= <<"FOURTH";
     }
     if ((chkh == 1) || (listwchange)) {
         var primaryheight = document.getElementById('LC_nav_bar').offsetHeight;
@@ -3007,10 +2984,60 @@ function callResize() {
     timer=setTimeout('resize_scrollbox("$names{'scroll'}","1","1")',500);
 }
 
-FOURTH
+THIRD
     return $output;
 }
 
+##############################################
+##############################################
+
+sub javascript_jumpto_resource {
+    my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
+                         &mt('Switch server?');
+    return (<<ENDUTILITY)
+
+function go(url) {
+   if (url!='' && url!= null) {
+       currentURL = null;
+       currentSymb= null;
+       window.location.href=url;
+   }
+}
+
+function need_switchserver(url) {
+    if (url!='' && url!= null) {
+        if (confirm("$confirm_switch")) {
+            go(url);
+        }
+    }
+    return;
+}
+
+ENDUTILITY
+
+}
+
+sub jump_to_editres {
+    my ($cfile,$home,$switchserver,$uploaded,$symb) = @_;
+    my $jscall;
+    if ($switchserver) {
+        if ($symb && $home) {
+            $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.
+                     &HTML::Entities::encode($env{'request.role'},'"<>&').'&amp;'.
+                    'symb='.&HTML::Entities::encode($env{'request.symb'},'"<>&');
+            if ($uploaded) {
+                $cfile .= '&amp;forceedit=1';
+            }
+            $jscall = "need_switchserver('$cfile');";
+        }
+    } else {
+        if ($uploaded) {
+            $cfile .= '?forceedit=1';
+        }
+        $jscall = "go('$cfile')";
+    }
+    return $jscall;
+}
 
 ##############################################
 ##############################################