|
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 'success_reset': |
|
445 var conf = confirm('You have logged in using a temporary password. Before you can log in, you must finish resetting your password. Do you want to reset your real password now?'); |
|
446 if ( conf ) |
|
447 { |
|
448 var url = makeUrlNS('Special', 'PasswordReset/stage2/' + response.user_id + '/' + response.temppass); |
|
449 window.location = url; |
|
450 } |
|
451 else |
|
452 { |
|
453 ajaxAuthLoginInnerSetup(); |
|
454 } |
|
455 break; |
|
456 case 'error': |
|
457 alert(response.error); |
|
458 ajaxAuthLoginInnerSetup(); |
|
459 break; |
|
460 default: |
|
461 alert(ajax.responseText); |
|
462 break; |
|
463 } |
|
464 } |
|
465 }); |
|
466 |
|
467 return true; |
|
468 |
|
469 } |
|
470 |
|
471 // This code is in the public domain. Feel free to link back to http://jan.moesen.nu/ |
|
472 function sprintf() |
|
473 { |
|
474 if (!arguments || arguments.length < 1 || !RegExp) |
|
475 { |
|
476 return; |
|
477 } |
|
478 var str = arguments[0]; |
|
479 var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; |
|
480 var a = b = [], numSubstitutions = 0, numMatches = 0; |
|
481 while (a = re.exec(str)) |
|
482 { |
|
483 var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4]; |
|
484 var pPrecision = a[5], pType = a[6], rightPart = a[7]; |
|
485 |
|
486 //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision); |
|
487 |
|
488 numMatches++; |
|
489 if (pType == '%') |
|
490 { |
|
491 subst = '%'; |
|
492 } |
|
493 else |
|
494 { |
|
495 numSubstitutions++; |
|
496 if (numSubstitutions >= arguments.length) |
|
497 { |
|
498 alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).'); |
|
499 } |
|
500 var param = arguments[numSubstitutions]; |
|
501 var pad = ''; |
|
502 if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1); |
|
503 else if (pPad) pad = pPad; |
|
504 var justifyRight = true; |
|
505 if (pJustify && pJustify === "-") justifyRight = false; |
|
506 var minLength = -1; |
|
507 if (pMinLength) minLength = parseInt(pMinLength); |
|
508 var precision = -1; |
|
509 if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1)); |
|
510 var subst = param; |
|
511 if (pType == 'b') subst = parseInt(param).toString(2); |
|
512 else if (pType == 'c') subst = String.fromCharCode(parseInt(param)); |
|
513 else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0; |
|
514 else if (pType == 'u') subst = Math.abs(param); |
|
515 else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param); |
|
516 else if (pType == 'o') subst = parseInt(param).toString(8); |
|
517 else if (pType == 's') subst = param; |
|
518 else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase(); |
|
519 else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase(); |
|
520 } |
|
521 str = leftpart + subst + rightPart; |
|
522 } |
|
523 return str; |
|
524 } |
|
525 |
|
526 function paginator_goto(parentobj, this_page, num_pages, perpage, url_string) |
|
527 { |
|
528 var height = $(parentobj).Height(); |
|
529 var width = $(parentobj).Width(); |
|
530 var left = $(parentobj).Left(); |
|
531 var top = $(parentobj).Top(); |
|
532 var left_pos = left + width ; |
|
533 var top_pos = height + top; |
|
534 var div = document.createElement('div'); |
|
535 div.style.position = 'absolute'; |
|
536 div.style.top = top_pos + 'px'; |
|
537 div.className = 'question-box'; |
|
538 div.style.margin = '1px 0 0 2px'; |
|
539 var vtmp = 'input_' + Math.floor(Math.random() * 1000000); |
|
540 div.innerHTML = 'Go to page:<br /><input type="text" size="2" style="padding: 1px; font-size: 8pt;" value="'+(parseInt(this_page)+1)+'" id="'+vtmp+'" /> <a href="#" onclick="paginator_submit(this, '+num_pages+', '+perpage+', unescape(\'' + escape(url_string) + '\')); return false;" style="font-size: 14pt; text-decoration: none;">»</a> <a href="#" onclick="fly_out_top(this.parentNode, false, true); return false;" style="font-size: 14pt; text-decoration: none;">×</a>'; |
|
541 |
|
542 var body = document.getElementsByTagName('body')[0]; |
|
543 body.appendChild(div); |
|
544 |
|
545 document.getElementById(vtmp).onkeypress = function(e){if(e.keyCode==13)this.nextSibling.nextSibling.onclick();}; |
|
546 document.getElementById(vtmp).focus(); |
|
547 |
|
548 // fade the div |
|
549 /* |
|
550 if(!div.id) div.id = 'autofade_'+Math.floor(Math.random() * 100000); |
|
551 var from = '#33FF33'; |
|
552 Fat.fade_element(div.id,30,2000,from,Fat.get_bgcolor(div.id)); |
|
553 */ |
|
554 fly_in_bottom(div, false, true); |
|
555 |
|
556 var divh = $(div).Width(); |
|
557 left_pos = left_pos - divh; |
|
558 div.style.left = left_pos + 'px'; |
|
559 } |
|
560 |
|
561 function paginator_submit(obj, max, perpage, formatstring) |
|
562 { |
|
563 var userinput = obj.previousSibling.previousSibling.value; |
|
564 userinput = parseInt(userinput); |
|
565 var offset = ( userinput - 1 ) * perpage; |
|
566 if ( userinput > max || isNaN(userinput) || userinput < 1 ) |
|
567 { |
|
568 new messagebox(MB_OK|MB_ICONSTOP, 'Invalid entry', 'Please enter a page number between 1 and ' + max + '.'); |
|
569 return false; |
|
570 } |
|
571 var url = sprintf(formatstring, String(offset)); |
|
572 fly_out_top(obj.parentNode, false, true); |
|
573 window.location = url; |
|
574 } |
|
575 |