Index: lib/weblib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/weblib.php,v
retrieving revision 1.812.2.89
diff -u -r1.812.2.89 weblib.php
--- lib/weblib.php	3 Dec 2007 16:47:23 -0000	1.812.2.89
+++ lib/weblib.php	6 Dec 2007 21:00:43 -0000
@@ -5881,14 +5881,15 @@
 function doc_link($path='', $text='', $iconpath='') {
     global $CFG;
 
+    $lang = str_replace('_utf8', '', current_language());
+    $url = $CFG->docroot. '/' .$lang. '/' .$path;
+
     $target = '';
     if (!empty($CFG->doctonewwindow)) {
-        $target = ' target="_blank"';
+        $target = " onclick=\"window.open('$url'); return false;\"";
     }
 
-    $lang = str_replace('_utf8', '', current_language());
-
-    $str = '<a href="' .$CFG->docroot. '/' .$lang. '/' .$path. '"' .$target. '>';
+    $str = "<a href=\"$url\"$target>";
 
     if (empty($iconpath)) {
         $iconpath = $CFG->httpswwwroot . '/pix/docs.gif';
