+/**\r
+ * QLIB 1.0 Window Abstraction\r
+ * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * http://qlib.quazzle.com\r
+ */\r
+\r
+function QWndCtrl_center_ie4() {\r
+ var b = this.document.body;\r
+ this.moveTo(b.scrollLeft + Math.max(0, Math.floor((b.clientWidth -\r
+ this.width) / 2)), b.scrollTop + 100);\r
+}\r
+\r
+function QWndCtrl_center_moz() {\r
+ this.moveTo(self.pageXOffset + Math.max(0, Math.floor((self.innerWidth -\r
+ this.width) / 2)), self.pageYOffset + 100);\r
+}\r
+\r
+function QWndCtrl_setEffects_ie4(fx) {\r
+ this.effects = fx;\r
+ with (this.wnd) {\r
+ filters[0].enabled = (fx & 256) != 0;\r
+ filters[1].enabled = (fx & 512) != 0;\r
+ filters[2].enabled = (fx & 1024) != 0;\r
+ filters[4].enabled = (fx & 2048) != 0;\r
+ }\r
+}\r
+\r
+function QWndCtrl_setEffects_moz(fx) {\r
+ this.effects = fx;\r
+}\r
+\r
+function QWndCtrl_setOpacity_ie4(op) {\r
+ this.opacity = Math.max(0, Math.min(100, Math.floor(op - 0)));\r
+ this.wnd.filters[3].opacity = this.opacity;\r
+ this.wnd.filters[3].enabled = (this.opacity < 100);\r
+}\r
+\r
+function QWndCtrl_setOpacity_moz(op) {\r
+ this.opacity = Math.max(0, Math.min(100, Math.floor(op - 0)));\r
+ this.wnd.style.MozOpacity = this.opacity + "%";\r
+}\r
+\r
+function QWndCtrl_setSize_css(w, h) {\r
+ this.wnd.style.width = (this.width = Math.floor(w - 0)) + "px";\r
+ this.wnd.style.height = typeof(h) == "number" ? (this.height = Math.floor(h)) + "px" : "auto";\r
+}\r
+\r
+function QWndCtrl_setSize_ns4(w, h) {\r
+ this.wnd.clip.width = this.width = Math.floor(w - 0);\r
+ if (typeof(h) == "number") {\r
+ this.wnd.clip.height = this.height = Math.floor(h);\r
+ }\r
+}\r
+\r
+function QWndCtrl_focus() {\r
+ this.setZIndex(QWndCtrl.TOPZINDEX++);\r
+}\r
+\r
+function QWndCtrl_setZIndex_css(z) {\r
+ this.wnd.style.zIndex = this.zindex = z || 0;\r
+}\r
+\r
+function QWndCtrl_setZIndex_ns4(z) {\r
+ this.wnd.zIndex = this.zindex = z || 0;\r
+}\r
+\r
+function QWndCtrl_moveTo_css(x, y) {\r
+ this.wnd.style.left = (this.x = Math.floor(x - 0)) + "px";\r
+ this.wnd.style.top = (this.y = Math.floor(y - 0)) + "px";\r
+}\r
+\r
+function QWndCtrl_moveTo_ns4(x, y) {\r
+ this.wnd.moveTo(this.x = Math.floor(x - 0), this.y = Math.floor(y - 0));\r
+}\r
+\r
+function QWndCtrl_fxhandler() {\r
+ this.fxhandler = QControl.nop;\r
+ this.onShow(this.visible, this.tag);\r
+}\r
+\r
+function QWndCtrl_show_ie4(show) {\r
+ if (this.visible != show) {\r
+ var fx = false;\r
+ switch (show ? this.effects & 15 : (this.effects & 240) >>> 4) {\r
+ case 1:\r
+ fx = this.wnd.filters[5];\r
+ break;\r
+ case 2:\r
+ (fx = this.wnd.filters[6]).transition = show ? 1 : 0;\r
+ break;\r
+ case 3:\r
+ (fx = this.wnd.filters[6]).transition = show ? 3 : 2;\r
+ break;\r
+ case 4:\r
+ (fx = this.wnd.filters[6]).transition = show ? 5 : 4;\r
+ break;\r
+ case 5:\r
+ (fx = this.wnd.filters[6]).transition = show ? 14 : 13;\r
+ break;\r
+ case 6:\r
+ (fx = this.wnd.filters[6]).transition = show ? 16 : 15;\r
+ break;\r
+ case 7:\r
+ (fx = this.wnd.filters[6]).transition = 12;\r
+ break;\r
+ case 8:\r
+ (fx = this.wnd.filters[6]).transition = 8;\r
+ break;\r
+ case 9:\r
+ (fx = this.wnd.filters[6]).transition = 9;\r
+ }\r
+ if (fx) {\r
+ fx.apply();\r
+ this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";\r
+ this.fxhandler = QWndCtrl_fxhandler;\r
+ fx.play(0.3);\r
+ } else {\r
+ this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";\r
+ this.onShow(show, this.tag);\r
+ }\r
+ }\r
+}\r
+\r
+function QWndCtrl_fade_moz(op, step) {\r
+ this._wndt = false;\r
+ if (step) {\r
+ op += step;\r
+ if ((op > 0) && (op < this.opacity)) {\r
+ this.wnd.style.MozOpacity = op + "%";\r
+ this._wndt = setTimeout(this.name + ".fade(" + op + "," + step + ")", 50);\r
+ } else {\r
+ if (op <= 0) {\r
+ this.wnd.style.visibility = "hidden";\r
+ this.visible = false;\r
+ }\r
+ this.wnd.style.MozOpacity = this.opacity + "%";\r
+ this.onShow(this.visible, this.tag);\r
+ }\r
+ }\r
+}\r
+\r
+function QWndCtrl_show_moz(show) {\r
+ if (this.visible != show) {\r
+ if (this._wndt) {\r
+ clearTimeout(this._wndt);\r
+ this._wndt = false;\r
+ }\r
+ var step = show ? ((this.effects & 15) == 1) && Math.floor(this.opacity / 5) :\r
+ ((this.effects & 240) == 16) && -Math.floor(this.opacity / 5);\r
+ if (step) {\r
+ if (this.visible) {\r
+ this.fade(this.opacity - 0, step);\r
+ } else {\r
+ this.wnd.style.MozOpacity = "0%";\r
+ this.wnd.style.visibility = "visible";\r
+ this.visible = true;\r
+ this.fade(0, step);\r
+ }\r
+ } else {\r
+ this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";\r
+ this.onShow(show, this.tag);\r
+ }\r
+ }\r
+}\r
+\r
+function QWndCtrl_show_css(show) {\r
+ if (this.visible != show) {\r
+ this.wnd.style.visibility = (this.visible = show) ? "visible" : "hidden";\r
+ this.onShow(show, this.tag);\r
+ }\r
+}\r
+\r
+function QWndCtrl_show_ns4(show) {\r
+ if (this.visible != show) {\r
+ this.wnd.visibility = (this.visible = show) ? "show" : "hidden";\r
+ this.onShow(show, this.tag);\r
+ }\r
+}\r
+\r
+function QWndCtrl_create_dom2() {\r
+ with (this) {\r
+ this.fxhandler = QControl.nop;\r
+ var ie4 = document.body && document.body.filters;\r
+ var moz = document.body && document.body.style &&\r
+ typeof(document.body.style.MozOpacity) == "string";\r
+ document.write('<div unselectable="on" id="' + id +\r
+ (ie4 ? '" onfilterchange="' + name + '.fxhandler()': '') +\r
+ '" style="position:absolute;left:' + x + 'px;top:' + y +\r
+ 'px;width:' + width + (height != null ? 'px;height:' + height : '') +\r
+ 'px;visibility:' + (visible ? 'visible' : 'hidden') +\r
+ ';overflow:hidden' + (zindex ? ';z-index:' + zindex : '') +\r
+ (ie4 ? ';filter:Gray(enabled=' + (effects & 256 ? '1' : '0') +\r
+ ') Xray(enabled=' + (effects & 512 ? '1' : '0') +\r
+ ') Invert(enabled=' + (effects & 1024 ? '1' : '0') +\r
+ ') alpha(enabled=' + (opacity < 100 ? '1' : '0') + ',opacity=' + opacity +\r
+ ') shadow(enabled=' + (effects & 2048 ? '1' : '0') +\r
+ ',direction=135) BlendTrans(enabled=0) RevealTrans(enabled=0)' : '') +\r
+ (moz && (opacity < 100) ? ';-moz-opacity:' + opacity + '%' : '') +\r
+ '"><div unselectable="on" class="qwindow">');\r
+ if (typeof(content) == "function") {\r
+ this.content();\r
+ } else {\r
+ document.write(content);\r
+ }\r
+ document.write('</div></div>');\r
+ if (this.wnd = document.getElementById ? document.getElementById(id) :\r
+ (document.all.item ? document.all.item(id) : document.all[id])) {\r
+ if (wnd.style) {\r
+ ie4 = ie4 && wnd.filters;\r
+ moz = moz && typeof(wnd.style.MozOpacity) == "string";\r
+ this.moveTo = QWndCtrl_moveTo_css;\r
+ this.setZIndex = QWndCtrl_setZIndex_css;\r
+ this.focus = QWndCtrl_focus;\r
+ this.setSize = QWndCtrl_setSize_css;\r
+ this.show = ie4 ? QWndCtrl_show_ie4 : (moz ? QWndCtrl_show_moz : QWndCtrl_show_css);\r
+ this.fade = moz ? QWndCtrl_fade_moz : QControl.nop;\r
+ this.setOpacity = ie4 ? QWndCtrl_setOpacity_ie4 : (moz ? QWndCtrl_setOpacity_moz : QControl.nop);\r
+ this.setEffects = ie4 ? QWndCtrl_setEffects_ie4 : (moz ? QWndCtrl_setEffects_moz : QControl.nop);\r
+ this.center = self.innerWidth ? QWndCtrl_center_moz :\r
+ (document.body && document.body.clientWidth ? QWndCtrl_center_ie4 : QControl.nop);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+function QWndCtrl_create_ns4(finalize) {\r
+ with (this) {\r
+ if (finalize) {\r
+ if (_wnde) {\r
+ parent.window.onload = _wnde;\r
+ parent.window.onload();\r
+ }\r
+ document.open();\r
+ document.write('<div class="qwindow">');\r
+ this.content();\r
+ document.write('</div>');\r
+ document.close();\r
+ } else {\r
+ document.write('<layer id="' + id + '" left="' + x + '" top="' + y +\r
+ '" width="' + width + '" visibility="' + (visible ? 'show' : 'hidden') +\r
+ (height != null ? '" height="' + height + '" clip="' + width + ',' + height : '') +\r
+ (zindex ? '" z-index="' + zindex : '') + (typeof(content) != "function" ?\r
+ '"><div class="qwindow">' + content + '</div></layer>' : '"> </layer>'));\r
+ if (this.window = this.wnd = document.layers[id]) {\r
+ if (this.document = wnd.document) {\r
+ this.show = QWndCtrl_show_ns4;\r
+ this.moveTo = QWndCtrl_moveTo_ns4;\r
+ this.setZIndex = QWndCtrl_setZIndex_ns4;\r
+ this.focus = QWndCtrl_focus;\r
+ this.center = QWndCtrl_center_moz;\r
+ this.setSize = QWndCtrl_setSize_ns4;\r
+ if (typeof(content) == "function") {\r
+ this._wnde = parent.window.onload;\r
+ parent.window.onload = new Function(name + ".create(true)");\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+function QWndCtrl_create_na() {\r
+ this.document.write('Object is not supported.');\r
+ this.wnd = null;\r
+}\r
+\r
+function QWndCtrl_create() {\r
+ with (this) {\r
+ this.create = (document.getElementById || document.all) ? QWndCtrl_create_dom2 :\r
+ (document.layers ? QWndCtrl_create_ns4 : QWndCtrl_create_na);\r
+ create();\r
+ }\r
+}\r
+\r
+function QWndCtrl() {\r
+ this.x = this.y = 0;\r
+ this.width = this.height = 0;\r
+ this.content = "";\r
+ this.visible = true;\r
+ this.effects = 0;\r
+ this.opacity = 100;\r
+ this.zindex = null;\r
+ this._wndt = this._wnde = false;\r
+ this.create = QWndCtrl_create;\r
+ this.show = QControl.nop;\r
+ this.focus = QControl.nop;\r
+ this.center = QControl.nop;\r
+ this.moveTo = QControl.nop;\r
+ this.setSize = QControl.nop;\r
+ this.setOpacity = QControl.nop;\r
+ this.setEffects = QControl.nop;\r
+ this.setZIndex = QControl.nop;\r
+ this.onShow = QControl.event;\r
+}\r
+QWndCtrl.prototype = new QControl();\r
+QWndCtrl.TOPZINDEX = 1000;\r
+QWndCtrl.GRAY = 256;\r
+QWndCtrl.XRAY = 512;\r
+QWndCtrl.INVERT = 1024;\r
+QWndCtrl.SHADOW = 2048;\r
+QWndCtrl.FADEIN = 1;\r
+QWndCtrl.FADEOUT = 16;\r
+QWndCtrl.BOXIN = 2;\r
+QWndCtrl.BOXOUT = 32;\r
+QWndCtrl.CIRCLEIN = 3;\r
+QWndCtrl.CIRCLEOUT = 48;\r
+QWndCtrl.WIPEIN = 4;\r
+QWndCtrl.WIPEOUT = 64;\r
+QWndCtrl.HBARNIN = 5;\r
+QWndCtrl.HBARNOUT = 80;\r
+QWndCtrl.VBARNIN = 6;\r
+QWndCtrl.VBARNOUT = 96;\r
+QWndCtrl.DISSOLVEIN = 7;\r
+QWndCtrl.DISSOLVEOUT = 112;\r
+QWndCtrl.HBLINDSIN = 8;\r
+QWndCtrl.HBLINDSOUT = 128;\r
+QWndCtrl.VBLINDSIN = 9;\r
+QWndCtrl.VBLINDSOUT = 144;\r