Lib_Js_Mage - Version 1.6.0.0

Version Notes

1.6.0.0

Download this release

Release Info

Developer Magento Core Team
Extension Lib_Js_Mage
Version 1.6.0.0
Comparing to
See all releases


Version 1.6.0.0

Files changed (57) hide show
  1. js/blank.html +0 -0
  2. js/flash/AC_RunActiveContent.js +292 -0
  3. js/index.php +144 -0
  4. js/lib/FABridge.js +613 -0
  5. js/lib/boxover.js +372 -0
  6. js/lib/ccard.js +28 -0
  7. js/lib/dropdown.js +36 -0
  8. js/lib/ds-sleight.js +38 -0
  9. js/lib/flex.js +427 -0
  10. js/mage/adminhtml/accordion.js +139 -0
  11. js/mage/adminhtml/browser.js +395 -0
  12. js/mage/adminhtml/events.js +137 -0
  13. js/mage/adminhtml/flexuploader.js +372 -0
  14. js/mage/adminhtml/form.js +470 -0
  15. js/mage/adminhtml/giftmessage.js +280 -0
  16. js/mage/adminhtml/giftoptions/tooltip.js +211 -0
  17. js/mage/adminhtml/grid.js +850 -0
  18. js/mage/adminhtml/hash.js +162 -0
  19. js/mage/adminhtml/image.js +91 -0
  20. js/mage/adminhtml/loader.js +282 -0
  21. js/mage/adminhtml/magento-all.js +25 -0
  22. js/mage/adminhtml/product.js +1052 -0
  23. js/mage/adminhtml/product/composite/configure.js +765 -0
  24. js/mage/adminhtml/rules.js +383 -0
  25. js/mage/adminhtml/sales.js +1055 -0
  26. js/mage/adminhtml/sales/packaging.js +813 -0
  27. js/mage/adminhtml/scrollbar.js +397 -0
  28. js/mage/adminhtml/tabs.js +248 -0
  29. js/mage/adminhtml/tools.js +735 -0
  30. js/mage/adminhtml/uploader.js +258 -0
  31. js/mage/adminhtml/variables.js +164 -0
  32. js/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +67 -0
  33. js/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/img/icon.gif +0 -0
  34. js/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js +90 -0
  35. js/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/img/icon.gif +0 -0
  36. js/mage/adminhtml/wysiwyg/tiny_mce/setup.js +351 -0
  37. js/mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css +55 -0
  38. js/mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css +87 -0
  39. js/mage/adminhtml/wysiwyg/widget.js +396 -0
  40. js/mage/centinel.js +112 -0
  41. js/mage/cookies.js +78 -0
  42. js/mage/directpost.js +414 -0
  43. js/mage/translate.js +50 -0
  44. js/mage/translate_inline.css +36 -0
  45. js/mage/translate_inline.js +196 -0
  46. js/spacer.gif +0 -0
  47. js/varien/accordion.js +112 -0
  48. js/varien/configurable.js +319 -0
  49. js/varien/form.js +328 -0
  50. js/varien/iehover-fix.js +64 -0
  51. js/varien/js.js +682 -0
  52. js/varien/menu.js +132 -0
  53. js/varien/payment.js +68 -0
  54. js/varien/product.js +722 -0
  55. js/varien/telephone.js +131 -0
  56. js/varien/weee.js +36 -0
  57. package.xml +18 -0
