--- /dev/null
+/**\r
+ * QLIB 1.0 Button Control\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 QButton_update() {\r
+ with (this) {\r
+ image.src = ((!enabled && res.imgD) || (value ? res.imgP : res.imgN)).src;\r
+ }\r
+}\r
+\r
+function QButton_doEvent() {\r
+ with (this) {\r
+ if (enabled) {\r
+ if (res.style == 1) {\r
+ this.value = value ? 0 : 1;\r
+ update();\r
+ }\r
+ onClick(value, tag);\r
+ }\r
+ }\r
+ return false;\r
+}\r
+\r
+function QButton_enable(state) {\r
+ this.enabled = state;\r
+ this.update();\r
+}\r
+\r
+function QButton_set(value) {\r
+ if (this.enabled) {\r
+ this.value = value ? 1 : 0;\r
+ this.update();\r
+ }\r
+ return true;\r
+}\r
+\r
+function QButton(parent, name, res, tooltip) {\r
+ this.init(parent, name);\r
+ if (res) {\r
+ this.res = res;\r
+ this.tip = tooltip || "";\r
+ this.enabled = true;\r
+ this.value = 0;\r
+ this.set = QButton_set;\r
+ this.enable = QButton_enable;\r
+ this.update = QButton_update;\r
+ this.doEvent = QButton_doEvent;\r
+ this.onClick = QControl.event;\r
+ with (this) {\r
+ document.write('<a href="#" hidefocus="true" unselectable="on"' +\r
+ (tip ? ' title="' + tip + '"' : '') + ' onClick="return ' + name +\r
+ '.doEvent()" onMouseOver="' + (res.style == 2 ? name + '.set(1);' : '') +\r
+ 'window.top.status=' + name + '.tip;return true" onMouseOut="' +\r
+ (!res.style || (res.style == 2) ? name + '.set();' : '') + 'window.top.status=\'\'"' +\r
+ (!res.style ? ' onMouseDown="return ' + name + '.set(1)" onMouseUp="return ' + name + '.set()"' : '') +\r
+ '><img class="qbutton" name="' + id + '" src="' + res.imgN.src + '" border="0" width="' +\r
+ res.width + '" height="' + res.height + '"></a>');\r
+ this.image = document.images[id] || new Image(1, 1);\r
+ }\r
+ } else {\r
+ this.document.write("invalid resource");\r
+ }\r
+}\r
+QButton.prototype = new QControl();\r
+QButton.NORMAL = 0;\r
+QButton.CHECKBOX = 1;\r
+QButton.WEB = 2;\r
+QButton.SIGNAL = 3;\r