Index: src/viewerfiles/ajaxmappane.templ
===================================================================
--- src/viewerfiles/ajaxmappane.templ	(revision 4073)
+++ src/viewerfiles/ajaxmappane.templ	(working copy)
@@ -173,6 +173,7 @@
 <script type="text/javascript" src="../viewerfiles/hashtable.js"></script>
 <script type="text/javascript" src="../viewerfiles/sarissa.js"></script>
 <script type="text/javascript" src="../viewerfiles/digitize.js"></script>
+<script language="javascript" src="../viewerfiles/util.js"></script>
 <script language=javascript>
 
 function SelLayer(className)
@@ -1751,12 +1752,6 @@
         document.getElementById("selectionImage").src = document.getElementById("selectionImage").src;
 }
 
-function encodeComponent(str)
-{
-    op = /\(/g; cp = /\)/g;
-    return encodeURIComponent(str).replace(op, "%%28").replace(cp, "%%29");
-}
-
 function OnMapOverlayImageLoaded(e)
 {
     ovimgloaded = true;
Index: src/viewerfiles/bufferui.templ
===================================================================
--- src/viewerfiles/bufferui.templ	(revision 4073)
+++ src/viewerfiles/bufferui.templ	(working copy)
@@ -46,6 +46,7 @@
 </style>
 
 <script language="javascript" src="../viewerfiles/browserdetect.js"></script>
+<script language="javascript" src="../viewerfiles/util.js"></script>
 <script language=javascript>
 
 var popup = %s;
@@ -106,21 +107,7 @@
     elt.backgroundColor = transparent? "#ffffff": "#" + fbcolor;
     elt.color = transparent? "black": "#" + fbcolor;
 }
-
-function ParseLocalizedFloat(floatString)
-{
-    if(thousandSeparator.length > 0)
-    {
-        floatString = floatString.replace(thousandSeparator, "");
-    }
-    if(decimalSeparator != "." && decimalSeparator.length > 0)
-    {
-        floatString = floatString.replace(decimalSeparator, ".");
-    }
-    return parseFloat(floatString);
-}
             
-            
 function Validate()
 {
     var field = document.getElementById("distance");
Index: src/viewerfiles/mainframe.templ
===================================================================
--- src/viewerfiles/mainframe.templ	(revision 4073)
+++ src/viewerfiles/mainframe.templ	(working copy)
@@ -6,6 +6,7 @@
 <script language="javascript" src="../viewerfiles/numfmt.js"></script>
 <script language="javascript" src="../viewerfiles/browserdetect.js"></script>
 <script language="javascript" src="../viewerfiles/contextmenu.js"></script>
+<script language="javascript" src="../viewerfiles/util.js"></script>
 <script language=javascript>
 
 var clientAgentName = 'Ajax Viewer';
@@ -403,35 +404,16 @@
     }
 }
 
-function encodeComponentName(str)
-{
-    op = /\(/g; cp = /\)/g;
-    return encodeURIComponent(str).replace(op, "%%28").replace(cp, "%%29");
-}
-
-function ParseLocalizedFloatNum(floatString)
-{
-    if(thousandSeparator.length > 0)
-    {
-        floatString = floatString.replace(thousandSeparator, "");
-    }
-    if(decimalSeparator != "." && decimalSeparator.length > 0)
-    {
-        floatString = floatString.replace(decimalSeparator, ".");
-    }
-    return parseFloat(floatString);
-}
-
 function handler() 
 {
     if(this.readyState == 4 && this.status == 200) 
     {    
         if(!isStartPingServer)
         {
-            var num = ParseLocalizedFloatNum(this.responseText);
+            var num = ParseLocalizedFloat(this.responseText);
             if(!isNaN(num) && num != 0)
             {
-                var pingServerInterval = num / 5 * 1000;
+                var pingServerInterval = num / 5 * 1000;  //Ping server 5 times each period. Timeout is returned in seconds. 
                 intervalID = window.setInterval(GetServerSessionTimeout, pingServerInterval);
                 isStartPingServer = true;
             }
@@ -454,7 +436,7 @@
 
 function GetServerSessionTimeout()
 {
-    var url = webAgentAddress + "?OPERATION=GETSESSIONTIMEOUT&VERSION=2.2.0&SESSION=" + GetMapFrame().GetSessionId() + "&LOCALE=" + locale + "&CLIENTAGENT=" + encodeComponentName(clientAgentName) + "&REQUESTTIME=" + (new Date()).getTime();
+    var url = webAgentAddress + "?OPERATION=GETSESSIONTIMEOUT&VERSION=2.2.0&SESSION=" + GetMapFrame().GetSessionId() + "&LOCALE=" + locale + "&CLIENTAGENT=" + encodeComponent(clientAgentName) + "&REQUESTTIME=" + (new Date()).getTime();
     var request = new XMLHttpRequest();
     
     request.onreadystatechange = handler;
Index: src/viewerfiles/util.js
===================================================================
--- src/viewerfiles/util.js	(revision 0)
+++ src/viewerfiles/util.js	(revision 0)
@@ -0,0 +1,16 @@
+// Common utility functions
+
+function encodeComponent(str) {
+    op = /\(/g; cp = /\)/g;
+    return encodeURIComponent(str).replace(op, "%%28").replace(cp, "%%29");
+}
+
+function ParseLocalizedFloat(floatString) {
+    if (thousandSeparator.length > 0) {
+        floatString = floatString.replace(thousandSeparator, "");
+    }
+    if (decimalSeparator != "." && decimalSeparator.length > 0) {
+        floatString = floatString.replace(decimalSeparator, ".");
+    }
+    return parseFloat(floatString);
+}
\ No newline at end of file

