--- a/trunk/Src/UJavaScriptUtils.pas
+++ b/trunk/Src/UJavaScriptUtils.pas
@@ -16,6 +16,11 @@
 
 
 interface
+
+
+uses
+  // Project
+  UEncodings;
 
 
 type
@@ -55,6 +60,19 @@
     ///  UnicodeString and WideChar.</exception>
     class function LiteralFunc(const FnName: string;
       const Params: array of const): string; static;
+    ///  <summary>Loads JavaScript code for the script named in HTML resources
+    ///  and returns the script as string.</summary>
+    ///  <param name="ScriptName">string [in] Name of resource containing
+    ///  script.</param>
+    ///  <param name="EncType">TEncodingType [in] Denotes type of encoding used
+    ///  for requested script within resources.</param>
+    ///  <returns>string. Required JavaScript code.</returns>
+    ///  <remarks>We sometimes need to load scripts into strings and then embed
+    ///  in HTML document since linking to external resource script doesn't seem
+    ///  to work in IE 9 (see bug report
+    ///  https://sourceforge.net/p/codesnip/bugs/84/).</remarks>
+    class function LoadScript(const ScriptName: string;
+      const EncType: TEncodingType): string; static;
   end;
 
 
@@ -65,7 +83,7 @@
   // Delphi
   SysUtils, Classes,
   // Project
-  UConsts, UExceptions, UStrUtils;
+  UConsts, UExceptions, UResourceUtils, UStrUtils;
 
 
 { TJavaScript }
@@ -129,6 +147,17 @@
     Result := 'false';
 end;
 
+class function TJavaScript.LiteralParam(const F: Extended): string;
+begin
+  Result := FloatToStr(F);
+end;
+
+class function TJavaScript.LoadScript(const ScriptName: string;
+  const EncType: TEncodingType): string;
+begin
+  Result := LoadResourceAsString(HInstance, ScriptName, RT_HTML, EncType);
+end;
+
 class function TJavaScript.MakeSafeString(const S: string): string;
 const
   EscapableChars = DOUBLEQUOTE + SINGLEQUOTE + '\' + LF + CR + TAB + FF
@@ -140,10 +169,5 @@
   );
 end;
 
-class function TJavaScript.LiteralParam(const F: Extended): string;
-begin
-  Result := FloatToStr(F);
-end;
-
 end.