DHTML progress bar for glacial rate adding and editing, closes: Bug#1100
[freeside.git] / httemplate / elements / qlib / control.js
1 /**\r
2  * QLIB 1.0 Base Abstract Control\r
3  * Copyright (C) 2002 2003, Quazzle.com Serge Dolgov\r
4  * This program is free software; you can redistribute it and/or\r
5  * modify it under the terms of the GNU General Public License\r
6  * as published by the Free Software Foundation; either version 2\r
7  * of the License, or (at your option) any later version.\r
8  * http://qlib.quazzle.com\r
9  */\r
10 \r
11 function QControl_init(parent, name) {\r
12     this.parent = parent || self;\r
13     this.window = (parent && parent.window) || self;\r
14     this.document = (parent && parent.document) || self.document;\r
15     this.name = (parent && parent.name) ? (parent.name + "." + name) : ("self." + name);\r
16     this.id = "Q";\r
17     var h = this.hash(this.name);\r
18     for (var j=0; j<8; j++) {\r
19         this.id += QControl.HEXTABLE.charAt(h & 15);\r
20         h >>>= 4;\r
21     }\r
22 }\r
23 \r
24 function QControl_hash(str) {\r
25     var h = 0;\r
26     if (str) {\r
27         for (var j=str.length-1; j>=0; j--) {\r
28             h ^= QControl.ANTABLE.indexOf(str.charAt(j)) + 1;\r
29             for (var i=0; i<3; i++) {\r
30                 var m = (h = h<<7 | h>>>25) & 150994944;\r
31                 h ^= m ? (m == 150994944 ? 1 : 0) : 1;\r
32             }\r
33         }\r
34     }\r
35     return h;\r
36 }\r
37 \r
38 function QControl_nop() {\r
39 }\r
40 \r
41 function QControl() {\r
42     this.init = QControl_init;\r
43     this.hash = QControl_hash;\r
44     this.window = self;\r
45     this.document = self.document;\r
46     this.tag = null;\r
47 }\r
48 QControl.ANTABLE  = "w5Q2KkFts3deLIPg8Nynu_JAUBZ9YxmH1XW47oDpa6lcjMRfi0CrhbGSOTvqzEV";\r
49 QControl.HEXTABLE = "0123456789ABCDEF";\r
50 QControl.nop = QControl_nop;\r
51 QControl.event = QControl_nop;\r