1
var annot = function ()
2
{
3
var getScrollTop = function () {
4
// DOM scroll top
5
if (document.documentElement.scrollTop == 0) {
6
return document.body.scrollTop;
7
// IE scroll top
8
} else if (document.documentElement.scrollTop) {
9
return document.documentElement.scrollTop;
10
// Netscape scroll top
11
} else if(window.pageYOffset) {
12
return window.pageYOffset;
13
}
14
}
15
16
var lightbox =
17
{
18
/**
19
* Set up the lightbox, fill it and manage focus
20
*
21
* @param DOMElement Source element for the lightbox content
22
* @param DOMElement Annotation element that recieved focus
23
* @return false To desrupt default click handling
24
*/
25
construct : function (contentElm, focusedElm) {
26
// Make sure the lightbox is not already open
27
lightbox.destruct();
28
29
// Get the elements that build the lightbox
30
var lbBoxElm = document.getElementById('lightbox_container');
31
var lbBackElm = document.getElementById('lightbox_background')
32
33
// clone the content and stick it into the alert
34
for (var i=0; i < contentElm.childNodes.length; i++) {
35
var clone = contentElm.childNodes[i].cloneNode(true);
36
lbBoxElm.appendChild(clone);
37
}
38
39
// position the lightbox
40
lbBoxElm.style.marginTop = (50 + getScrollTop()) + "px";
...
</html>