DHTML progress bar for glacial rate adding and editing, closes: Bug#1100
[freeside.git] / httemplate / elements / qlib / sound.js
diff --git a/httemplate/elements/qlib/sound.js b/httemplate/elements/qlib/sound.js
new file mode 100644 (file)
index 0000000..3d1aaf6
--- /dev/null
@@ -0,0 +1,47 @@
+/**\r
+ * QLIB 1.0 Preloaded Sound\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 QSound_play(loop) {\r
+    this._out.loop = loop || 0;\r
+    this._out.src = this._buf.src;\r
+}\r
+\r
+function QSound_stop() {\r
+    this._out.loop = 0;\r
+    this._out.src = "";\r
+}\r
+\r
+function QSound_setVolume(volume) {\r
+    this._out.volume = this.volume = volume;\r
+}\r
\r
+function QSound(parent, name, src, volume) {\r
+    this.init(parent, name);\r
+    this.volume = volume || 0;\r
+    this.play = this.stop = this.setVolume = QControl.nop;\r
+    with (this) {\r
+        document.write('<bgsound id="' + id + '" src="" volume="' + volume + '">');\r
+        if (document.all && document.all.item) {\r
+            this._out = document.all.item(id);\r
+            if (_out && (typeof _out.src != "undefined") && (_out.volume === volume)) {\r
+                document.write('<bgsound id="b' + id + '" src="' + src + '" volume="-10000">');\r
+                this._buf = document.all.item("b" + id);\r
+                if (_buf) {\r
+                    this.play = QSound_play;\r
+                    this.stop = QSound_stop;\r
+                    this.setVolume = QSound_setVolume;\r
+\r
+                    _out.onreadystatechange = new Function("alert(0)");\r
+                }\r
+            }\r
+        }\r
+    }\r
+}\r
+QSound.prototype = new QControl();\r