--- loncom/interface/lonhtmlcommon.pm	2012/07/06 22:46:06	1.319
+++ loncom/interface/lonhtmlcommon.pm	2012/09/24 10:47:26	1.324
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.319 2012/07/06 22:46:06 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.324 2012/09/24 10:47:26 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1211,6 +1211,10 @@ ENDEDITOR
 <link rel="stylesheet" type="text/css" href="/adm/jpicker/css/jPicker-1.1.6.min.css" />
 <script type="text/javascript" src="/adm/countdown/js/jquery.countdown.js"></script>
 <link rel="stylesheet" type="text/css" href="/adm/countdown/css/jquery.countdown.css" />
+
+<script type="text/javascript" src="/adm/spellchecker/js/jquery.spellchecker.min.js"></script>
+<link rel="stylesheet" type="text/css" href="/adm/spellchecker/css/spellchecker.css" />
+
 ENDJQUERY
 	return $s;
 }
@@ -1398,6 +1402,35 @@ sub htmlareaselectactive {
       });
    }
 });
+
+    /* This code describes the spellcheck options that will be used for
+       items with class 'spellchecked'.  It is necessary for those objects'
+       to explicitly request checking (e.g. onblur is a nice event for that).
+     */
+     \$(document).ready(function() {
+	 \$(".spellchecked").spellchecker({
+	   url: "/ajax/spellcheck",
+	   lang: "en",                      
+	   engine: "pspell",
+	   suggestionBoxPosition: "below",
+	   innerDocument: true
+					  });
+	 \$("textarea.spellchecked").spellchecker({
+	   url: "/ajax/spellcheck",
+	   lang: "en",                      
+	   engine: "pspell",
+	   suggestionBoxPosition: "below",
+	   innerDocument: true
+					  });
+
+			});
+
+    function doSpellcheck(element, lang) {
+	\$(element).spellchecker('option', {lang: lang});
+	\$(element).spellchecker('check');
+    }
+
+
 JAVASCRIPT
     if ($dragmath_prefix ne '') {
         $output .= '