js/blank.html ADDED
File without changes
js/flash/AC_RunActiveContent.js ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //v1.7
2
+ // Flash Player Version Detection
3
+ // Detect Client Browser type
4
+ // Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
5
+ var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
6
+ var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
7
+ var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
8
+
9
+ function ControlVersion()
10
+ {
11
+ var version;
12
+ var axo;
13
+ var e;
14
+
15
+ // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
16
+
17
+ try {
18
+ // version will be set for 7.X or greater players
19
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
20
+ version = axo.GetVariable("$version");
21
+ } catch (e) {
22
+ }
23
+
24
+ if (!version)
25
+ {
26
+ try {
27
+ // version will be set for 6.X players only
28
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
29
+
30
+ // installed player is some revision of 6.0
31
+ // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
32
+ // so we have to be careful.
33
+
34
+ // default to the first public version
35
+ version = "WIN 6,0,21,0";
36
+
37
+ // throws if AllowScripAccess does not exist (introduced in 6.0r47)
38
+ axo.AllowScriptAccess = "always";
39
+
40
+ // safe to call for 6.0r47 or greater
41
+ version = axo.GetVariable("$version");
42
+
43
+ } catch (e) {
44
+ }
45
+ }
46
+
47
+ if (!version)
48
+ {
49
+ try {
50
+ // version will be set for 4.X or 5.X player
51
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
52
+ version = axo.GetVariable("$version");
53
+ } catch (e) {
54
+ }
55
+ }
56
+
57
+ if (!version)
58
+ {
59
+ try {
60
+ // version will be set for 3.X player
61
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
62
+ version = "WIN 3,0,18,0";
63
+ } catch (e) {
64
+ }
65
+ }
66
+
67
+ if (!version)
68
+ {
69
+ try {
70
+ // version will be set for 2.X player
71
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
72
+ version = "WIN 2,0,0,11";
73
+ } catch (e) {
74
+ version = -1;
75
+ }
76
+ }
77
+
78
+ return version;
79
+ }
80
+
81
+ // JavaScript helper required to detect Flash Player PlugIn version information
82
+ function GetSwfVer(){
83
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
84
+ var flashVer = -1;
85
+
86
+ if (navigator.plugins != null && navigator.plugins.length > 0) {
87
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
88
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
89
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
90
+ var descArray = flashDescription.split(" ");
91
+ var tempArrayMajor = descArray[2].split(".");
92
+ var versionMajor = tempArrayMajor[0];
93
+ var versionMinor = tempArrayMajor[1];
94
+ var versionRevision = descArray[3];
95
+ if (versionRevision == "") {
96
+ versionRevision = descArray[4];
97
+ }
98
+ if (versionRevision[0] == "d") {
99
+ versionRevision = versionRevision.substring(1);
100
+ } else if (versionRevision[0] == "r") {
101
+ versionRevision = versionRevision.substring(1);
102
+ if (versionRevision.indexOf("d") > 0) {
103
+ versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
104
+ }
105
+ }
106
+ var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
107
+ }
108
+ }
109
+ // MSN/WebTV 2.6 supports Flash 4
110
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
111
+ // WebTV 2.5 supports Flash 3
112
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
113
+ // older WebTV supports Flash 2
114
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
115
+ else if ( isIE && isWin && !isOpera ) {
116
+ flashVer = ControlVersion();
117
+ }
118
+ return flashVer;
119
+ }
120
+
121
+ // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
122
+ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
123
+ {
124
+ versionStr = GetSwfVer();
125
+ if (versionStr == -1 ) {
126
+ return false;
127
+ } else if (versionStr != 0) {
128
+ if(isIE && isWin && !isOpera) {
129
+ // Given "WIN 2,0,0,11"
130
+ tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
131
+ tempString = tempArray[1]; // "2,0,0,11"
132
+ versionArray = tempString.split(","); // ['2', '0', '0', '11']
133
+ } else {
134
+ versionArray = versionStr.split(".");
135
+ }
136
+ var versionMajor = versionArray[0];
137
+ var versionMinor = versionArray[1];
138
+ var versionRevision = versionArray[2];
139
+
140
+ // is the major.revision >= requested major.revision AND the minor version >= requested minor
141
+ if (versionMajor > parseFloat(reqMajorVer)) {
142
+ return true;
143
+ } else if (versionMajor == parseFloat(reqMajorVer)) {
144
+ if (versionMinor > parseFloat(reqMinorVer))
145
+ return true;
146
+ else if (versionMinor == parseFloat(reqMinorVer)) {
147
+ if (versionRevision >= parseFloat(reqRevision))
148
+ return true;
149
+ }
150
+ }
151
+ return false;
152
+ }
153
+ }
154
+
155
+ function AC_AddExtension(src, ext)
156
+ {
157
+ if (src.indexOf('?') != -1)
158
+ return src.replace(/\?/, ext+'?');
159
+ else
160
+ return src + ext;
161
+ }
162
+
163
+ function AC_Generateobj(objAttrs, params, embedAttrs)
164
+ {
165
+ var str = '';
166
+ if (isIE && isWin && !isOpera)
167
+ {
168
+ str += '<object ';
169
+ for (var i in objAttrs)
170
+ {
171
+ str += i + '="' + objAttrs[i] + '" ';
172
+ }
173
+ str += '>';
174
+ for (var i in params)
175
+ {
176
+ str += '<param name="' + i + '" value="' + params[i] + '" /> ';
177
+ }
178
+ str += '</object>';
179
+ }
180
+ else
181
+ {
182
+ str += '<embed ';
183
+ for (var i in embedAttrs)
184
+ {
185
+ str += i + '="' + embedAttrs[i] + '" ';
186
+ }
187
+ str += '> </embed>';
188
+ }
189
+
190
+ document.write(str);
191
+ }
192
+
193
+ function AC_FL_RunContent(){
194
+ var ret =
195
+ AC_GetArgs
196
+ ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
197
+ , "application/x-shockwave-flash"
198
+ );
199
+ AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
200
+ }
201
+
202
+ function AC_SW_RunContent(){
203
+ var ret =
204
+ AC_GetArgs
205
+ ( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
206
+ , null
207
+ );
208
+ AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
209
+ }
210
+
211
+ function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
212
+ var ret = new Object();
213
+ ret.embedAttrs = new Object();
214
+ ret.params = new Object();
215
+ ret.objAttrs = new Object();
216
+ for (var i=0; i < args.length; i=i+2){
217
+ var currArg = args[i].toLowerCase();
218
+
219
+ switch (currArg){
220
+ case "classid":
221
+ break;
222
+ case "pluginspage":
223
+ ret.embedAttrs[args[i]] = args[i+1];
224
+ break;
225
+ case "src":
226
+ case "movie":
227
+ args[i+1] = AC_AddExtension(args[i+1], ext);
228
+ ret.embedAttrs["src"] = args[i+1];
229
+ ret.params[srcParamName] = args[i+1];
230
+ break;
231
+ case "onafterupdate":
232
+ case "onbeforeupdate":
233
+ case "onblur":
234
+ case "oncellchange":
235
+ case "onclick":
236
+ case "ondblclick":
237
+ case "ondrag":
238
+ case "ondragend":
239
+ case "ondragenter":
240
+ case "ondragleave":
241
+ case "ondragover":
242
+ case "ondrop":
243
+ case "onfinish":
244
+ case "onfocus":
245
+ case "onhelp":
246
+ case "onmousedown":
247
+ case "onmouseup":
248
+ case "onmouseover":
249
+ case "onmousemove":
250
+ case "onmouseout":
251
+ case "onkeypress":
252
+ case "onkeydown":
253
+ case "onkeyup":
254
+ case "onload":
255
+ case "onlosecapture":
256
+ case "onpropertychange":
257
+ case "onreadystatechange":
258
+ case "onrowsdelete":
259
+ case "onrowenter":
260
+ case "onrowexit":
261
+ case "onrowsinserted":
262
+ case "onstart":
263
+ case "onscroll":
264
+ case "onbeforeeditfocus":
265
+ case "onactivate":
266
+ case "onbeforedeactivate":
267
+ case "ondeactivate":
268
+ case "type":
269
+ case "codebase":
270
+ case "id":
271
+ ret.objAttrs[args[i]] = args[i+1];
272
+ break;
273
+ case "width":
274
+ case "height":
275
+ case "align":
276
+ case "vspace":
277
+ case "hspace":
278
+ case "class":
279
+ case "title":
280
+ case "accesskey":
281
+ case "name":
282
+ case "tabindex":
283
+ ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
284
+ break;
285
+ default:
286
+ ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
287
+ }
288
+ }
289
+ ret.objAttrs["classid"] = classid;
290
+ if (mimeType) ret.embedAttrs["type"] = mimeType;
291
+ return ret;
292
+ }
js/index.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Core
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Proxy script to combine and compress one or few files for JS and CSS
29
+ *
30
+ * Restricts access only to files under current script's folder
31
+ *
32
+ * @category Mage
33
+ * @package Mage_Core
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+
37
+ // no files specified return 404
38
+ if (empty($_GET['f'])) {
39
+ header('HTTP/1.0 404 Not Found');
40
+ echo "SYNTAX: index.php/x.js?f=dir1/file1.js,dir2/file2.js";
41
+ exit;
42
+ }
43
+
44
+ // allow web server set content type automatically
45
+ $contentType = false;
46
+
47
+ // set custom content type if specified
48
+ if (isset($_GET['c'])) {
49
+ $contentType = $_GET['c']==='auto' ? true : $_GET['c'];
50
+ }
51
+
52
+ // get files content
53
+ $files = is_array($_GET['f']) ? $_GET['f'] : explode(',', $_GET['f']);
54
+
55
+ // set allowed content-type
56
+ $contentTypeAllowed = array(
57
+ 'text/javascript',
58
+ 'text/css',
59
+ // 'image/gif',
60
+ // 'image/png',
61
+ // 'image/jpeg',
62
+ );
63
+ // set allowed file extensions
64
+ $fileExtAllowed = array(
65
+ 'js',
66
+ 'css',
67
+ // 'gif',
68
+ // 'png',
69
+ // 'js'
70
+ );
71
+
72
+ $out = '';
73
+ $lastModified = 0;
74
+ foreach ($files as $f) {
75
+ $fileRealPath = realpath($f);
76
+ // check file path (security)
77
+ if (strpos($fileRealPath, realpath(dirname(__FILE__))) !== 0) {
78
+ continue;
79
+ }
80
+
81
+ $fileExt = strtolower(pathinfo($fileRealPath, PATHINFO_EXTENSION));
82
+
83
+ // check file extension
84
+ if (empty($fileExt) || !in_array($fileExt, $fileExtAllowed)) {
85
+ continue;
86
+ }
87
+
88
+ // try automatically get content type if requested
89
+ if ($contentType === true) {
90
+ $contentTypes = array(
91
+ 'js' => 'text/javascript',
92
+ 'css' => 'text/css',
93
+ // 'gif' => 'image/gif',
94
+ // 'png' => 'image/png',
95
+ // 'jpg' => 'image/jpeg',
96
+ );
97
+ if (empty($contentTypes[$fileExt])) { // security
98
+ continue;
99
+ }
100
+ $contentType = !empty($contentTypes[$fileExt]) ? $contentTypes[$fileExt] : false;
101
+ }
102
+
103
+ // append file contents
104
+ // we must have blank line at the end of all files but if somebody forget to add it
105
+ // we need add it here
106
+ $out .= file_get_contents($fileRealPath) . "\n";
107
+ $lastModified = max($lastModified, filemtime($fileRealPath));
108
+ }
109
+
110
+ //checking if client have older copy then we have on server
111
+ if (function_exists('date_default_timezone_set')) {
112
+ date_default_timezone_set('UTC');
113
+ }
114
+ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $lastModified) {
115
+ header("HTTP/1.1 304 Not Modified");
116
+ exit;
117
+ }
118
+
119
+ // last modified is the max mtime for loaded files
120
+ header('Cache-Control: must-revalidate');
121
+ header('Last-modified: ' . gmdate('r', $lastModified));
122
+
123
+ // optional custom content type, can be emulated by index.php/x.js or x.css
124
+ if (is_string($contentType) && in_array($contentType, $contentTypeAllowed)) {
125
+ header('Content-type: '.$contentType);
126
+ }
127
+
128
+ // remove spaces, default on
129
+ if (!(isset($_GET['s']) && !$_GET['s'])) {
130
+ $out = preg_replace('#[ \t]+#', ' ', $out);
131
+ }
132
+
133
+ // use gzip or deflate, use this if not enabled in .htaccess, default on
134
+ //if (!(isset($_GET['z']) && !$_GET['z'])) {
135
+ // ini_set('zlib.output_compression', 1);
136
+ //}
137
+
138
+ // add Expires header if not disabled, default 1 year
139
+ if (!(isset($_GET['e']) && $_GET['e']==='no')) {
140
+ $time = time()+(isset($_GET['e']) ? $_GET['e'] : 365)*86400;
141
+ header('Expires: '.gmdate('r', $time));
142
+ }
143
+
144
+ echo $out;
js/lib/FABridge.js ADDED
@@ -0,0 +1,613 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2006 Adobe Systems Incorporated
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6
+ and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
14
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+
16
+ */
17
+
18
+
19
+ /*
20
+ * The Bridge class, responsible for navigating AS instances
21
+ */
22
+ function FABridge(target,bridgeName)
23
+ {
24
+ this.target = target;
25
+ this.remoteTypeCache = {};
26
+ this.remoteInstanceCache = {};
27
+ this.remoteFunctionCache = {};
28
+ this.localFunctionCache = {};
29
+ this.bridgeID = FABridge.nextBridgeID++;
30
+ this.name = bridgeName;
31
+ this.nextLocalFuncID = 0;
32
+ FABridge.instances[this.name] = this;
33
+ FABridge.idMap[this.bridgeID] = this;
34
+
35
+ return this;
36
+ }
37
+
38
+ // type codes for packed values
39
+ FABridge.TYPE_ASINSTANCE = 1;
40
+ FABridge.TYPE_ASFUNCTION = 2;
41
+
42
+ FABridge.TYPE_JSFUNCTION = 3;
43
+ FABridge.TYPE_ANONYMOUS = 4;
44
+
45
+ FABridge.initCallbacks = {};
46
+ FABridge.userTypes = {};
47
+
48
+ FABridge.addToUserTypes = function()
49
+ {
50
+ for (var i = 0; i < arguments.length; i++)
51
+ {
52
+ FABridge.userTypes[arguments[i]] = {
53
+ 'typeName': arguments[i],
54
+ 'enriched': false
55
+ };
56
+ }
57
+ }
58
+
59
+ FABridge.argsToArray = function(args)
60
+ {
61
+ var result = [];
62
+ for (var i = 0; i < args.length; i++)
63
+ {
64
+ result[i] = args[i];
65
+ }
66
+ return result;
67
+ }
68
+
69
+ function instanceFactory(objID)
70
+ {
71
+ this.fb_instance_id = objID;
72
+ return this;
73
+ }
74
+
75
+ function FABridge__invokeJSFunction(args)
76
+ {
77
+ var funcID = args[0];
78
+ var throughArgs = args.concat();//FABridge.argsToArray(arguments);
79
+ throughArgs.shift();
80
+
81
+ var bridge = FABridge.extractBridgeFromID(funcID);
82
+ return bridge.invokeLocalFunction(funcID, throughArgs);
83
+ }
84
+
85
+ FABridge.addInitializationCallback = function(bridgeName, callback)
86
+ {
87
+ var inst = FABridge.instances[bridgeName];
88
+ if (inst != undefined)
89
+ {
90
+ callback.call(inst);
91
+ return;
92
+ }
93
+
94
+ var callbackList = FABridge.initCallbacks[bridgeName];
95
+ if(callbackList == null)
96
+ {
97
+ FABridge.initCallbacks[bridgeName] = callbackList = [];
98
+ }
99
+
100
+ callbackList.push(callback);
101
+ }
102
+
103
+ // updated for changes to SWFObject2
104
+ function FABridge__bridgeInitialized(bridgeName) {
105
+ var objects = document.getElementsByTagName("object");
106
+ var ol = objects.length;
107
+ var activeObjects = [];
108
+ if (ol > 0) {
109
+ for (var i = 0; i < ol; i++) {
110
+ if (typeof objects[i].SetVariable != "undefined") {
111
+ activeObjects[activeObjects.length] = objects[i];
112
+ }
113
+ }
114
+ }
115
+ var embeds = document.getElementsByTagName("embed");
116
+ var el = embeds.length;
117
+ var activeEmbeds = [];
118
+ if (el > 0) {
119
+ for (var j = 0; j < el; j++) {
120
+ if (typeof embeds[j].SetVariable != "undefined") {
121
+ activeEmbeds[activeEmbeds.length] = embeds[j];
122
+ }
123
+ }
124
+ }
125
+ var aol = activeObjects.length;
126
+ var ael = activeEmbeds.length;
127
+ var searchStr = "bridgeName="+ bridgeName;
128
+ if ((aol == 1 && !ael) || (aol == 1 && ael == 1)) {
129
+ FABridge.attachBridge(activeObjects[0], bridgeName);
130
+ }
131
+ else if (ael == 1 && !aol) {
132
+ FABridge.attachBridge(activeEmbeds[0], bridgeName);
133
+ }
134
+ else {
135
+ var flash_found = false;
136
+ if (aol > 1) {
137
+ for (var k = 0; k < aol; k++) {
138
+ var params = activeObjects[k].childNodes;
139
+ for (var l = 0; l < params.length; l++) {
140
+ var param = params[l];
141
+ if (param.nodeType == 1 && param.tagName.toLowerCase() == "param" && param["name"].toLowerCase() == "flashvars" && param["value"].indexOf(searchStr) >= 0) {
142
+ FABridge.attachBridge(activeObjects[k], bridgeName);
143
+ flash_found = true;
144
+ break;
145
+ }
146
+ }
147
+ if (flash_found) {
148
+ break;
149
+ }
150
+ }
151
+ }
152
+ if (!flash_found && ael > 1) {
153
+ for (var m = 0; m < ael; m++) {
154
+ var flashVars = activeEmbeds[m].attributes.getNamedItem("flashVars").nodeValue;
155
+ if (flashVars.indexOf(searchStr) >= 0) {
156
+ FABridge.attachBridge(activeEmbeds[m], bridgeName);
157
+ break;
158
+ }
159
+ }
160
+ }
161
+ }
162
+ return true;
163
+ }
164
+
165
+ // used to track multiple bridge instances, since callbacks from AS are global across the page.
166
+
167
+ FABridge.nextBridgeID = 0;
168
+ FABridge.instances = {};
169
+ FABridge.idMap = {};
170
+ FABridge.refCount = 0;
171
+
172
+ FABridge.extractBridgeFromID = function(id)
173
+ {
174
+ var bridgeID = (id >> 16);
175
+ return FABridge.idMap[bridgeID];
176
+ }
177
+
178
+ FABridge.attachBridge = function(instance, bridgeName)
179
+ {
180
+
181
+ // reuse bridge if it exists
182
+ // var newBridgeInstance = new FABridge(instance, bridgeName);
183
+
184
+ // reuse bridge if it exists
185
+ // FABridge[bridgeName] = newBridgeInstance;
186
+
187
+ if (typeof FABridge[bridgeName] == 'undefined') {
188
+ FABridge[bridgeName] = new FABridge(instance, bridgeName);
189
+ }
190
+
191
+ /* FABridge[bridgeName] = function() {
192
+ return newBridgeInstance.root();
193
+ }
194
+ */
195
+ var callbacks = FABridge.initCallbacks[bridgeName];
196
+ if (callbacks == null)
197
+ {
198
+ return;
199
+ }
200
+ for (var i = 0; i < callbacks.length; i++)
201
+ {
202
+ // callbacks[i].call(newBridgeInstance);
203
+ callbacks[i].call(FABridge[bridgeName]);
204
+ }
205
+
206
+ // reuse bridge if it exists
207
+ // delete FABridge.initCallbacks[bridgeName]
208
+ }
209
+
210
+ // some methods can't be proxied. You can use the explicit get,set, and call methods if necessary.
211
+
212
+ FABridge.blockedMethods =
213
+ {
214
+ toString: true,
215
+ get: true,
216
+ set: true,
217
+ call: true
218
+ };
219
+
220
+ FABridge.prototype =
221
+ {
222
+
223
+
224
+ // bootstrapping
225
+
226
+ root: function()
227
+ {
228
+ return this.deserialize(this.target.getRoot());
229
+ },
230
+ //clears all of the AS objects in the cache maps
231
+ releaseASObjects: function()
232
+ {
233
+ return this.target.releaseASObjects();
234
+ },
235
+ //clears a specific object in AS from the type maps
236
+ releaseNamedASObject: function(value)
237
+ {
238
+ if(typeof(value) != "object")
239
+ {
240
+ return false;
241
+ }
242
+ else
243
+ {
244
+ var ret = this.target.releaseNamedASObject(value.fb_instance_id);
245
+ return ret;
246
+ }
247
+ },
248
+ //create a new AS Object
249
+ create: function(className)
250
+ {
251
+ return this.deserialize(this.target.create(className));
252
+ },
253
+
254
+
255
+ // utilities
256
+
257
+ makeID: function(token)
258
+ {
259
+ return (this.bridgeID << 16) + token;
260
+ },
261
+
262
+
263
+ // low level access to the flash object
264
+
265
+ //get a named property from an AS object
266
+ getPropertyFromAS: function(objRef, propName)
267
+ {
268
+ if (FABridge.refCount > 0)
269
+ {
270
+ throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
271
+ }
272
+ else
273
+ {
274
+ FABridge.refCount++;
275
+ retVal = this.target.getPropFromAS(objRef, propName);
276
+ retVal = this.handleError(retVal);
277
+ FABridge.refCount--;
278
+ return retVal;
279
+ }
280
+ },
281
+ //set a named property on an AS object
282
+ setPropertyInAS: function(objRef,propName, value)
283
+ {
284
+ if (FABridge.refCount > 0)
285
+ {
286
+ throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
287
+ }
288
+ else
289
+ {
290
+ FABridge.refCount++;
291
+ retVal = this.target.setPropInAS(objRef,propName, this.serialize(value));
292
+ retVal = this.handleError(retVal);
293
+ FABridge.refCount--;
294
+ return retVal;
295
+ }
296
+ },
297
+
298
+ //call an AS function
299
+ callASFunction: function(funcID, args)
300
+ {
301
+ if (FABridge.refCount > 0)
302
+ {
303
+ throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
304
+ }
305
+ else
306
+ {
307
+ FABridge.refCount++;
308
+ retVal = this.target.invokeASFunction(funcID, this.serialize(args));
309
+ retVal = this.handleError(retVal);
310
+ FABridge.refCount--;
311
+ return retVal;
312
+ }
313
+ },
314
+ //call a method on an AS object
315
+ callASMethod: function(objID, funcName, args)
316
+ {
317
+ if (FABridge.refCount > 0)
318
+ {
319
+ throw new Error("You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.");
320
+ }
321
+ else
322
+ {
323
+ FABridge.refCount++;
324
+ args = this.serialize(args);
325
+ retVal = this.target.invokeASMethod(objID, funcName, args);
326
+ retVal = this.handleError(retVal);
327
+ FABridge.refCount--;
328
+ return retVal;
329
+ }
330
+ },
331
+
332
+ // responders to remote calls from flash
333
+
334
+ //callback from flash that executes a local JS function
335
+ //used mostly when setting js functions as callbacks on events
336
+ invokeLocalFunction: function(funcID, args)
337
+ {
338
+ var result;
339
+ var func = this.localFunctionCache[funcID];
340
+
341
+ if(func != undefined)
342
+ {
343
+ result = this.serialize(func.apply(null, this.deserialize(args)));
344
+ }
345
+
346
+ return result;
347
+ },
348
+
349
+ // Object Types and Proxies
350
+
351
+ // accepts an object reference, returns a type object matching the obj reference.
352
+ getTypeFromName: function(objTypeName)
353
+ {
354
+ return this.remoteTypeCache[objTypeName];
355
+ },
356
+ //create an AS proxy for the given object ID and type
357
+ createProxy: function(objID, typeName)
358
+ {
359
+ var objType = this.getTypeFromName(typeName);
360
+ instanceFactory.prototype = objType;
361
+ var instance = new instanceFactory(objID);
362
+ this.remoteInstanceCache[objID] = instance;
363
+ return instance;
364
+ },
365
+ //return the proxy associated with the given object ID
366
+ getProxy: function(objID)
367
+ {
368
+ return this.remoteInstanceCache[objID];
369
+ },
370
+
371
+ // accepts a type structure, returns a constructed type
372
+ addTypeDataToCache: function(typeData)
373
+ {
374
+ newType = new ASProxy(this, typeData.name);
375
+ var accessors = typeData.accessors;
376
+ for (var i = 0; i < accessors.length; i++)
377
+ {
378
+ this.addPropertyToType(newType, accessors[i]);
379
+ }
380
+
381
+ var methods = typeData.methods;
382
+ for (var i = 0; i < methods.length; i++)
383
+ {
384
+ if (FABridge.blockedMethods[methods[i]] == undefined)
385
+ {
386
+ this.addMethodToType(newType, methods[i]);
387
+ }
388
+ }
389
+
390
+
391
+ this.remoteTypeCache[newType.typeName] = newType;
392
+ return newType;
393
+ },
394
+
395
+ //add a property to a typename; used to define the properties that can be called on an AS proxied object
396
+ addPropertyToType: function(ty, propName)
397
+ {
398
+ var c = propName.charAt(0);
399
+ var setterName;
400
+ var getterName;
401
+ if(c >= "a" && c <= "z")
402
+ {
403
+ getterName = "get" + c.toUpperCase() + propName.substr(1);
404
+ setterName = "set" + c.toUpperCase() + propName.substr(1);
405
+ }
406
+ else
407
+ {
408
+ getterName = "get" + propName;
409
+ setterName = "set" + propName;
410
+ }
411
+ ty[setterName] = function(val)
412
+ {
413
+ this.bridge.setPropertyInAS(this.fb_instance_id, propName, val);
414
+ }
415
+ ty[getterName] = function()
416
+ {
417
+ return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));
418
+ }
419
+ },
420
+
421
+ //add a method to a typename; used to define the methods that can be callefd on an AS proxied object
422
+ addMethodToType: function(ty, methodName)
423
+ {
424
+ ty[methodName] = function()
425
+ {
426
+ return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id, methodName, FABridge.argsToArray(arguments)));
427
+ }
428
+ },
429
+
430
+ // Function Proxies
431
+
432
+ //returns the AS proxy for the specified function ID
433
+ getFunctionProxy: function(funcID)
434
+ {
435
+ var bridge = this;
436
+ if (this.remoteFunctionCache[funcID] == null)
437
+ {
438
+ this.remoteFunctionCache[funcID] = function()
439
+ {
440
+ bridge.callASFunction(funcID, FABridge.argsToArray(arguments));
441
+ }
442
+ }
443
+ return this.remoteFunctionCache[funcID];
444
+ },
445
+
446
+ //reutrns the ID of the given function; if it doesnt exist it is created and added to the local cache
447
+ getFunctionID: function(func)
448
+ {
449
+ if (func.__bridge_id__ == undefined)
450
+ {
451
+ func.__bridge_id__ = this.makeID(this.nextLocalFuncID++);
452
+ this.localFunctionCache[func.__bridge_id__] = func;
453
+ }
454
+ return func.__bridge_id__;
455
+ },
456
+
457
+ // serialization / deserialization
458
+
459
+ serialize: function(value)
460
+ {
461
+ var result = {};
462
+
463
+ var t = typeof(value);
464
+ //primitives are kept as such
465
+ if (t == "number" || t == "string" || t == "boolean" || t == null || t == undefined)
466
+ {
467
+ result = value;
468
+ }
469
+ else if (value instanceof Array)
470
+ {
471
+ //arrays are serializesd recursively
472
+ result = [];
473
+ for (var i = 0; i < value.length; i++)
474
+ {
475
+ result[i] = this.serialize(value[i]);
476
+ }
477
+ }
478
+ else if (t == "function")
479
+ {
480
+ //js functions are assigned an ID and stored in the local cache
481
+ result.type = FABridge.TYPE_JSFUNCTION;
482
+ result.value = this.getFunctionID(value);
483
+ }
484
+ else if (value instanceof ASProxy)
485
+ {
486
+ result.type = FABridge.TYPE_ASINSTANCE;
487
+ result.value = value.fb_instance_id;
488
+ }
489
+ else
490
+ {
491
+ result.type = FABridge.TYPE_ANONYMOUS;
492
+ result.value = value;
493
+ }
494
+
495
+ return result;
496
+ },
497
+
498
+ //on deserialization we always check the return for the specific error code that is used to marshall NPE's into JS errors
499
+ // the unpacking is done by returning the value on each pachet for objects/arrays
500
+ deserialize: function(packedValue)
501
+ {
502
+
503
+ var result;
504
+
505
+ var t = typeof(packedValue);
506
+ if (t == "number" || t == "string" || t == "boolean" || packedValue == null || packedValue == undefined)
507
+ {
508
+ result = this.handleError(packedValue);
509
+ }
510
+ else if (packedValue instanceof Array)
511
+ {
512
+ result = [];
513
+ for (var i = 0; i < packedValue.length; i++)
514
+ {
515
+ result[i] = this.deserialize(packedValue[i]);
516
+ }
517
+ }
518
+ else if (t == "object")
519
+ {
520
+ for(var i = 0; i < packedValue.newTypes.length; i++)
521
+ {
522
+ this.addTypeDataToCache(packedValue.newTypes[i]);
523
+ }
524
+ for (var aRefID in packedValue.newRefs)
525
+ {
526
+ this.createProxy(aRefID, packedValue.newRefs[aRefID]);
527
+ }
528
+ if (packedValue.type == FABridge.TYPE_PRIMITIVE)
529
+ {
530
+ result = packedValue.value;
531
+ }
532
+ else if (packedValue.type == FABridge.TYPE_ASFUNCTION)
533
+ {
534
+ result = this.getFunctionProxy(packedValue.value);
535
+ }
536
+ else if (packedValue.type == FABridge.TYPE_ASINSTANCE)
537
+ {
538
+ result = this.getProxy(packedValue.value);
539
+ }
540
+ else if (packedValue.type == FABridge.TYPE_ANONYMOUS)
541
+ {
542
+ result = packedValue.value;
543
+ }
544
+ }
545
+ return result;
546
+ },
547
+ //increases the reference count for the given object
548
+ addRef: function(obj)
549
+ {
550
+ this.target.incRef(obj.fb_instance_id);
551
+ },
552
+ //decrease the reference count for the given object and release it if needed
553
+ release:function(obj)
554
+ {
555
+ this.target.releaseRef(obj.fb_instance_id);
556
+ },
557
+
558
+ // check the given value for the components of the hard-coded error code : __FLASHERROR
559
+ // used to marshall NPE's into flash
560
+
561
+ handleError: function(value)
562
+ {
563
+ if (typeof(value)=="string" && value.indexOf("__FLASHERROR")==0)
564
+ {
565
+ var myErrorMessage = value.split("||");
566
+ if(FABridge.refCount > 0 )
567
+ {
568
+ FABridge.refCount--;
569
+ }
570
+ throw new Error(myErrorMessage[1]);
571
+ return value;
572
+ }
573
+ else
574
+ {
575
+ return value;
576
+ }
577
+ }
578
+ };
579
+
580
+ // The root ASProxy class that facades a flash object
581
+
582
+ ASProxy = function(bridge, typeName)
583
+ {
584
+ this.bridge = bridge;
585
+ this.typeName = typeName;
586
+ return this;
587
+ };
588
+ //methods available on each ASProxy object
589
+ ASProxy.prototype =
590
+ {
591
+ get: function(propName)
592
+ {
593
+ return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));
594
+ },
595
+
596
+ set: function(propName, value)
597
+ {
598
+ this.bridge.setPropertyInAS(this.fb_instance_id, propName, value);
599
+ },
600
+
601
+ call: function(funcName, args)
602
+ {
603
+ this.bridge.callASMethod(this.fb_instance_id, funcName, args);
604
+ },
605
+
606
+ addRef: function() {
607
+ this.bridge.addRef(this);
608
+ },
609
+
610
+ release: function() {
611
+ this.bridge.release(this);
612
+ }
613
+ };
js/lib/boxover.js ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* --- BoxOver ---
2
+ /* --- v 2.1 17th June 2006
3
+ By Oliver Bryant with help of Matthew Tagg
4
+ http://boxover.swazz.org */
5
+
6
+ if (typeof document.attachEvent!='undefined') {
7
+ window.attachEvent('onload',init);
8
+ document.attachEvent('onmousemove',moveMouse);
9
+ document.attachEvent('onclick',checkMove); }
10
+ else {
11
+ window.addEventListener('load',init,false);
12
+ document.addEventListener('mousemove',moveMouse,false);
13
+ document.addEventListener('click',checkMove,false);
14
+ }
15
+
16
+ var oDv=document.createElement("div");
17
+ var dvHdr=document.createElement("div");
18
+ var dvBdy=document.createElement("div");
19
+ var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
20
+ boxOpen=false;
21
+ ox=10;
22
+ oy=10;
23
+ lockX=0;
24
+ lockY=0;
25
+
26
+ function init() {
27
+ oDv.appendChild(dvHdr);
28
+ oDv.appendChild(dvBdy);
29
+ oDv.style.position="absolute";
30
+ oDv.style.visibility='hidden';
31
+ document.body.appendChild(oDv);
32
+ }
33
+
34
+ function defHdrStyle() {
35
+ dvHdr.innerHTML='<img style="vertical-align:middle" src="info.gif">&nbsp;&nbsp;'+dvHdr.innerHTML;
36
+ dvHdr.style.fontWeight='bold';
37
+ dvHdr.style.width='150px';
38
+ dvHdr.style.fontFamily='arial';
39
+ dvHdr.style.border='1px solid #A5CFE9';
40
+ dvHdr.style.padding='3';
41
+ dvHdr.style.fontSize='11';
42
+ dvHdr.style.color='#4B7A98';
43
+ dvHdr.style.background='#D5EBF9';
44
+ dvHdr.style.filter='alpha(opacity=85)'; // IE
45
+ dvHdr.style.opacity='0.85'; // FF
46
+ }
47
+
48
+ function defBdyStyle() {
49
+ dvBdy.style.borderBottom='1px solid #A5CFE9';
50
+ dvBdy.style.borderLeft='1px solid #A5CFE9';
51
+ dvBdy.style.borderRight='1px solid #A5CFE9';
52
+ dvBdy.style.width='150px';
53
+ dvBdy.style.fontFamily='arial';
54
+ dvBdy.style.fontSize='11';
55
+ dvBdy.style.padding='3';
56
+ dvBdy.style.color='#1B4966';
57
+ dvBdy.style.background='#FFFFFF';
58
+ dvBdy.style.filter='alpha(opacity=85)'; // IE
59
+ dvBdy.style.opacity='0.85'; // FF
60
+ }
61
+
62
+ function checkElemBO(txt) {
63
+ if (!txt || typeof(txt) != 'string') return false;
64
+ if ((txt.indexOf('header')>-1)&&(txt.indexOf('body')>-1)&&(txt.indexOf('[')>-1)&&(txt.indexOf('[')>-1))
65
+ return true;
66
+ else
67
+ return false;
68
+ }
69
+
70
+ function scanBO(curNode) {
71
+ if (checkElemBO(curNode.title)) {
72
+ curNode.boHDR=getParam('header',curNode.title);
73
+ curNode.boBDY=getParam('body',curNode.title);
74
+ curNode.boCSSBDY=getParam('cssbody',curNode.title);
75
+ curNode.boCSSHDR=getParam('cssheader',curNode.title);
76
+ curNode.IEbugfix=(getParam('hideselects',curNode.title)=='on')?true:false;
77
+ curNode.fixX=parseInt(getParam('fixedrelx',curNode.title));
78
+ curNode.fixY=parseInt(getParam('fixedrely',curNode.title));
79
+ curNode.absX=parseInt(getParam('fixedabsx',curNode.title));
80
+ curNode.absY=parseInt(getParam('fixedabsy',curNode.title));
81
+ curNode.offY=(getParam('offsety',curNode.title)!='')?parseInt(getParam('offsety',curNode.title)):10;
82
+ curNode.offX=(getParam('offsetx',curNode.title)!='')?parseInt(getParam('offsetx',curNode.title)):10;
83
+ curNode.fade=(getParam('fade',curNode.title)=='on')?true:false;
84
+ curNode.fadespeed=(getParam('fadespeed',curNode.title)!='')?getParam('fadespeed',curNode.title):0.04;
85
+ curNode.delay=(getParam('delay',curNode.title)!='')?parseInt(getParam('delay',curNode.title)):0;
86
+ if (getParam('requireclick',curNode.title)=='on') {
87
+ curNode.requireclick=true;
88
+ document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
89
+ document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
90
+ }
91
+ else {// Note : if requireclick is on the stop clicks are ignored
92
+ if (getParam('doubleclickstop',curNode.title)!='off') {
93
+ document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
94
+ }
95
+ if (getParam('singleclickstop',curNode.title)=='on') {
96
+ document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
97
+ }
98
+ }
99
+ curNode.windowLock=getParam('windowlock',curNode.title).toLowerCase()=='off'?false:true;
100
+ curNode.title='';
101
+ curNode.hasbox=1;
102
+ }
103
+ else
104
+ curNode.hasbox=2;
105
+ }
106
+
107
+
108
+ function getParam(param,list) {
109
+ var reg = new RegExp('([^a-zA-Z]' + param + '|^' + param + ')\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');
110
+ var res = reg.exec(list);
111
+ var returnvar;
112
+ if(res)
113
+ return res[2].replace('[[','[').replace(']]',']');
114
+ else
115
+ return '';
116
+ }
117
+
118
+ function Left(elem){
119
+ var x=0;
120
+ if (elem.calcLeft)
121
+ return elem.calcLeft;
122
+ var oElem=elem;
123
+ while(elem){
124
+ if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
125
+ x+=parseInt(elem.currentStyle.borderLeftWidth);
126
+ x+=elem.offsetLeft;
127
+ elem=elem.offsetParent;
128
+ }
129
+ oElem.calcLeft=x;
130
+ return x;
131
+ }
132
+
133
+ function Top(elem){
134
+ var x=0;
135
+ if (elem.calcTop)
136
+ return elem.calcTop;
137
+ var oElem=elem;
138
+ while(elem){
139
+ if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
140
+ x+=parseInt(elem.currentStyle.borderTopWidth);
141
+ x+=elem.offsetTop;
142
+ elem=elem.offsetParent;
143
+ }
144
+ oElem.calcTop=x;
145
+ return x;
146
+
147
+ }
148
+
149
+ var ah,ab;
150
+ function applyStyles() {
151
+ if(ab)
152
+ oDv.removeChild(dvBdy);
153
+ if (ah)
154
+ oDv.removeChild(dvHdr);
155
+ dvHdr=document.createElement("div");
156
+ dvBdy=document.createElement("div");
157
+ CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
158
+ CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
159
+ dvHdr.innerHTML=CBE.boHDR;
160
+ dvBdy.innerHTML=CBE.boBDY;
161
+ ah=false;
162
+ ab=false;
163
+ if (CBE.boHDR!='') {
164
+ oDv.appendChild(dvHdr);
165
+ ah=true;
166
+ }
167
+ if (CBE.boBDY!=''){
168
+ oDv.appendChild(dvBdy);
169
+ ab=true;
170
+ }
171
+ }
172
+
173
+ var CSE,iterElem,LSE,CBE,LBE, totalScrollLeft, totalScrollTop, width, height ;
174
+ var ini=false;
175
+
176
+ // Customised function for inner window dimension
177
+ function SHW() {
178
+ if (document.body && (document.body.clientWidth !=0)) {
179
+ width=document.body.clientWidth;
180
+ height=document.body.clientHeight;
181
+ }
182
+ if (document.documentElement && (document.documentElement.clientWidth!=0) && (document.body.clientWidth + 20 >= document.documentElement.clientWidth)) {
183
+ width=document.documentElement.clientWidth;
184
+ height=document.documentElement.clientHeight;
185
+ }
186
+ return [width,height];
187
+ }
188
+
189
+
190
+ var ID=null;
191
+ function moveMouse(e) {
192
+ //boxMove=true;
193
+ e?evt=e:evt=event;
194
+
195
+ CSE=evt.target?evt.target:evt.srcElement;
196
+
197
+ if (!CSE.hasbox) {
198
+ // Note we need to scan up DOM here, some elements like TR don't get triggered as srcElement
199
+ iElem=CSE;
200
+ while ((iElem.parentNode) && (!iElem.hasbox)) {
201
+ scanBO(iElem);
202
+ iElem=iElem.parentNode;
203
+ }
204
+ }
205
+
206
+ if ((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){
207
+ if (!CSE.boxItem) {
208
+ iterElem=CSE;
209
+ while ((iterElem.hasbox==2)&&(iterElem.parentNode))
210
+ iterElem=iterElem.parentNode;
211
+ CSE.boxItem=iterElem;
212
+ }
213
+ iterElem=CSE.boxItem;