1 /* @target is the object next to which the box should pop up.
3 function PopupBox(target, body) {
5 this.div = elem("div");
6 add_css_class(this.div,"popup_box");
7 add_css_class(this.div,"hide_me");
8 if(body) this.div.appendChild(body);
9 getDocument().body.appendChild(this.div);
12 PopupBox.prototype.setBody = function(body) {
13 if(body) this.div.appendChild(body);
16 PopupBox.prototype.addNode = function(node) {
18 this.div.appendChild(node);
23 PopupBox.prototype.addText = function(text) {
25 this.div.appendChild(mktext(text));
30 PopupBox.prototype.lines = function(count) {
31 if(count == null) count = 1;
32 for( var x = 0; x < count; x++ ) {
33 this.div.appendChild(elem("br"));
37 PopupBox.prototype.title = function(title) {
41 var div = elem("div");
42 add_css_class(div, "popup_box_title");
43 div.appendChild(mktext(title));
46 if(this.div.firstChild)
47 this.div.insertBefore(div, this.div.firstChild);
49 this.div.appendChild(div);
54 PopupBox.prototype.show = function() {
56 remove_css_class(this.div,"hide_me");
58 var A = getXYOffsets(this.target, this.div);
62 var W = getWindowSize();
66 var x = getObjectWidth(this.div);
67 var y = getObjectHeight(this.div);
69 //alert(wx + " : " + wy + " : " + x + " : " + y + " : " + newx + " : " + newy);
75 newy = newy - y - getObjectHeight(this.target);
77 this.div.style.left = newx;
78 this.div.style.top = newy;
80 add_css_class(this.div,"show_me");
83 PopupBox.prototype.hide = function() {
84 remove_css_class(this.div,"show_me");
85 add_css_class(this.div,"hide_me");
88 /* pass in an array of DOM nodes and they will
89 be displayed as a group along the box */
90 PopupBox.prototype.makeGroup = function(group) {
92 var center = elem("center");
93 var table = elem("table");
94 center.appendChild(table);
95 add_css_class(table, "popup_box_group");
96 var row = table.insertRow(0);
98 for(var i = 0; i!= group.length; i++) {
99 var cell = row.insertCell(row.cells.length);
100 cell.appendChild(group[i]);
103 this.div.appendChild(elem("br"));
104 this.div.appendChild(center);