includes/clientside/static/misc.js~
changeset 3 2b2084ca1e60
parent 2 0931d60f5bdb
child 4 0b3a0aedfd53
equal deleted inserted replaced
2:0931d60f5bdb 3:2b2084ca1e60
     1 // Some additional DHTML functions
       
     2 
       
     3 function fetch_offset(obj) {
       
     4   var left_offset = obj.offsetLeft;
       
     5   var top_offset = obj.offsetTop;
       
     6   while ((obj = obj.offsetParent) != null) {
       
     7     left_offset += obj.offsetLeft;
       
     8     top_offset += obj.offsetTop;
       
     9   }
       
    10   return { 'left' : left_offset, 'top' : top_offset };
       
    11 }
       
    12 
       
    13 function fetch_dimensions(o) {
       
    14   var w = o.offsetWidth;
       
    15   var h = o.offsetHeight;
       
    16   return { 'w' : w, 'h' : h };
       
    17 }
       
    18 
       
    19 function findParentForm(o)
       
    20 {
       
    21   // Not implemented - someone please let me know how to do this, what I need to do is
       
    22   // find the first parent <form> tag above param 'o', not sure how to do it with DOM
       
    23 }
       
    24 
       
    25 function ajaxReverseDNS(o, text)
       
    26 {
       
    27   if(text) var ipaddr = text;
       
    28   else var ipaddr = o.innerHTML;
       
    29   rDnsObj = o;
       
    30   rDnsBannerObj = bannerOn('Retrieving reverse DNS info...');
       
    31   ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function() {
       
    32       if(ajax.readyState == 4)
       
    33       {
       
    34         off = fetch_offset(rDnsObj);
       
    35         dim = fetch_dimensions(rDnsObj);
       
    36         right = off['left'] + dim['w'];
       
    37         top = off['top'] + dim['h'];
       
    38         var thediv = document.createElement('div');
       
    39         thediv.className = 'info-box';
       
    40         thediv.style.margin = '0';
       
    41         thediv.style.position = 'absolute';
       
    42         thediv.style.top  = top  + 'px';
       
    43         thediv.style.display = 'none';
       
    44         thediv.style.zIndex = getHighestZ() + 2;
       
    45         thediv.id = 'mdgDynamic_rDnsInfoDiv_'+Math.floor(Math.random() * 1000000);
       
    46         thediv.innerHTML = '<b>Reverse DNS:</b><br />'+ajax.responseText+' <a href="#" onclick="elem = document.getElementById(\''+thediv.id+'\'); elem.innerHTML = \'\'; elem.style.display = \'none\';return false;">Close</a>';
       
    47         var body = document.getElementsByTagName('body');
       
    48         body = body[0];
       
    49         bannerOff(rDnsBannerObj);
       
    50         body.appendChild(thediv);
       
    51         thediv.style.display = 'block';
       
    52         left = fetch_dimensions(thediv);
       
    53         thediv.style.display = 'none';
       
    54         left = right - left['w'];
       
    55         thediv.style.left = left + 'px';
       
    56         thediv.style.display = 'block';
       
    57         fadeInfoBoxes();
       
    58       }
       
    59     });
       
    60 }
       
    61 
       
    62 function bannerOn(text)
       
    63 {
       
    64   darken(true);
       
    65   var thediv = document.createElement('div');
       
    66   thediv.className = 'mdg-comment';
       
    67   thediv.style.padding = '0';
       
    68   thediv.style.marginLeft = '0';
       
    69   thediv.style.position = 'absolute';
       
    70   thediv.style.display = 'none';
       
    71   thediv.style.padding = '4px';
       
    72   thediv.style.fontSize = '14pt';
       
    73   thediv.id = 'mdgDynamic_bannerDiv_'+Math.floor(Math.random() * 1000000);
       
    74   thediv.innerHTML = text;
       
    75   
       
    76   var body = document.getElementsByTagName('body');
       
    77   body = body[0];
       
    78   body.appendChild(thediv);
       
    79   body.style.cursor = 'wait';
       
    80   
       
    81   thediv.style.display = 'block';
       
    82   dim = fetch_dimensions(thediv);
       
    83   thediv.style.display = 'none';
       
    84   bdim = { 'w' : getWidth(), 'h' : getHeight() };
       
    85   so = getScrollOffset();
       
    86   
       
    87   left = (bdim['w'] / 2) - ( dim['w'] / 2 );
       
    88   top  = (bdim['h'] / 2) - ( dim['h'] / 2 ) + so;
       
    89   
       
    90   thediv.style.top  = top  + 'px';
       
    91   thediv.style.left = left + 'px';
       
    92   
       
    93   thediv.style.display = 'block';
       
    94   
       
    95   return thediv.id;
       
    96 }
       
    97 
       
    98 function bannerOff(id)
       
    99 {
       
   100   e = document.getElementById(id);
       
   101   if(!e) return;
       
   102   e.innerHTML = '';
       
   103   e.style.display = 'none';
       
   104   var body = document.getElementsByTagName('body');
       
   105   body = body[0];
       
   106   body.style.cursor = 'default';
       
   107   enlighten(true);
       
   108 }
       
   109 
       
   110 function disableUnload(message)
       
   111 {
       
   112   if(typeof message != 'string') message = 'You may want to save your changes first.';
       
   113   var body = document.getElementsByTagName('body');
       
   114   body = body[0];
       
   115   body.onbeforeunload='return unescape(\''+escape(message)+'\')';
       
   116 }
       
   117 
       
   118 function enableUnload()
       
   119 {
       
   120   var body = document.getElementsByTagName('body');
       
   121   body = body[0];
       
   122   body.onbeforeunload = null;
       
   123 }
       
   124 
       
   125 /**
       
   126  * Gets the highest z-index of all divs in the document
       
   127  * @return integer
       
   128  */
       
   129 function getHighestZ()
       
   130 {
       
   131   z = 0;
       
   132   var divs = document.getElementsByTagName('div');
       
   133   for(var i = 0; i < divs.length; i++)
       
   134   {
       
   135     if(divs[i].style.zIndex > z) z = divs[i].style.zIndex;
       
   136   }
       
   137   return z;
       
   138 }
       
   139 
       
   140 function isKeyPressed(event)
       
   141 {
       
   142   if (event.shiftKey==1)
       
   143   {
       
   144     shift = true;
       
   145   }
       
   146   else
       
   147   {
       
   148     shift = false;
       
   149   }
       
   150 }
       
   151 
       
   152 function moveDiv(div, newparent)
       
   153 {
       
   154   var backup = div;
       
   155   var oldparent = div.parentNode;
       
   156   oldparent.removeChild(div);
       
   157   newparent.appendChild(backup);
       
   158 }
       
   159 
       
   160 function readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;}
       
   161 function createCookie(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
       
   162 function eraseCookie(name) {createCookie(name,"",-1);}
       
   163 
       
   164 var busyBannerID;
       
   165 function goBusy(msg)
       
   166 {
       
   167   if(!msg) msg = 'Please wait...';
       
   168   body = document.getElementsByTagName('body');
       
   169   body = body[0];
       
   170   body.style.cursor = 'wait';
       
   171   busyBannerID = bannerOn(msg);
       
   172 }
       
   173 
       
   174 function unBusy()
       
   175 {
       
   176   body = document.getElementsByTagName('body');
       
   177   body = body[0];
       
   178   body.style.cursor = 'default';
       
   179   bannerOff(busyBannerID);
       
   180 }
       
   181 
       
   182 function setAjaxLoading()
       
   183 {
       
   184   if ( document.getElementById('ajaxloadicon') )
       
   185   {
       
   186     document.getElementById('ajaxloadicon').src=scriptPath + '/images/loading.gif';
       
   187   }
       
   188 }
       
   189 
       
   190 function unsetAjaxLoading()
       
   191 {
       
   192   if ( document.getElementById('ajaxloadicon') )
       
   193   {
       
   194     document.getElementById('ajaxloadicon').src=scriptPath + '/images/spacer.gif';
       
   195   }
       
   196 }
       
   197 
       
   198 /*
       
   199  * Search boxes
       
   200  */
       
   201  
       
   202 function buildSearchBoxes()
       
   203 {
       
   204   var divs = document.getElementsByTagName('*');
       
   205   var boxes = new Array();
       
   206   for ( var i = 0; i < divs.length; i++ )
       
   207   {
       
   208     if ( divs[i].className)
       
   209     {
       
   210       if ( divs[i].className.substr(0, 9) == 'searchbox' )
       
   211       {
       
   212         boxes.push(divs[i]);
       
   213       }
       
   214     }
       
   215   }
       
   216   for ( var i = 0; i < boxes.length; i++ )
       
   217   {
       
   218     if ( boxes[i].className.match(/^searchbox\[([0-9]+)px\]$/) )
       
   219     {
       
   220       var width = boxes[i].className.match(/^searchbox\[([0-9]+)px\]$/);
       
   221       width = parseInt(width[1]);
       
   222     }
       
   223     else
       
   224     {
       
   225       var width = 120;
       
   226     }
       
   227     createSearchBox(boxes[i], width);
       
   228   }
       
   229 }
       
   230 
       
   231 function createSearchBox(parent, width)
       
   232 {
       
   233   if ( typeof(parent) != 'object')
       
   234   {
       
   235     alert('BUG: createSearchBox(): parent is not an object');
       
   236     return false;
       
   237   }
       
   238   //parent.style.padding = '0px';
       
   239   //parent.style.textAlign = 'center';
       
   240   parent.style.width = width + 'px';
       
   241   var submit = document.createElement('div');
       
   242   submit.onclick = function() { searchFormSubmit(this); };
       
   243   submit.className = 'js-search-submit';
       
   244   var input = document.createElement('input');
       
   245   input.className = 'js-search-box';
       
   246   input.value = 'Search';
       
   247   input.name = 'q';
       
   248   input.style.width = ( width - 28 ) + 'px';
       
   249   input.onfocus = function() { if ( this.value == 'Search' ) this.value = ''; };
       
   250   input.onblur  = function() { if ( this.value == '' ) this.value = 'Search'; };
       
   251   parent.appendChild(input);
       
   252   var off = fetch_offset(input);
       
   253   var top = off['top'] + 'px';
       
   254   var left = ( parseInt(off['left']) + ( width - 24 ) ) + 'px';
       
   255   submit.style.top = top;
       
   256   submit.style.left = left;
       
   257   parent.appendChild(submit);
       
   258 }
       
   259 
       
   260 function searchFormSubmit(obj)
       
   261 {
       
   262   var input = obj.previousSibling;
       
   263   if ( input.value == 'Search' || input.value == '' )
       
   264     return false;
       
   265   var p = obj;
       
   266   while(true)
       
   267   {
       
   268     p = p.parentNode;
       
   269     if ( !p )
       
   270       break;
       
   271     if ( typeof(p.tagName) != 'string' )
       
   272       break;
       
   273     else if ( p.tagName.toLowerCase() == 'form' )
       
   274     {
       
   275       p.submit();
       
   276     }
       
   277     else if ( p.tagName.toLowerCase() == 'body' )
       
   278     {
       
   279       break;
       
   280     }
       
   281   }
       
   282 }
       
   283 
       
   284 /*
       
   285  * AJAX login box (experimental)
       
   286  */
       
   287 
       
   288 var ajax_auth_prompt_cache = false;
       
   289 var ajax_auth_mb_cache = false;
       
   290 var ajax_auth_level_cache = false;
       
   291 
       
   292 function ajaxPromptAdminAuth(call_on_ok, level)
       
   293 {
       
   294   if ( typeof(call_on_ok) == 'function' )
       
   295   {
       
   296     ajax_auth_prompt_cache = call_on_ok;
       
   297   }
       
   298   if ( !level )
       
   299     level = 2;
       
   300   ajax_auth_level_cache = level;
       
   301   var loading_win = '<div align="center" style="text-align: center;"> \
       
   302       <p>Fetching an encryption key...</p> \
       
   303       <p><small>Not working? Use the <a href="'+makeUrlNS('Special', 'Login/' + title)+'">alternate login form</a>.</p> \
       
   304       <p><img alt="Please wait..." src="'+scriptPath+'/images/loading-big.gif" /></p> \
       
   305     </div>';
       
   306   ajax_auth_mb_cache = new messagebox(MB_OKCANCEL|MB_ICONLOCK, 'Please enter your username and password to continue.', loading_win);
       
   307   ajax_auth_mb_cache.onbeforeclick['OK'] = ajaxValidateLogin;
       
   308   ajaxAuthLoginInnerSetup();
       
   309 }
       
   310 
       
   311 function ajaxAuthLoginInnerSetup()
       
   312 {
       
   313   ajaxGet(makeUrlNS('Special', 'Login', 'act=getkey'), function() {
       
   314       if ( ajax.readyState == 4 )
       
   315       {
       
   316         var response = ajax.responseText;
       
   317         if ( response.substr(0,1) != '{' )
       
   318         {
       
   319           alert('Invalid JSON response from server: ' + response);
       
   320           return false;
       
   321         }
       
   322         response = parseJSON(response);
       
   323         var form_html = ' \
       
   324           <table border="0" align="center"> \
       
   325             <tr> \
       
   326               <td>Username:</td><td><input tabindex="1" id="ajaxlogin_user" type="text"     size="25" /> \
       
   327             </tr> \
       
   328             <tr> \
       
   329               <td>Password:</td><td><input tabindex="2" id="ajaxlogin_pass" type="password" size="25" /> \
       
   330             </tr> \
       
   331             <tr> \
       
   332               <td colspan="2" style="text-align: center;"> \
       
   333                 <br /><small>Trouble logging in? Try the <a href="'+makeUrlNS('Special', 'Login/' + title)+'">full login form</a>.<br /> \
       
   334                 Did you <a href="'+makeUrlNS('Special', 'PasswordReset')+'">forget your password</a>?<br /> \
       
   335                 Maybe you need to <a href="'+makeUrlNS('Special', 'Register')+'">create an account</a>.</small> \
       
   336               </td> \
       
   337             </tr> \
       
   338           </table> \
       
   339           <input type="hidden" id="ajaxlogin_crypt_key"       value="' + response.key + '" /> \
       
   340           <input type="hidden" id="ajaxlogin_crypt_challenge" value="' + response.challenge + '" /> \
       
   341         </form>';
       
   342         ajax_auth_mb_cache.updateContent(form_html);
       
   343         $('messageBox').object.nextSibling.firstChild.tabindex = '3';
       
   344         $('ajaxlogin_user').object.focus();
       
   345         $('ajaxlogin_pass').object.onblur = function() { $('messageBox').object.nextSibling.firstChild.focus(); };
       
   346       }
       
   347     });
       
   348 }
       
   349 
       
   350 function ajaxValidateLogin()
       
   351 {
       
   352   var username,password,auth_enabled,crypt_key,crypt_data,challenge_salt,challenge_data;
       
   353   username = document.getElementById('ajaxlogin_user');
       
   354   if ( !username )
       
   355     return false;
       
   356   username = document.getElementById('ajaxlogin_user').value;
       
   357   password = document.getElementById('ajaxlogin_pass').value;
       
   358   auth_enabled = false;
       
   359   
       
   360   disableJSONExts();
       
   361   
       
   362   //
       
   363   // Encryption test
       
   364   //
       
   365   
       
   366   var str = '';
       
   367   for(i=0;i<keySizeInBits/4;i++)
       
   368   {
       
   369     str+='0';
       
   370   }
       
   371   str = hexToByteArray(str);
       
   372   var ct  = rijndaelEncrypt(str, str, 'ECB');
       
   373   ct      = byteArrayToHex(ct);
       
   374   var v;
       
   375   switch(keySizeInBits)
       
   376   {
       
   377     case 128:
       
   378       v = '66e94bd4ef8a2c3b884cfa59ca342b2e';
       
   379       break;
       
   380     case 192:
       
   381       v = 'aae06992acbf52a3e8f4a96ec9300bd7aae06992acbf52a3e8f4a96ec9300bd7';
       
   382       break;
       
   383     case 256:
       
   384       v = 'dc95c078a2408989ad48a21492842087dc95c078a2408989ad48a21492842087';
       
   385       break;
       
   386   }
       
   387   auth_enabled = ( ct == v && md5_vm_test() );
       
   388   if ( !auth_enabled )
       
   389   {
       
   390     alert('Login error: encryption sanity check failed\n');
       
   391     return true;
       
   392   }
       
   393   
       
   394   crypt_key = document.getElementById('ajaxlogin_crypt_key').value;
       
   395   challenge_salt = document.getElementById('ajaxlogin_crypt_challenge').value;
       
   396   
       
   397   var crypt_key_md5 = hex_md5(crypt_key);
       
   398   
       
   399   challenge_data = hex_md5(password + challenge_salt) + challenge_salt;
       
   400   
       
   401   password = stringToByteArray(password);
       
   402   crypt_key = hexToByteArray(crypt_key);
       
   403   
       
   404   crypt_data = rijndaelEncrypt(password, crypt_key, 'ECB');
       
   405   crypt_data = byteArrayToHex(crypt_data);
       
   406   
       
   407   var json_data = {
       
   408     'username' : username,
       
   409     'crypt_key' : crypt_key_md5,
       
   410     'challenge' : challenge_data,
       
   411     'crypt_data' : crypt_data,
       
   412     'level' : ajax_auth_level_cache
       
   413   };
       
   414   
       
   415   json_data = toJSONString(json_data);
       
   416   json_data = ajaxEscape(json_data);
       
   417   
       
   418   var loading_win = '<div align="center" style="text-align: center;"> \
       
   419       <p>Logging in...</p> \
       
   420       <p><img alt="Please wait..." src="'+scriptPath+'/images/loading-big.gif" /></p> \
       
   421     </div>';
       
   422     
       
   423   ajax_auth_mb_cache.updateContent(loading_win);
       
   424   
       
   425   ajaxPost(makeUrlNS('Special', 'Login', 'act=ajaxlogin'), 'params=' + json_data, function() {
       
   426       if ( ajax.readyState == 4 )
       
   427       {
       
   428         var response = ajax.responseText;
       
   429         if ( response.substr(0,1) != '{' )
       
   430         {
       
   431           alert('Invalid JSON response from server: ' + response);
       
   432           ajaxAuthLoginInnerSetup();
       
   433           return false;
       
   434         }
       
   435         response = parseJSON(response);
       
   436         switch(response.result)
       
   437         {
       
   438           case 'success':
       
   439             if ( typeof(ajax_auth_prompt_cache) == 'function' )
       
   440             {
       
   441               ajax_auth_prompt_cache(response.key);
       
   442             }
       
   443             break;
       
   444           case 'error':
       
   445             alert(response.error);
       
   446             ajaxAuthLoginInnerSetup();
       
   447             break;
       
   448           default:
       
   449             alert(ajax.responseText);
       
   450             break;
       
   451         }
       
   452       }
       
   453     });
       
   454   
       
   455   return true;
       
   456   
       
   457 }
       
   458 
       
   459 // This code is in the public domain. Feel free to link back to http://jan.moesen.nu/
       
   460 function sprintf()
       
   461 {
       
   462   if (!arguments || arguments.length < 1 || !RegExp)
       
   463   {
       
   464     return;
       
   465   }
       
   466   var str = arguments[0];
       
   467   var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
       
   468   var a = b = [], numSubstitutions = 0, numMatches = 0;
       
   469   while (a = re.exec(str))
       
   470   {
       
   471     var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
       
   472     var pPrecision = a[5], pType = a[6], rightPart = a[7];
       
   473     
       
   474     //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision);
       
   475 
       
   476     numMatches++;
       
   477     if (pType == '%')
       
   478     {
       
   479       subst = '%';
       
   480     }
       
   481     else
       
   482     {
       
   483       numSubstitutions++;
       
   484       if (numSubstitutions >= arguments.length)
       
   485       {
       
   486         alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
       
   487       }
       
   488       var param = arguments[numSubstitutions];
       
   489       var pad = '';
       
   490              if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
       
   491         else if (pPad) pad = pPad;
       
   492       var justifyRight = true;
       
   493              if (pJustify && pJustify === "-") justifyRight = false;
       
   494       var minLength = -1;
       
   495              if (pMinLength) minLength = parseInt(pMinLength);
       
   496       var precision = -1;
       
   497              if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
       
   498       var subst = param;
       
   499              if (pType == 'b') subst = parseInt(param).toString(2);
       
   500         else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
       
   501         else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
       
   502         else if (pType == 'u') subst = Math.abs(param);
       
   503         else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
       
   504         else if (pType == 'o') subst = parseInt(param).toString(8);
       
   505         else if (pType == 's') subst = param;
       
   506         else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
       
   507         else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
       
   508     }
       
   509     str = leftpart + subst + rightPart;
       
   510   }
       
   511   return str;
       
   512 }
       
   513 
       
   514 function paginator_goto(parentobj, this_page, num_pages, perpage, url_string)
       
   515 {
       
   516   var height = $(parentobj).Height();
       
   517   var width  = $(parentobj).Width();
       
   518   var left   = $(parentobj).Left();
       
   519   var top    = $(parentobj).Top();
       
   520   var left_pos = left + width ;
       
   521   var top_pos = height + top;
       
   522   var div = document.createElement('div');
       
   523   div.style.position = 'absolute';
       
   524   div.style.top = top_pos + 'px';
       
   525   div.className = 'question-box';
       
   526   div.style.margin = '1px 0 0 2px';
       
   527   var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
       
   528   div.innerHTML = 'Go to page:<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" />&emsp;<a href="#" onclick="paginator_submit(this, '+num_pages+', '+perpage+', unescape(\'' + escape(url_string) + '\')); return false;" style="font-size: 14pt; text-decoration: none;">&raquo;</a>&emsp;<a href="#" onclick="fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">&times;</a>';
       
   529   
       
   530   var body = document.getElementsByTagName('body')[0];
       
   531   body.appendChild(div);
       
   532   
       
   533   document.getElementById(vtmp).onkeypress = function(e){if(e.keyCode==13)this.nextSibling.nextSibling.onclick();};
       
   534   document.getElementById(vtmp).focus();
       
   535   
       
   536   // fade the div
       
   537   /*
       
   538   if(!div.id) div.id = 'autofade_'+Math.floor(Math.random() * 100000);
       
   539   var from = '#33FF33';
       
   540   Fat.fade_element(div.id,30,2000,from,Fat.get_bgcolor(div.id));
       
   541   */
       
   542   fly_in_bottom(div, false, true);
       
   543   
       
   544   var divh = $(div).Width();
       
   545   left_pos = left_pos - divh;
       
   546   div.style.left = left_pos + 'px';
       
   547 }
       
   548 
       
   549 function paginator_submit(obj, max, perpage, formatstring)
       
   550 {
       
   551   var userinput = obj.previousSibling.previousSibling.value;
       
   552   userinput = parseInt(userinput);
       
   553   var offset = ( userinput - 1 ) * perpage;
       
   554   if ( userinput > max || isNaN(userinput) || userinput < 1 )
       
   555   {
       
   556     new messagebox(MB_OK|MB_ICONSTOP, 'Invalid entry', 'Please enter a page number between 1 and ' + max + '.');
       
   557     return false;
       
   558   }
       
   559   var url = sprintf(formatstring, String(offset));
       
   560   fly_out_top(obj.parentNode, false, true);
       
   561   window.location = url;
       
   562 }
       
   563