446 else |
450 else |
447 p = p.parentNode; |
451 p = p.parentNode; |
448 } |
452 } |
449 } |
453 } |
450 |
454 |
|
455 /** |
|
456 * Return a DOMElement that uses a sprite image. |
|
457 * @param string Path to sprite image |
|
458 * @param int Width of resulting image |
|
459 * @param int Height of resulting image |
|
460 * @param int X offset |
|
461 * @param int Y offset |
|
462 * @return object HTMLImageElement |
|
463 */ |
|
464 |
|
465 function gen_sprite(path, width, height, xpos, ypos) |
|
466 { |
|
467 var image = document.createElement('img'); |
|
468 image.src = scriptPath + '/images/spacer.gif'; |
|
469 image.width = String(width); |
|
470 image.height = String(height); |
|
471 image.style.backgroundImage = 'url(' + path + ')'; |
|
472 image.style.backgroundRepeat = 'no-repeat'; |
|
473 xpos = ( xpos == 0 ) ? '0' : '-' + String(xpos); |
|
474 ypos = ( ypos == 0 ) ? '0' : '-' + String(ypos); |
|
475 image.style.backgroundPosition = ypos + 'px ' + xpos + 'px'; |
|
476 |
|
477 return image; |
|
478 } |
|
479 |
|
480 /** |
|
481 * The same as gen_sprite but generates HTML instead of a DOMElement. |
|
482 * @param string Path to sprite image |
|
483 * @param int Width of resulting image |
|
484 * @param int Height of resulting image |
|
485 * @param int X offset |
|
486 * @param int Y offset |
|
487 * @return object HTMLImageElement |
|
488 */ |
|
489 |
|
490 function gen_sprite_html(path, width, height, xpos, ypos) |
|
491 { |
|
492 var html = '<img src="' + scriptPath + '/images/spacer.gif" width="' + width + '" height="' + height + '" '; |
|
493 xpos = ( xpos == 0 ) ? '0' : '-' + String(xpos); |
|
494 ypos = ( ypos == 0 ) ? '0' : '-' + String(ypos); |
|
495 html += 'style="background-image: url(' + path + '); background-repeat: no-repeat; background-position: ' + ypos + 'px ' + xpos + 'px;"'; |
|
496 html += ' />'; |
|
497 |
|
498 return html; |
|
499 } |
|
500 |
451 function findParentForm(o) |
501 function findParentForm(o) |
452 { |
502 { |
453 return get_parent_form(o); |
503 return get_parent_form(o); |
454 } |
504 } |
455 |
505 |
456 function domObjChangeOpac(opacity, id) { |
506 function domObjChangeOpac(opacity, id) |
457 var object = id.style; |
507 { |
458 object.opacity = (opacity / 100); |
508 if ( !id ) |
459 object.MozOpacity = (opacity / 100); |
509 return false; |
460 object.KhtmlOpacity = (opacity / 100); |
510 |
461 object.filter = "alpha(opacity=" + opacity + ")"; |
511 var object = id.style; |
|
512 object.opacity = (opacity / 100); |
|
513 object.MozOpacity = (opacity / 100); |
|
514 object.KhtmlOpacity = (opacity / 100); |
|
515 object.filter = "alpha(opacity=" + opacity + ")"; |
462 } |
516 } |
463 |
517 |
464 function getScrollOffset(el) |
518 function getScrollOffset(el) |
465 { |
519 { |
466 var position; |
520 var position; |