--- loncom/interface/loncommon.pm	2011/12/08 02:59:37	1.1032
+++ loncom/interface/loncommon.pm	2011/12/12 00:13:43	1.1036
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1032 2011/12/08 02:59:37 www Exp $
+# $Id: loncommon.pm,v 1.1036 2011/12/12 00:13:43 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1186,7 +1186,7 @@ sub help_open_topic {
     my ($topic, $text, $stayOnPage, $width, $height, $imgid) = @_;
     $text = "" if (not defined $text);
     $stayOnPage = 0 if (not defined $stayOnPage);
-    $width = 350 if (not defined $width);
+    $width = 500 if (not defined $width);
     $height = 400 if (not defined $height);
     my $filename = $topic;
     $filename =~ s/ /_/g;
@@ -1197,7 +1197,7 @@ sub help_open_topic {
     $topic=~s/\W/\_/g;
 
     if (!$stayOnPage) {
-	$link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
+	$link = "javascript:openMyModal('/adm/help/${filename}.hlp',$width,$height,'yes');";
     } else {
 	$link = "/adm/help/${filename}.hlp";
     }
@@ -6740,6 +6740,14 @@ sub headtag {
 	&& !$args->{'frameset'}) {
 	$result .= &help_menu_js();
         $result.=&modal_window();
+        $result.=&wishlist_window();
+    } else {
+        if ($args->{'add_modal'}) {
+           $result.=&modal_window();
+        }
+        if ($args->{'add_wishlist'}) {
+           $result.=&wishlist_window();
+        }
     }
     if (ref($args->{'redirect'})) {
 	my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
@@ -6954,6 +6962,28 @@ sub end_page {
     return $result;
 }
 
+sub wishlist_window {
+    return(<<'ENDWISHLIST');
+<script type="text/javascript" lang="javascript">
+// <![CDATA[
+// <!-- BEGIN LON-CAPA Internal
+function set_wishlistlink(title, path) {
+    if (!title) {
+        title = document.title;
+        title = title.replace(/^LON-CAPA /,'');
+    }
+    if (!path) {
+        path = location.pathname;
+    }
+    Win = window.open('/adm/wishlist?mode=newLink&setTitle='+title+'&setPath='+path,
+                      'wishlistNewLink','width=560,height=350,scrollbars=0');
+}
+// END LON-CAPA Internal -->
+// ]]>
+</script>
+ENDWISHLIST
+}
+
 sub modal_window {
     return(<<'ENDMODAL');
 <script type="text/javascript" lang="javascript">
@@ -7026,6 +7056,20 @@ sub modal_adhoc_script {
 ENDADHOC
 }
 
+sub modal_adhoc_window {
+    my ($funcname,$width,$height,$content,$linktext)=@_;
+    my $innerwidth=$width-20;
+    $content=&js_ready(
+               &start_page('Dialog',undef,{'only_body'=>1,'bgcolor'=>'#FFFFFF'}).
+                 &start_scrollbox($width.'px',$innerwidth.'px',$height.'px').
+                    $content.
+                 &end_scrollbox().
+               &end_page()
+             );
+    return &modal_adhoc_script($funcname,$width,$height,$content).
+         "<a href=\"javascript:$funcname();void(0);\">".$linktext."</a>";
+}
+
 sub html_encode {
     my ($result) = @_;
 
@@ -7084,7 +7128,7 @@ sub start_scrollbox {
 }
 
 sub end_scrollbox {
-    return '</td></tr></table>';
+    return '</div></td></tr></table>';
 }
 
 sub simple_error_page {