114a15,50
2>     if (targetPage != "" && !validURL(targetPage))
3>         targetPage = "undefined";
4>     function validURL(url) {
5>         var pos = url.indexOf(".html");
6>         if (pos == -1 || pos != url.length - 5)
7>             return false;
8>         var allowNumber = false;
9>         var allowSep = false;
10>         var seenDot = false;
11>         for (var i = 0; i < url.length - 5; i++) {
12>             var ch = url.charAt(i);
13>             if ('a' <= ch && ch <= 'z' ||
14>                     'A' <= ch && ch <= 'Z' ||
15>                     ch == '$' ||
16>                     ch == '_') {
17>                 allowNumber = true;
18>                 allowSep = true;
19>             } else if ('0' <= ch && ch <= '9'
20>                     || ch == '-') {
21>                 if (!allowNumber)
22>                      return false;
23>             } else if (ch == '/' || ch == '.') {
24>                 if (!allowSep)
25>                     return false;
26>                 allowNumber = false;
27>                 allowSep = false;
28>                 if (ch == '.')
29>                      seenDot = true;
30>                 if (ch == '/' && seenDot)
31>                      return false;
32>             } else {
33>                 return false;
34>             }
35>         }
36>         return true;
37>     }
38