1 GB_show = function(caption, url, /* optional */ height, width, callback_fn) {
7 callback_fn: callback_fn
9 var win = new GB_Window(options);
13 GB_showCenter = function(caption, url, /* optional */ height, width, callback_fn) {
17 height: height || 500,
20 callback_fn: callback_fn
22 var win = new GB_Window(options);
26 GB_showFullScreen = function(caption, url, callback_fn) {
30 callback_fn: callback_fn
32 var win = new GB_Window(options);
36 GB_Window = GreyBox.extend({
37 init: function(options) {
39 this.img_header = this.root_dir+"header_bg.gif";
40 this.img_close = this.root_dir+"w_close.gif";
41 this.show_close_img = true;
42 AJS.update(this, options);
43 this.addCallback(this.callback_fn);
46 initHook: function() {
47 AJS.addClass(this.g_window, 'GB_Window');
49 this.header = AJS.TABLE({'class': 'header'});
50 this.header.style.backgroundImage = "url("+ this.img_header +")";
52 var td_caption = AJS.TD({'class': 'caption'}, this.caption);
53 var td_close = AJS.TD({'class': 'close'});
55 if(this.show_close_img) {
56 var img_close = AJS.IMG({'src': this.img_close});
57 var span = AJS.SPAN('Close');
59 var btn = AJS.DIV(img_close, span);
61 AJS.AEV([img_close, span], 'mouseover', function() { AJS.addClass(span, 'on'); });
62 AJS.AEV([img_close, span], 'mouseout', function() { AJS.removeClass(span, 'on'); });
63 AJS.AEV([img_close, span], 'mousedown', function() { AJS.addClass(span, 'click'); });
64 AJS.AEV([img_close, span], 'mouseup', function() { AJS.removeClass(span, 'click'); });
65 AJS.AEV([img_close, span], 'click', GB_hide);
67 AJS.ACN(td_close, btn);
70 tbody_header = AJS.TBODY();
71 AJS.ACN(tbody_header, AJS.TR(td_caption, td_close));
73 AJS.ACN(this.header, tbody_header);
74 AJS.ACN(this.top_cnt, this.header);
77 AJS.AEV(window, 'scroll', AJS.$b(this.setWindowPosition, this));
80 setFrameSize: function() {
82 var page_size = AJS.getWindowSize();
83 overlay_h = page_size.h;
84 this.width = Math.round(this.overlay.offsetWidth - (this.overlay.offsetWidth/100)*10);
85 this.height = Math.round(overlay_h - (overlay_h/100)*10);
88 AJS.setWidth(this.header, this.width+6); //6 is for the left+right border
89 AJS.setWidth(this.iframe, this.width);
90 AJS.setHeight(this.iframe, this.height);
93 setWindowPosition: function() {
94 var page_size = AJS.getWindowSize();
95 AJS.setLeft(this.g_window, ((page_size.w - this.width)/2)-13);
97 if(!this.center_win) {
98 AJS.setTop(this.g_window, AJS.getScrollTop());
101 var fl = ((page_size.h - this.height) /2) - 20 + AJS.getScrollTop();
104 AJS.setTop(this.g_window, fl);
109 AJS.preloadImages(GB_ROOT_DIR+'w_close.gif', GB_ROOT_DIR+'header_bg.gif');