[903] | 1 | /* This notice must be untouched at all times. |
---|
| 2 | |
---|
| 3 | wz_dragdrop.js v. 4.55 |
---|
| 4 | The latest version is available at |
---|
| 5 | http://www.walterzorn.com |
---|
| 6 | or http://www.devira.com |
---|
| 7 | or http://www.walterzorn.de |
---|
| 8 | |
---|
| 9 | Copyright (c) 2002-2003 Walter Zorn. All rights reserved. |
---|
| 10 | Created 26. 8. 2002 by Walter Zorn (Web: http://www.walterzorn.com ) |
---|
| 11 | Last modified: 23. 5. 2004 |
---|
| 12 | |
---|
| 13 | This DHTML & Drag&Drop Library adds Drag&Drop functionality |
---|
| 14 | to the following types of html-elements: |
---|
| 15 | - images, even if not positioned via layers, |
---|
| 16 | nor via stylesheets or any other kind of "hard-coding" |
---|
| 17 | - relatively and absolutely positioned layers (DIV elements). |
---|
| 18 | Moreover, it provides extended DHTML abilities. |
---|
| 19 | |
---|
| 20 | This program is free software; |
---|
| 21 | you can redistribute it and/or modify it under the terms of the |
---|
| 22 | GNU General Public License as published by the Free Software Foundation; |
---|
| 23 | either version 2 of the License, or (at your option) any later version. |
---|
| 24 | This program is distributed in the hope that it will be useful, |
---|
| 25 | but WITHOUT ANY WARRANTY; |
---|
| 26 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
| 27 | See the GNU General Public License |
---|
| 28 | at http://www.gnu.org/copyleft/gpl.html for more details. |
---|
| 29 | */ |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | // PATH TO THE TRANSPARENT 1*1 PX IMAGE (required by NS 4 as spacer) |
---|
| 33 | var spacer = 'transparentpixel.gif'; |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | //window.onerror = new Function('return true;'); |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | // Optional commands passed to SET_DHTML() on the html-page (g: may be applied globally, i: individually) |
---|
| 42 | var CLONE = 'C10nE'; // i img clone image |
---|
| 43 | var COPY = 'C0pY'; // i img create copies |
---|
| 44 | var DETACH_CHILDREN = 'd37aCH'; // i lyr detach images |
---|
| 45 | var HORIZONTAL = 'H0r1Z'; // i img,lyr horizontally draggable only |
---|
| 46 | var MAXHEIGHT = 'm7x8I'; // i img,lyr maximum height limit, " |
---|
| 47 | var MAXOFFBOTTOM = 'm7xd0wN'; // i img,lyr downward offset limit |
---|
| 48 | var MAXOFFLEFT = 'm7x23Ft'; // i img,lyr leftward offset limit |
---|
| 49 | var MAXOFFRIGHT = 'm7x0Ff8'; // i img,lyr rightward offset limit |
---|
| 50 | var MAXOFFTOP = 'm7xu9'; // i img,lyr upward offset limit |
---|
| 51 | var MAXWIDTH = 'm7xW1'; // i img,lyr maximum width limit, use with resizable or scalable |
---|
| 52 | var MINWIDTH = 'm1nw1'; // i img,lyr minimum width limit, " |
---|
| 53 | var MINHEIGHT = 'm1n8I'; // i img,lyr minimum height limit, " |
---|
| 54 | var NO_ALT = 'no81T'; // gi img disable alt and title attributes |
---|
| 55 | var NO_DRAG = 'N0d4Ag'; // i img,lyr disable draggability |
---|
| 56 | var RESET_Z = 'r35E7z'; // gi img,lyr reset z-index when dropped |
---|
| 57 | var RESIZABLE = 'r5IZbl'; // gi img,lyr resizable if <ctrl> or <shift> pressed |
---|
| 58 | var SCALABLE = 'SCLbl'; // gi img,lyr scalable " |
---|
| 59 | var SCROLL = 'sC8lL'; // gi img,lyr enable auto scroll functionality |
---|
| 60 | var VERTICAL = 'V3Rt1C'; // i img,lyr vertically draggable only |
---|
| 61 | |
---|
| 62 | var dd_cursors = new Array( |
---|
| 63 | 'c:default', |
---|
| 64 | 'c:crosshair', |
---|
| 65 | 'c:e-resize', |
---|
| 66 | 'c:hand', |
---|
| 67 | 'c:help', |
---|
| 68 | 'c:move', |
---|
| 69 | 'c:n-resize', |
---|
| 70 | 'c:ne-resize', |
---|
| 71 | 'c:nw-resize', |
---|
| 72 | 'c:s-resize', |
---|
| 73 | 'c:se-resize', |
---|
| 74 | 'c:sw-resize', |
---|
| 75 | 'c:text', |
---|
| 76 | 'c:w-resize', |
---|
| 77 | 'c:wait' |
---|
| 78 | ); |
---|
| 79 | var dd_i = dd_cursors.length; while(dd_i--) |
---|
| 80 | eval('var CURSOR_' + (dd_cursors[dd_i].substring(2).toUpperCase().replace('-', '_')) + ' = "' + dd_cursors[dd_i] + '";'); |
---|
| 81 | |
---|
| 82 | var dd_u = "undefined"; |
---|
| 83 | |
---|
| 84 | function WZDD() |
---|
| 85 | { |
---|
| 86 | this.n = navigator.userAgent.toLowerCase(); |
---|
| 87 | this.db = (document.compatMode && document.compatMode.toLowerCase() != "backcompat")? |
---|
| 88 | document.documentElement |
---|
| 89 | : (document.body || null); |
---|
| 90 | this.op = !!(window.opera && document.getElementById); |
---|
| 91 | this.op6 = !!(this.op && !(this.db && this.db.innerHTML)); |
---|
| 92 | if (this.op && !this.op6) document.onmousedown = new Function('e', |
---|
| 93 | 'if (((e = e || window.event).target || e.srcElement).tagName == "IMAGE") return false;' |
---|
| 94 | ); |
---|
| 95 | this.ie = !!(this.n.indexOf("msie") >= 0 && document.all && this.db && !this.op); |
---|
| 96 | this.iemac = !!(this.ie && this.n.indexOf("mac") >= 0); |
---|
| 97 | this.ie4 = !!(this.ie && !document.getElementById); |
---|
| 98 | this.n4 = !!(document.layers && typeof document.classes != dd_u); |
---|
| 99 | this.n6 = !!(typeof window.getComputedStyle != dd_u && typeof document.createRange != dd_u); |
---|
| 100 | this.w3c = !!(!this.op && !this.ie && !this.n6 && document.getElementById); |
---|
| 101 | this.ce = !!(document.captureEvents && document.releaseEvents); |
---|
| 102 | this.px = (this.n4 || this.op6)? '' : 'px'; |
---|
| 103 | } |
---|
| 104 | var dd = new WZDD(); |
---|
| 105 | |
---|
| 106 | dd.Int = function(d_x, d_y) |
---|
| 107 | { |
---|
| 108 | return isNaN(d_y = parseInt(d_x))? 0 : d_y; |
---|
| 109 | }; |
---|
| 110 | |
---|
| 111 | dd.getWndW = function() |
---|
| 112 | { |
---|
| 113 | return dd.Int( |
---|
| 114 | (dd.db && !dd.op && !dd.w3c && dd.db.clientWidth)? dd.db.clientWidth |
---|
| 115 | : (window.innerWidth || 0) |
---|
| 116 | ); |
---|
| 117 | }; |
---|
| 118 | |
---|
| 119 | dd.getWndH = function() |
---|
| 120 | { |
---|
| 121 | return dd.Int( |
---|
| 122 | (dd.db && !dd.op && !dd.w3c && dd.db.clientHeight)? dd.db.clientHeight |
---|
| 123 | : (window.innerHeight || 0) |
---|
| 124 | ); |
---|
| 125 | }; |
---|
| 126 | |
---|
| 127 | dd.getScrollX = function() |
---|
| 128 | { |
---|
| 129 | return dd.Int(window.pageXOffset || (dd.db? dd.db.scrollLeft : 0)); |
---|
| 130 | }; |
---|
| 131 | |
---|
| 132 | dd.getScrollY = function() |
---|
| 133 | { |
---|
| 134 | return dd.Int(window.pageYOffset || (dd.db? dd.db.scrollTop : 0)); |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | dd.getPageXY = function(d_o) |
---|
| 138 | { |
---|
| 139 | if (dd.n4 && d_o) |
---|
| 140 | { |
---|
| 141 | dd.x = d_o.pageX || 0; |
---|
| 142 | dd.y = d_o.pageY || 0; |
---|
| 143 | } |
---|
| 144 | else |
---|
| 145 | { |
---|
| 146 | dd.x = dd.y = 0; //global helper vars |
---|
| 147 | while (d_o) |
---|
| 148 | { |
---|
| 149 | dd.x += dd.Int(d_o.offsetLeft); |
---|
| 150 | dd.y += dd.Int(d_o.offsetTop); |
---|
| 151 | d_o = d_o.offsetParent || null; |
---|
| 152 | } |
---|
| 153 | } |
---|
| 154 | }; |
---|
| 155 | |
---|
| 156 | dd.getCssXY = function(d_o) |
---|
| 157 | { |
---|
| 158 | if (d_o.div) |
---|
| 159 | { |
---|
| 160 | if (dd.n4) |
---|
| 161 | { |
---|
| 162 | d_o.cssx = d_o.div.x; |
---|
| 163 | d_o.cssy = d_o.div.y; |
---|
| 164 | } |
---|
| 165 | else if (dd.ie4) |
---|
| 166 | { |
---|
| 167 | d_o.cssx = d_o.css.pixelLeft; |
---|
| 168 | d_o.cssy = d_o.css.pixelTop; |
---|
| 169 | } |
---|
| 170 | else |
---|
| 171 | { |
---|
| 172 | d_o.css.left = d_o.css.top = 0 + dd.px; |
---|
| 173 | dd.getPageXY(d_o.div); |
---|
| 174 | d_o.cssx = d_o.x - dd.x; |
---|
| 175 | d_o.cssy = d_o.y - dd.y; |
---|
| 176 | d_o.css.left = d_o.cssx + dd.px; |
---|
| 177 | d_o.css.top = d_o.cssy + dd.px; |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | else |
---|
| 181 | { |
---|
| 182 | d_o.cssx = 0; |
---|
| 183 | d_o.cssy = 0; |
---|
| 184 | } |
---|
| 185 | }; |
---|
| 186 | |
---|
| 187 | dd.getImgW = function(d_o) |
---|
| 188 | { |
---|
| 189 | return d_o? dd.Int(d_o.width) : 0; |
---|
| 190 | }; |
---|
| 191 | |
---|
| 192 | dd.getImgH = function(d_o) |
---|
| 193 | { |
---|
| 194 | return d_o? dd.Int(d_o.height) : 0; |
---|
| 195 | }; |
---|
| 196 | |
---|
| 197 | dd.getDivW = function(d_o) |
---|
| 198 | { |
---|
| 199 | return dd.Int( |
---|
| 200 | dd.n4? (d_o.div? d_o.div.clip.width : 0) |
---|
| 201 | : d_o.div? (d_o.div.offsetWidth || d_o.css.pixelWidth || d_o.css.width || 0) |
---|
| 202 | : 0 |
---|
| 203 | ); |
---|
| 204 | }; |
---|
| 205 | |
---|
| 206 | dd.getDivH = function(d_o) |
---|
| 207 | { |
---|
| 208 | return dd.Int( |
---|
| 209 | dd.n4? (d_o.div? d_o.div.clip.height : 0) |
---|
| 210 | : d_o.div? (d_o.div.offsetHeight || d_o.css.pixelHeight || d_o.css.height || 0) |
---|
| 211 | : 0 |
---|
| 212 | ); |
---|
| 213 | }; |
---|
| 214 | |
---|
| 215 | dd.getWH = function(d_o) |
---|
| 216 | { |
---|
| 217 | d_o.w = dd.getDivW(d_o); |
---|
| 218 | d_o.h = dd.getDivH(d_o); |
---|
| 219 | if (d_o.css) |
---|
| 220 | { |
---|
| 221 | d_o.css.width = d_o.w + dd.px; |
---|
| 222 | d_o.css.height = d_o.h + dd.px; |
---|
| 223 | d_o.dw = dd.getDivW(d_o)-d_o.w; |
---|
| 224 | d_o.dh = dd.getDivH(d_o)-d_o.h; |
---|
| 225 | d_o.css.width = (d_o.w-d_o.dw) + dd.px; |
---|
| 226 | d_o.css.height = (d_o.h-d_o.dh) + dd.px; |
---|
| 227 | } |
---|
| 228 | else d_o.dw = d_o.dh = 0; |
---|
| 229 | }; |
---|
| 230 | |
---|
| 231 | dd.getCssProp = function(d_o, d_pn6, d_pstyle, d_pn4) |
---|
| 232 | { |
---|
| 233 | if (d_o && dd.n6) return ''+window.getComputedStyle(d_o, null).getPropertyValue(d_pn6); |
---|
| 234 | if (d_o && d_o.currentStyle) return ''+eval('d_o.currentStyle.'+d_pstyle); |
---|
| 235 | if (d_o && d_o.style) return ''+eval('d_o.style.'+d_pstyle); |
---|
| 236 | if (d_o && dd.n4) return ''+eval('d_o.'+d_pn4); |
---|
| 237 | return ''; |
---|
| 238 | }; |
---|
| 239 | |
---|
| 240 | dd.getDiv = function(d_x, d_d) |
---|
| 241 | { |
---|
| 242 | d_d = d_d || document; |
---|
| 243 | if (dd.n4) |
---|
| 244 | { |
---|
| 245 | if (d_d.layers[d_x]) return d_d.layers[d_x]; |
---|
| 246 | for (var d_i = d_d.layers.length; d_i--;) |
---|
| 247 | { |
---|
| 248 | var d_y = dd.getDiv(d_x, d_d.layers[d_i].document); |
---|
| 249 | if (d_y) return d_y; |
---|
| 250 | } |
---|
| 251 | } |
---|
| 252 | if (dd.ie) return d_d.all[d_x] || null; |
---|
| 253 | if (d_d.getElementById) return d_d.getElementById(d_x) || null; |
---|
| 254 | return null; |
---|
| 255 | }; |
---|
| 256 | |
---|
| 257 | dd.getImg = function(d_o, d_nm, d_xy, d_w) |
---|
| 258 | { |
---|
| 259 | d_w = d_w || window; |
---|
| 260 | var d_img; |
---|
| 261 | if ((d_img = d_w.document.images[d_nm]) && d_img.name == d_nm) |
---|
| 262 | { |
---|
| 263 | if (d_xy) |
---|
| 264 | { |
---|
| 265 | if (dd.n4) |
---|
| 266 | { |
---|
| 267 | dd.getPageXY(d_w); |
---|
| 268 | d_o.defx = d_img.x + dd.x; |
---|
| 269 | d_o.defy = d_img.y + dd.y; |
---|
| 270 | } |
---|
| 271 | else |
---|
| 272 | { |
---|
| 273 | dd.getPageXY(d_img); |
---|
| 274 | d_o.defx = dd.x; |
---|
| 275 | d_o.defy = dd.y; |
---|
| 276 | } |
---|
| 277 | } |
---|
| 278 | return d_img; |
---|
| 279 | } |
---|
| 280 | if (dd.n4) for (var d_i = d_w.document.layers.length; d_i--;) |
---|
| 281 | { |
---|
| 282 | var d_y = dd.getImg(d_o, d_nm, d_xy, d_w.document.layers[d_i]); |
---|
| 283 | if (d_y) return d_y; |
---|
| 284 | } |
---|
| 285 | return null; |
---|
| 286 | }; |
---|
| 287 | |
---|
| 288 | dd.getParent = function(d_o) |
---|
| 289 | { |
---|
| 290 | if (dd.n4) |
---|
| 291 | { |
---|
| 292 | for (var d_p, d_i = dd.elements.length; d_i--;) |
---|
| 293 | { |
---|
| 294 | if (!((d_p = dd.elements[d_i]).is_image) && d_p.div && (d_p.div.document.layers[d_o.name] || d_o.oimg && d_p.div.document.images[d_o.oimg.name])) |
---|
| 295 | d_p.addChild(d_o, d_p.detach, 1); |
---|
| 296 | } |
---|
| 297 | } |
---|
| 298 | else |
---|
| 299 | { |
---|
| 300 | var d_p = d_o.is_image? dd.getImg(d_o, d_o.oimg.name) : (d_o.div || null); |
---|
| 301 | while (d_p && !!(d_p = d_p.offsetParent || d_p.parentNode || null)) |
---|
| 302 | { |
---|
| 303 | if (d_p.ddObj) |
---|
| 304 | { |
---|
| 305 | d_p.ddObj.addChild(d_o, d_p.ddObj.detach, 1); |
---|
| 306 | break; |
---|
| 307 | } |
---|
| 308 | } |
---|
| 309 | } |
---|
| 310 | }; |
---|
| 311 | |
---|
| 312 | dd.getCmd = function(d_o, d_cmd, d_cmdStr) |
---|
| 313 | { |
---|
| 314 | var d_i = d_o.id.indexOf(d_cmd), d_j, |
---|
| 315 | d_y = (d_i >= 0)*1; |
---|
| 316 | if (d_y) |
---|
| 317 | { |
---|
| 318 | d_j = d_i+d_cmd.length; |
---|
| 319 | if (d_cmdStr) d_o.cmd += d_o.id.substring(d_i, d_j); |
---|
| 320 | d_o.id = d_o.id.substring(0, d_i) + d_o.id.substring(d_j); |
---|
| 321 | } |
---|
| 322 | return d_y; |
---|
| 323 | }; |
---|
| 324 | |
---|
| 325 | dd.getCmdVal = function(d_o, d_cmd, d_cmdStr, int0) |
---|
| 326 | { |
---|
| 327 | var d_i = d_o.id.indexOf(d_cmd), d_j, |
---|
| 328 | d_y = (d_o.id.indexOf(d_cmd) >= 0)? dd.Int(d_o.id.substring(d_o.id.indexOf(d_cmd)+d_cmd.length)) : int0? -1 : 0; |
---|
| 329 | if (!int0 && d_y || int0 && d_y >= 0) |
---|
| 330 | { |
---|
| 331 | d_j = d_i+d_cmd.length+d_y.toString().length; |
---|
| 332 | if (d_cmdStr) d_o.cmd += d_o.id.substring(d_i, d_j); |
---|
| 333 | d_o.id = d_o.id.substring(0, d_i) + d_o.id.substring(d_j); |
---|
| 334 | } |
---|
| 335 | return d_y; |
---|
| 336 | }; |
---|
| 337 | |
---|
| 338 | dd.addElt = function(d_o, d_p) |
---|
| 339 | { |
---|
| 340 | dd.elements[dd.elements.length] = dd.elements[d_o.name] = d_o; |
---|
| 341 | if (d_p) d_p.copies[d_p.copies.length] = d_p.copies[d_o.name] = d_o; |
---|
| 342 | }; |
---|
| 343 | |
---|
| 344 | dd.mkWzDom = function() |
---|
| 345 | { |
---|
| 346 | var d_i = dd.elements.length; while(d_i--) dd.getParent(dd.elements[d_i]); |
---|
| 347 | d_i = dd.elements.length; while(d_i--) |
---|
| 348 | d_o = dd.elements[d_i]; |
---|
| 349 | if (d_o.children && !d_o.parent) |
---|
| 350 | { |
---|
| 351 | var d_j = d_o.children.length; while(d_j--) |
---|
| 352 | d_o.children[d_j].setZ(d_o.z+d_o.children[d_j].z, 1); |
---|
| 353 | } |
---|
| 354 | }; |
---|
| 355 | |
---|
| 356 | dd.addProps = function(d_o) |
---|
| 357 | { |
---|
| 358 | var d_i, d_c; |
---|
| 359 | if (d_o.is_image) |
---|
| 360 | { |
---|
| 361 | d_o.div = dd.getDiv(d_o.id); |
---|
| 362 | if (d_o.div && typeof d_o.div.style != "undefined") d_o.css = d_o.div.style; |
---|
| 363 | d_o.nimg = (dd.n4 && d_o.div)? d_o.div.document.images[0] : (document.images[d_o.id+'NImG'] || null); |
---|
| 364 | if (!d_o.noalt && !dd.noalt) |
---|
| 365 | { |
---|
| 366 | d_o.nimg.alt = d_o.oimg.alt || ''; |
---|
| 367 | if (d_o.oimg.title) d_o.nimg.title = d_o.oimg.title; |
---|
| 368 | } |
---|
| 369 | d_o.bgColor = ''; |
---|
| 370 | } |
---|
| 371 | else |
---|
| 372 | { |
---|
| 373 | d_o.bgColor = dd.getCssProp(d_o.div, 'background-color','backgroundColor','bgColor').toLowerCase(); |
---|
| 374 | if (dd.n6 && d_o.div) |
---|
| 375 | { |
---|
| 376 | if ((d_c = d_o.bgColor).indexOf('rgb') >= 0) |
---|
| 377 | { |
---|
| 378 | d_c = d_c.substring(4, d_c.length-1).split(','); |
---|
| 379 | d_o.bgColor = '#'; |
---|
| 380 | for (var d_i = 0; d_i < d_c.length; d_i++) d_o.bgColor += parseInt(d_c[d_i]).toString(0x10); |
---|
| 381 | } |
---|
| 382 | else d_o.bgColor = d_c; |
---|
| 383 | } |
---|
| 384 | } |
---|
| 385 | if (dd.scalable) d_o.scalable = d_o.resizable^1; |
---|
| 386 | else if (dd.resizable) d_o.resizable = d_o.scalable^1; |
---|
| 387 | d_o.setZ(d_o.defz); |
---|
| 388 | d_o.cursor = d_o.cursor || dd.cursor || 'auto'; |
---|
| 389 | d_o._setCrs(d_o.nodrag? 'auto' : d_o.cursor); |
---|
| 390 | d_o.visible = true; |
---|
| 391 | }; |
---|
| 392 | |
---|
| 393 | dd.initz = function() |
---|
| 394 | { |
---|
| 395 | if (!(dd && (dd.n4 || dd.n6 || dd.ie || dd.op || dd.w3c))) return; |
---|
| 396 | if (dd.op6) WINSZ(2); |
---|
| 397 | else if (dd.n6 || dd.ie || dd.op && !dd.op6 || dd.w3c) dd.recalc(1); |
---|
| 398 | var d_drag = (document.onmousemove == DRAG), |
---|
| 399 | d_resize = (document.onmousemove == RESIZE); |
---|
| 400 | if (dd.loadFunc) dd.loadFunc(); |
---|
| 401 | if (d_drag && document.onmousemove != DRAG) dd.setEvtHdl(1, DRAG); |
---|
| 402 | else if (d_resize && document.onmousemove != RESIZE) dd.setEvtHdl(1, RESIZE); |
---|
| 403 | if ((d_drag || d_resize) && document.onmouseup != DROP) dd.setEvtHdl(2, DROP); |
---|
| 404 | dd.setEvtHdl(0, PICK); |
---|
| 405 | }; |
---|
| 406 | |
---|
| 407 | dd.finlz = function() |
---|
| 408 | { |
---|
| 409 | if (dd.ie && dd.elements) |
---|
| 410 | { |
---|
| 411 | var d_i = dd.elements.length; while (d_i--) |
---|
| 412 | dd.elements[d_i].del(); |
---|
| 413 | } |
---|
| 414 | }; |
---|
| 415 | |
---|
| 416 | dd.setEvtHdl = function(d_typ, d_func) |
---|
| 417 | { |
---|
| 418 | if (!d_typ) |
---|
| 419 | { |
---|
| 420 | if (document.onmousedown != d_func) dd.downFunc = document.onmousedown || null; |
---|
| 421 | document.onmousedown = d_func; |
---|
| 422 | } |
---|
| 423 | else if (d_typ&1) |
---|
| 424 | { |
---|
| 425 | if (document.onmousemove != d_func) dd.moveFunc = document.onmousemove || null; |
---|
| 426 | document.onmousemove = d_func; |
---|
| 427 | } |
---|
| 428 | else |
---|
| 429 | { |
---|
| 430 | if (document.onmouseup != d_func) dd.upFunc = document.onmouseup || null; |
---|
| 431 | document.onmouseup = d_func; |
---|
| 432 | } |
---|
| 433 | if (dd.ce) |
---|
| 434 | { |
---|
| 435 | var d_e = (!d_typ)? Event.MOUSEDOWN : (d_typ&1)? Event.MOUSEMOVE : Event.MOUSEUP; |
---|
| 436 | d_func? document.captureEvents(d_e) : document.releaseEvents(d_e); |
---|
| 437 | } |
---|
| 438 | }; |
---|
| 439 | |
---|
| 440 | dd.evt = function(d_e) |
---|
| 441 | { |
---|
| 442 | this.but = (this.e = d_e || window.event).which || this.e.button || 0; |
---|
| 443 | this.button = (this.e.type == 'mousedown')? this.but |
---|
| 444 | : (dd.e && dd.e.button)? dd.e.button |
---|
| 445 | : 0; |
---|
| 446 | this.src = this.e.target || this.e.srcElement || null; |
---|
| 447 | this.src.tag = (this.src.tagName || this.src).toString().toLowerCase(); |
---|
| 448 | this.x = dd.Int(this.e.pageX || this.e.clientX || 0); |
---|
| 449 | this.y = dd.Int(this.e.pageY || this.e.clientY || 0); |
---|
| 450 | if (dd.ie) |
---|
| 451 | { |
---|
| 452 | this.x += dd.getScrollX() - (dd.ie && !dd.iemac)*1; |
---|
| 453 | this.y += dd.getScrollY() - (dd.ie && !dd.iemac)*1; |
---|
| 454 | } |
---|
| 455 | this.modifKey = this.e.modifiers? (this.e.modifiers&Event.SHIFT_MASK || this.e.modifiers&Event.CONTROL_MASK) |
---|
| 456 | : (this.e.shiftKey || this.e.ctrlKey || false); |
---|
| 457 | }; |
---|
| 458 | |
---|
| 459 | dd.recalc = function(d_x) |
---|
| 460 | { |
---|
| 461 | if (dd.elements) |
---|
| 462 | { |
---|
| 463 | var d_o, d_i = dd.elements.length; while(d_i--) |
---|
| 464 | { |
---|
| 465 | if (!(d_o = dd.elements[d_i]).is_image && d_o.div) |
---|
| 466 | { |
---|
| 467 | dd.getWH(d_o); |
---|
| 468 | if (d_o.div.pos_rel) |
---|
| 469 | { |
---|
| 470 | dd.getPageXY(d_o.div); |
---|
| 471 | var d_dx = dd.x - d_o.x, d_dy = dd.y - d_o.y; |
---|
| 472 | d_o.defx += d_dx; |
---|
| 473 | d_o.x += d_dx; |
---|
| 474 | d_o.defy += d_dy; |
---|
| 475 | d_o.y += d_dy; |
---|
| 476 | var d_p, d_j = d_o.children.length; while(d_j--) |
---|
| 477 | { |
---|
| 478 | if (!(d_p = d_o.children[d_j]).detached && (d_o != d_p.defparent || !(d_p.is_image && dd.getImg(d_p, d_p.oimg.name, 1)))) |
---|
| 479 | { |
---|
| 480 | d_p.defx += d_dx; |
---|
| 481 | d_p.defy += d_dy; |
---|
| 482 | d_p.moveBy(d_dx, d_dy); |
---|
| 483 | } |
---|
| 484 | } |
---|
| 485 | } |
---|
| 486 | } |
---|
| 487 | else if (d_o.is_image && !dd.op6 && !dd.n4) |
---|
| 488 | { |
---|
| 489 | if (dd.n6 && d_x && !d_o.defw) d_o.resizeTo(d_o.defw = dd.getImgW(d_o.oimg), d_o.defh = dd.getImgH(d_o.oimg)); |
---|
| 490 | var d_defx = d_o.defx, d_defy = d_o.defy; |
---|
| 491 | if (!(d_o.parent && d_o.parent != d_o.defparent) && (d_x || !d_o.detached || d_o.horizontal || d_o.vertical) && dd.getImg(d_o, d_o.oimg.name, 1)) |
---|
| 492 | d_o.moveBy(d_o.defx-d_defx, d_o.defy-d_defy); |
---|
| 493 | } |
---|
| 494 | } |
---|
| 495 | } |
---|
| 496 | }; |
---|
| 497 | |
---|
| 498 | |
---|
| 499 | |
---|
| 500 | function WINSZ(d_x) |
---|
| 501 | { |
---|
| 502 | if (d_x) |
---|
| 503 | { |
---|
| 504 | if (dd.n4 || dd.op6 && d_x&2) |
---|
| 505 | { |
---|
| 506 | dd.iW = innerWidth; |
---|
| 507 | dd.iH = innerHeight; |
---|
| 508 | if (dd.op6) setTimeout("WINSZ()", 0x1ff); |
---|
| 509 | } |
---|
| 510 | window.onresize = new Function('WINSZ();'); |
---|
| 511 | } |
---|
| 512 | else if ((dd.n4 || dd.op6) && (innerWidth != dd.iW || innerHeight != dd.iH)) location.reload(); |
---|
| 513 | else if (dd.op6) setTimeout("WINSZ()", 0x1ff); |
---|
| 514 | else if (!dd.n4) setTimeout('dd.recalc()', 0xa); |
---|
| 515 | } |
---|
| 516 | WINSZ(1); |
---|
| 517 | |
---|
| 518 | |
---|
| 519 | |
---|
| 520 | function DDObj(d_o, d_i) |
---|
| 521 | { |
---|
| 522 | this.id = d_o; |
---|
| 523 | this.cmd = ''; |
---|
| 524 | this.cpy_n = dd.getCmdVal(this, COPY); |
---|
| 525 | this.maxoffb = dd.getCmdVal(this, MAXOFFBOTTOM, 0, 1); |
---|
| 526 | this.maxoffl = dd.getCmdVal(this, MAXOFFLEFT, 0, 1); |
---|
| 527 | this.maxoffr = dd.getCmdVal(this, MAXOFFRIGHT, 0, 1); |
---|
| 528 | this.maxofft = dd.getCmdVal(this, MAXOFFTOP, 0, 1); |
---|
| 529 | var d_j = dd_cursors.length; while(d_j--) |
---|
| 530 | if (dd.getCmd(this, dd_cursors[d_j], 1)) this.cursor = dd_cursors[d_j].substring(2); |
---|
| 531 | this.clone = dd.getCmd(this, CLONE, 1); |
---|
| 532 | this.detach = dd.getCmd(this, DETACH_CHILDREN); |
---|
| 533 | this.scalable = dd.getCmd(this, SCALABLE, 1); |
---|
| 534 | this.horizontal = dd.getCmd(this, HORIZONTAL); |
---|
| 535 | this.noalt = dd.getCmd(this, NO_ALT, 1); |
---|
| 536 | this.nodrag = dd.getCmd(this, NO_DRAG); |
---|
| 537 | this.scroll = dd.getCmd(this, SCROLL, 1); |
---|
| 538 | this.resizable = dd.getCmd(this, RESIZABLE, 1); |
---|
| 539 | this.re_z = dd.getCmd(this, RESET_Z, 1); |
---|
| 540 | this.vertical = dd.getCmd(this, VERTICAL); |
---|
| 541 | this.maxw = dd.getCmdVal(this, MAXWIDTH, 1, 1); |
---|
| 542 | this.minw = Math.abs(dd.getCmdVal(this, MINWIDTH, 1, 1)); |
---|
| 543 | this.maxh = dd.getCmdVal(this, MAXHEIGHT, 1, 1); |
---|
| 544 | this.minh = Math.abs(dd.getCmdVal(this, MINHEIGHT, 1, 1)); |
---|
| 545 | |
---|
| 546 | this.name = this.id + (d_i || ''); |
---|
| 547 | this.oimg = dd.getImg(this, this.id, 1); |
---|
| 548 | this.is_image = !!this.oimg; |
---|
| 549 | this.copies = new Array(); |
---|
| 550 | this.children = new Array(); |
---|
| 551 | this.parent = this.original = null; |
---|
| 552 | if (this.oimg) |
---|
| 553 | { |
---|
| 554 | this.id += 'div' + (d_i || ''); |
---|
| 555 | this.w = dd.getImgW(this.oimg); |
---|
| 556 | this.h = dd.getImgH(this.oimg); |
---|
| 557 | this.dw = this.dh = 0; |
---|
| 558 | this.defz = dd.Int(dd.getCssProp(this.oimg, 'z-index','zIndex','zIndex')) || 1; |
---|
| 559 | this.defsrc = this.src = this.oimg.src; |
---|
| 560 | this.htm = '<img name="' + this.id + 'NImG"'+ |
---|
| 561 | ' src="' + this.oimg.src + '" '+ |
---|
| 562 | 'width="' + this.w + '" height="' + this.h + '">'; |
---|
| 563 | this.t_htm = '<div id="' + this.id + |
---|
| 564 | '" style="position:absolute;'+ |
---|
| 565 | 'left:' + (this.cssx = this.x = this.defx) + 'px;'+ |
---|
| 566 | 'top:' + (this.cssy = this.y = this.defy) + 'px;'+ |
---|
| 567 | 'width:' + this.w + 'px;'+ |
---|
| 568 | 'height:' + this.h + 'px;">'+ |
---|
| 569 | this.htm + '<\/div>'; |
---|
| 570 | } |
---|
| 571 | else |
---|
| 572 | { |
---|
| 573 | if (!!(this.div = dd.getDiv(this.id)) && typeof this.div.style != "undefined") this.css = this.div.style; |
---|
| 574 | dd.getWH(this); |
---|
| 575 | if (this.div) |
---|
| 576 | { |
---|
| 577 | this.div.ddObj = this; |
---|
| 578 | this.div.pos_rel = ((this.div.parentNode? this.div.parentNode.tagName : this.div.parentElement? this.div.parentElement.tagName : '').toString().toLowerCase().indexOf('body') < 0); |
---|
| 579 | } |
---|
| 580 | dd.getPageXY(this.div); |
---|
| 581 | this.defx = this.x = dd.x; |
---|
| 582 | this.defy = this.y = dd.y; |
---|
| 583 | dd.getCssXY(this); |
---|
| 584 | this.defz = dd.Int(dd.getCssProp(this.div, 'z-index','zIndex','zIndex')); |
---|
| 585 | } |
---|
| 586 | this.defw = this.w || 0; |
---|
| 587 | this.defh = this.h || 0; |
---|
| 588 | } |
---|
| 589 | |
---|
| 590 | DDObj.prototype.moveBy = function(d_x, d_y, d_kds, d_o) |
---|
| 591 | { |
---|
| 592 | if (!this.div) return; |
---|
| 593 | this.x += (d_x = dd.Int(d_x)); |
---|
| 594 | this.y += (d_y = dd.Int(d_y)); |
---|
| 595 | if (!d_kds || this.is_image || this.parent != this.defparent) |
---|
| 596 | { |
---|
| 597 | (d_o = this.css || this.div).left = (this.cssx += d_x) + dd.px; |
---|
| 598 | d_o.top = (this.cssy += d_y) + dd.px; |
---|
| 599 | } |
---|
| 600 | var d_i = this.children.length; while (d_i--) |
---|
| 601 | { |
---|
| 602 | if (!(d_o = this.children[d_i]).detached) d_o.moveBy(d_x, d_y, 1); |
---|
| 603 | d_o.defx += d_x; |
---|
| 604 | d_o.defy += d_y; |
---|
| 605 | } |
---|
| 606 | }; |
---|
| 607 | |
---|
| 608 | DDObj.prototype.moveTo = function(d_x, d_y) |
---|
| 609 | { |
---|
| 610 | this.moveBy(dd.Int(d_x)-this.x, dd.Int(d_y)-this.y); |
---|
| 611 | }; |
---|
| 612 | |
---|
| 613 | DDObj.prototype.hide = function(d_m, d_o, d_p) |
---|
| 614 | { |
---|
| 615 | if (this.div && this.visible) |
---|
| 616 | { |
---|
| 617 | d_p = this.css || this.div; |
---|
| 618 | if (d_m && !dd.n4) |
---|
| 619 | { |
---|
| 620 | this.display = dd.getCssProp(this.div, "display", "display", "display"); |
---|
| 621 | if (this.oimg) |
---|
| 622 | { |
---|
| 623 | this.oimg.display = dd.getCssProp(this.oimg, "display", "display", "display"); |
---|
| 624 | this.oimg.style.display = "none"; |
---|
| 625 | } |
---|
| 626 | d_p.display = "none"; |
---|
| 627 | dd.recalc(); |
---|
| 628 | } |
---|
| 629 | else d_p.visibility = "hidden"; |
---|
| 630 | } |
---|
| 631 | this.visible = false; |
---|
| 632 | var d_i = this.children.length; while (d_i--) |
---|
| 633 | if (!(d_o = this.children[d_i]).detached) d_o.hide(d_m); |
---|
| 634 | }; |
---|
| 635 | |
---|
| 636 | DDObj.prototype.show = function(d_o, d_p) |
---|
| 637 | { |
---|
| 638 | if (this.div) |
---|
| 639 | { |
---|
| 640 | d_p = this.css || this.div; |
---|
| 641 | if (d_p.display && d_p.display == "none") |
---|
| 642 | { |
---|
| 643 | d_p.display = this.display || "block"; |
---|
| 644 | if (this.oimg) this.oimg.style.display = this.oimg.display || "inline"; |
---|
| 645 | dd.recalc(); |
---|
| 646 | } |
---|
| 647 | else d_p.visibility = "visible"; |
---|
| 648 | } |
---|
| 649 | this.visible = true; |
---|
| 650 | var d_i = this.children.length; while (d_i--) |
---|
| 651 | if (!(d_o = this.children[d_i]).detached) d_o.show(); |
---|
| 652 | }; |
---|
| 653 | |
---|
| 654 | DDObj.prototype.resizeTo = function(d_w, d_h, d_o) |
---|
| 655 | { |
---|
| 656 | if (!this.div) return; |
---|
| 657 | d_w = (this.w = dd.Int(d_w))-this.dw; |
---|
| 658 | d_h = (this.h = dd.Int(d_h))-this.dh; |
---|
| 659 | if (dd.n4) |
---|
| 660 | { |
---|
| 661 | this.div.resizeTo(d_w, d_h); |
---|
| 662 | if (this.is_image) |
---|
| 663 | { |
---|
| 664 | this.write('<img src="' + this.src + '" width="' + d_w + '" height="' + d_h + '">'); |
---|
| 665 | (this.nimg = this.div.document.images[0]).src = this.src; |
---|
| 666 | } |
---|
| 667 | } |
---|
| 668 | else if (typeof this.css.pixelWidth != "undefined") |
---|
| 669 | { |
---|
| 670 | this.css.pixelWidth = d_w; |
---|
| 671 | this.css.pixelHeight = d_h; |
---|
| 672 | if (this.is_image) |
---|
| 673 | { |
---|
| 674 | (d_o = this.nimg.style).pixelWidth = d_w; |
---|
| 675 | d_o.pixelHeight = d_h; |
---|
| 676 | } |
---|
| 677 | } |
---|
| 678 | else |
---|
| 679 | { |
---|
| 680 | this.css.width = d_w + dd.px; |
---|
| 681 | this.css.height = d_h + dd.px; |
---|
| 682 | if (this.is_image) |
---|
| 683 | { |
---|
| 684 | (d_o = this.nimg).width = d_w; |
---|
| 685 | d_o.height = d_h; |
---|
| 686 | if (!d_o.complete) d_o.src = this.src; |
---|
| 687 | } |
---|
| 688 | } |
---|
| 689 | }; |
---|
| 690 | |
---|
| 691 | DDObj.prototype.resizeBy = function(d_dw, d_dh) |
---|
| 692 | { |
---|
| 693 | this.resizeTo(this.w+dd.Int(d_dw), this.h+dd.Int(d_dh)); |
---|
| 694 | }; |
---|
| 695 | |
---|
| 696 | DDObj.prototype.swapImage = function(d_x, d_cp) |
---|
| 697 | { |
---|
| 698 | if (!this.nimg) return; |
---|
| 699 | this.nimg.src = d_x; |
---|
| 700 | this.src = this.nimg.src; |
---|
| 701 | if (d_cp) |
---|
| 702 | { |
---|
| 703 | var d_i = this.copies.length; while (d_i--) |
---|
| 704 | this.copies[d_i].src = this.copies[d_i].nimg.src = this.nimg.src; |
---|
| 705 | } |
---|
| 706 | }; |
---|
| 707 | |
---|
| 708 | DDObj.prototype.setBgColor = function(d_x) |
---|
| 709 | { |
---|
| 710 | if (dd.n4 && this.div) this.div.bgColor = d_x; |
---|
| 711 | else if (this.css) this.css.background = d_x; |
---|
| 712 | this.bgColor = d_x; |
---|
| 713 | }; |
---|
| 714 | |
---|
| 715 | DDObj.prototype.write = function(d_x, d_o) |
---|
| 716 | { |
---|
| 717 | this.text = d_x; |
---|
| 718 | if (!this.div) return; |
---|
| 719 | if (dd.n4) |
---|
| 720 | { |
---|
| 721 | (d_o = this.div.document).open(); |
---|
| 722 | d_o.write(d_x); |
---|
| 723 | d_o.close(); |
---|
| 724 | dd.getWH(this); |
---|
| 725 | } |
---|
| 726 | else if (!dd.op6) |
---|
| 727 | { |
---|
| 728 | this.css.height = 'auto'; |
---|
| 729 | this.div.innerHTML = d_x; |
---|
| 730 | if (!dd.ie4) dd.recalc(); |
---|
| 731 | if (dd.ie4 || dd.n6) setTimeout('dd.recalc();', 0); // n6.0: recalc twice |
---|
| 732 | } |
---|
| 733 | }; |
---|
| 734 | |
---|
| 735 | DDObj.prototype.copy = function(d_n, d_p) |
---|
| 736 | { |
---|
| 737 | if (!this.oimg) return; |
---|
| 738 | d_n = d_n || 1; |
---|
| 739 | while (d_n--) |
---|
| 740 | { |
---|
| 741 | var d_l = this.copies.length, |
---|
| 742 | d_o = new DDObj(this.name+this.cmd, d_l+1); |
---|
| 743 | if (dd.n4) |
---|
| 744 | { |
---|
| 745 | d_o.id = (d_p = new Layer(d_o.w)).name; |
---|
| 746 | d_p.clip.height = d_o.h; |
---|
| 747 | d_p.visibility = 'show'; |
---|
| 748 | (d_p = d_p.document).open(); |
---|
| 749 | d_p.write(d_o.htm); |
---|
| 750 | d_p.close(); |
---|
| 751 | } |
---|
| 752 | else if (dd.db.insertAdjacentHTML) dd.db.insertAdjacentHTML("AfterBegin", d_o.t_htm); |
---|
| 753 | else if (document.createElement && dd.db && dd.db.appendChild) |
---|
| 754 | { |
---|
| 755 | dd.db.appendChild(d_p = document.createElement('div')); |
---|
| 756 | d_p.innerHTML = d_o.htm; |
---|
| 757 | d_p.id = d_o.id; |
---|
| 758 | d_p.style.position = 'absolute'; |
---|
| 759 | d_p.style.width = d_o.w + 'px'; |
---|
| 760 | d_p.style.height = d_o.h + 'px'; |
---|
| 761 | } |
---|
| 762 | else if (dd.db && dd.db.innerHTML) dd.db.innerHTML += d_o.t_htm; |
---|
| 763 | d_o.defz = this.defz+1+d_l; |
---|
| 764 | dd.addProps(d_o); |
---|
| 765 | d_o.original = this; |
---|
| 766 | dd.addElt(d_o, this); |
---|
| 767 | if (this.parent) |
---|
| 768 | { |
---|
| 769 | this.parent.addChild(d_o, this.detached); |
---|
| 770 | d_o.defparent = this.defparent; |
---|
| 771 | } |
---|
| 772 | d_o.moveTo(d_o.defx = this.defx, d_o.defy = this.defy); |
---|
| 773 | if (dd.n4) d_o.defsrc = d_o.src = this.defsrc; |
---|
| 774 | d_o.swapImage(this.src); |
---|
| 775 | } |
---|
| 776 | }; |
---|
| 777 | |
---|
| 778 | DDObj.prototype.addChild = function(d_kd, detach, defp) |
---|
| 779 | { |
---|
| 780 | if (typeof d_kd != "object") d_kd = dd.elements[d_kd]; |
---|
| 781 | if (d_kd.parent && d_kd.parent == this || d_kd == this || !d_kd.is_image && d_kd.defparent && !defp) return; |
---|
| 782 | |
---|
| 783 | this.children[this.children.length] = this.children[d_kd.name] = d_kd; |
---|
| 784 | d_kd.detached = detach || 0; |
---|
| 785 | if (defp) d_kd.defparent = this; |
---|
| 786 | else if (this == d_kd.defparent && d_kd.is_image) dd.getImg(this, d_kd.oimg.name, 1); |
---|
| 787 | if (!d_kd.defparent || this != d_kd.defparent) |
---|
| 788 | { |
---|
| 789 | d_kd.defx = d_kd.x; |
---|
| 790 | d_kd.defy = d_kd.y; |
---|
| 791 | } |
---|
| 792 | if (!detach) |
---|
| 793 | { |
---|
| 794 | d_kd.defz = d_kd.defz+this.defz-(d_kd.parent? d_kd.parent.defz : 0)+(!d_kd.is_image*1); |
---|
| 795 | d_kd.setZ(d_kd.z+this.z-(d_kd.parent? d_kd.parent.z : 0)+(!d_kd.is_image*1), 1); |
---|
| 796 | } |
---|
| 797 | if (d_kd.parent) d_kd.parent._removeChild(d_kd, 1); |
---|
| 798 | d_kd.parent = this; |
---|
| 799 | }; |
---|
| 800 | |
---|
| 801 | DDObj.prototype._removeChild = function(d_kd, d_newp) |
---|
| 802 | { |
---|
| 803 | if (typeof d_kd != "object") d_kd = this.children[d_kd]; |
---|
| 804 | var d_oc = this.children, d_nc = new Array(); |
---|
| 805 | for (var d_i = 0; d_i < d_oc.length; d_i++) |
---|
| 806 | if (d_oc[d_i] != d_kd) d_nc[d_nc.length] = d_oc[d_i]; |
---|
| 807 | this.children = d_nc; |
---|
| 808 | d_kd.parent = null; |
---|
| 809 | if (!d_newp) |
---|
| 810 | { |
---|
| 811 | d_kd.detached = d_kd.defp = 0; |
---|
| 812 | if (d_kd.is_image) dd.getImg(d_kd, d_kd.oimg.name, 1); |
---|
| 813 | } |
---|
| 814 | }; |
---|
| 815 | |
---|
| 816 | DDObj.prototype.attachChild = function(d_kd) |
---|
| 817 | { |
---|
| 818 | (d_kd = (typeof d_kd != "object")? this.children[d_kd]: d_kd).detached = 0; |
---|
| 819 | d_kd.setZ(d_kd.defz + this.z-this.defz, 1); |
---|
| 820 | }; |
---|
| 821 | |
---|
| 822 | DDObj.prototype.detachChild = function(d_kd) |
---|
| 823 | { |
---|
| 824 | (d_kd = (typeof d_kd != "object")? this.children[d_kd]: d_kd).detached = 1; |
---|
| 825 | }; |
---|
| 826 | |
---|
| 827 | DDObj.prototype.setZ = function(d_x, d_kds) |
---|
| 828 | { |
---|
| 829 | if (d_kds) |
---|
| 830 | { |
---|
| 831 | var d_dz = d_x-this.z, |
---|
| 832 | d_i = this.children.length; while (d_i--) |
---|
| 833 | if (!(d_o = this.children[d_i]).detached) d_o.setZ(d_o.z+d_dz, 1); |
---|
| 834 | } |
---|
| 835 | dd.z = Math.max(dd.z, this.z = this.div? ((this.css || this.div).zIndex = d_x) : 0); |
---|
| 836 | }; |
---|
| 837 | |
---|
| 838 | DDObj.prototype.maximizeZ = function() |
---|
| 839 | { |
---|
| 840 | this.setZ(dd.z+1, 1); |
---|
| 841 | }; |
---|
| 842 | |
---|
| 843 | DDObj.prototype._resetZ = function(d_o) |
---|
| 844 | { |
---|
| 845 | if (this.re_z || dd.re_z) |
---|
| 846 | { |
---|
| 847 | this.setZ(this.defz); |
---|
| 848 | var d_i = this.children.length; while (d_i--) |
---|
| 849 | if (!(d_o = this.children[d_i]).detached) d_o.setZ(d_o.defz); |
---|
| 850 | } |
---|
| 851 | }; |
---|
| 852 | |
---|
| 853 | DDObj.prototype.setOpacity = function(d_x) |
---|
| 854 | { |
---|
| 855 | this.opacity = d_x; |
---|
| 856 | this._setOpaRel(1.0, 1); |
---|
| 857 | }; |
---|
| 858 | DDObj.prototype._setOpaRel = function(d_x, d_kd, d_y, d_o) |
---|
| 859 | { |
---|
| 860 | if(this.css && (this.diaphan || d_kd)) |
---|
| 861 | { |
---|
| 862 | d_y = this.opacity*d_x; |
---|
| 863 | if(typeof this.css.MozOpacity != dd_u) this.css.MozOpacity = d_y; |
---|
| 864 | else if(typeof this.css.filter != dd_u) |
---|
| 865 | this.css.filter = "Alpha(opacity="+parseInt(100*d_y)+")"; |
---|
| 866 | else this.css.opacity = d_y; |
---|
| 867 | var d_i = this.children.length; while(d_i--) |
---|
| 868 | if(!(d_o = this.children[d_i]).detached) d_o._setOpaRel(d_x, 1); |
---|
| 869 | } |
---|
| 870 | }; |
---|
| 871 | |
---|
| 872 | DDObj.prototype.setCursor = function(d_x) |
---|
| 873 | { |
---|
| 874 | this._setCrs(this.cursor = (d_x.indexOf('c:')+1)? d_x.substring(2) : d_x); |
---|
| 875 | }; |
---|
| 876 | |
---|
| 877 | DDObj.prototype._setCrs = function(d_x) |
---|
| 878 | { |
---|
| 879 | if (this.css) this.css.cursor = ((!dd.ie || dd.iemac) && d_x == 'hand')? 'pointer' : d_x; |
---|
| 880 | }; |
---|
| 881 | |
---|
| 882 | DDObj.prototype.setDraggable = function(d_x) |
---|
| 883 | { |
---|
| 884 | this.nodrag = !d_x*1; |
---|
| 885 | this._setCrs(d_x? this.cursor : 'auto'); |
---|
| 886 | }; |
---|
| 887 | |
---|
| 888 | DDObj.prototype.setResizable = function(d_x) |
---|
| 889 | { |
---|
| 890 | this.resizable = d_x*1; |
---|
| 891 | if (d_x) this.scalable = 0; |
---|
| 892 | }; |
---|
| 893 | |
---|
| 894 | DDObj.prototype.setScalable = function(d_x) |
---|
| 895 | { |
---|
| 896 | this.scalable = d_x*1; |
---|
| 897 | if (d_x) this.resizable = 0; |
---|
| 898 | }; |
---|
| 899 | |
---|
| 900 | DDObj.prototype.del = function(d_os, d_o) |
---|
| 901 | { |
---|
| 902 | if (this.parent && this.parent._removeChild) this.parent._removeChild(this); |
---|
| 903 | if (this.original) |
---|
| 904 | { |
---|
| 905 | this.hide(); |
---|
| 906 | if (this.original.copies) |
---|
| 907 | { |
---|
| 908 | d_os = new Array(); |
---|
| 909 | for (var d_i = 0; d_i < this.original.copies.length; d_i++) |
---|
| 910 | if ((d_o = this.original.copies[d_i]) != this) d_os[d_os.length] = d_os[d_o.name] = d_o; |
---|
| 911 | this.original.copies = d_os; |
---|
| 912 | } |
---|
| 913 | } |
---|
| 914 | else if (this.is_image) |
---|
| 915 | { |
---|
| 916 | this.hide(); |
---|
| 917 | if (this.oimg) |
---|
| 918 | { |
---|
| 919 | if (dd.n4) this.oimg.src = this.defsrc; |
---|
| 920 | else this.oimg.style.visibility = 'visible'; |
---|
| 921 | } |
---|
| 922 | } |
---|
| 923 | else if (this.moveTo) |
---|
| 924 | { |
---|
| 925 | if (this.css) this.css.cursor = 'default'; |
---|
| 926 | this.moveTo(this.defx, this.defy); |
---|
| 927 | this.resizeTo(this.defw, this.defh); |
---|
| 928 | } |
---|
| 929 | d_os = new Array(); |
---|
| 930 | for (var d_i = 0; d_i < dd.elements.length; d_i++) |
---|
| 931 | { |
---|
| 932 | if ((d_o = dd.elements[d_i]) != this) d_os[d_os.length] = d_os[d_o.name] = d_o; |
---|
| 933 | else d_o._free(); |
---|
| 934 | } |
---|
| 935 | dd.elements = d_os; |
---|
| 936 | if (!dd.op6 && !dd.n4) dd.recalc(); |
---|
| 937 | }; |
---|
| 938 | |
---|
| 939 | DDObj.prototype._free = function() |
---|
| 940 | { |
---|
| 941 | for (var d_i in this) |
---|
| 942 | this[d_i] = null; |
---|
| 943 | dd.elements[this.name] = null; |
---|
| 944 | }; |
---|
| 945 | |
---|
| 946 | |
---|
| 947 | |
---|
| 948 | dd.n4RectVis = function(vis) |
---|
| 949 | { |
---|
| 950 | for (var d_i = 4; d_i--;) |
---|
| 951 | { |
---|
| 952 | dd.rectI[d_i].visibility = dd.rectA[d_i].visibility = vis? 'show' : 'hide'; |
---|
| 953 | if (vis) dd.rectI[d_i].zIndex = dd.rectA[d_i].zIndex = dd.z+2; |
---|
| 954 | } |
---|
| 955 | }; |
---|
| 956 | |
---|
| 957 | dd.n4RectPos = function(d_o, d_x, d_y, d_w, d_h) |
---|
| 958 | { |
---|
| 959 | d_o.x = d_x; |
---|
| 960 | d_o.y = d_y; |
---|
| 961 | d_o.clip.width = d_w; |
---|
| 962 | d_o.clip.height = d_h; |
---|
| 963 | }; |
---|
| 964 | |
---|
| 965 | // NN4: draw img resize rectangle |
---|
| 966 | dd.n4Rect = function(d_w, d_h) |
---|
| 967 | { |
---|
| 968 | if (!dd.rectI) |
---|
| 969 | { |
---|
| 970 | dd.rectI = new Array(); |
---|
| 971 | dd.rectA = new Array(); |
---|
| 972 | } |
---|
| 973 | if (!dd.rectI[0]) |
---|
| 974 | { |
---|
| 975 | for (var d_i = 4; d_i--;) |
---|
| 976 | { |
---|
| 977 | (dd.rectI[d_i] = new Layer(1)).bgColor = '#000000'; |
---|
| 978 | (dd.rectA[d_i] = new Layer(1)).bgColor = '#ffffff'; |
---|
| 979 | } |
---|
| 980 | } |
---|
| 981 | if (!dd.rectI[0].visibility || dd.rectI[0].visibility == 'hide') dd.n4RectVis(1); |
---|
| 982 | dd.obj.w = d_w; |
---|
| 983 | dd.obj.h = d_h; |
---|
| 984 | for (var d_i = 4; d_i--;) |
---|
| 985 | { |
---|
| 986 | dd.n4RectPos(dd.rectI[d_i], dd.obj.x + (!(d_i-1)? (dd.obj.w-1) : 0), dd.obj.y + (!(d_i-2)? (dd.obj.h-1) : 0), d_i&1 || dd.obj.w, !(d_i&1) || dd.obj.h); |
---|
| 987 | dd.n4RectPos(dd.rectA[d_i], !(d_i-1)? dd.rectI[1].x+1 : (dd.obj.x-1), !(d_i-2)? dd.rectI[2].y+1 : (dd.obj.y-1), d_i&1 || dd.obj.w+2, !(d_i&1) || dd.obj.h+2); |
---|
| 988 | } |
---|
| 989 | }; |
---|
| 990 | |
---|
| 991 | dd.reszTo = function(d_w, d_h) |
---|
| 992 | { |
---|
| 993 | if (dd.n4 && dd.obj.is_image) dd.n4Rect(d_w, d_h); |
---|
| 994 | else dd.obj.resizeTo(d_w, d_h); |
---|
| 995 | }; |
---|
| 996 | |
---|
| 997 | dd.embedVis = function(d_vis) |
---|
| 998 | { |
---|
| 999 | var d_o = new Array('iframe', 'applet', 'embed', 'object'); |
---|
| 1000 | var d_i = d_o.length; while (d_i--) |
---|
| 1001 | { |
---|
| 1002 | var d_p = dd.ie? document.all.tags(d_o[d_i]) : document.getElementsByTagName? document.getElementsByTagName(d_o[d_i]) : null; |
---|
| 1003 | if (d_p) |
---|
| 1004 | { |
---|
| 1005 | var d_j = d_p.length; while (d_j--) |
---|
| 1006 | { |
---|
| 1007 | var d_q = d_p[d_j]; |
---|
| 1008 | while (d_q.offsetParent || d_q.parentNode) |
---|
| 1009 | { |
---|
| 1010 | if ((d_q = d_q.parentNode || d_q.offsetParent || null) == dd.obj.div) |
---|
| 1011 | { |
---|
| 1012 | d_p[d_j].style.visibility = d_vis; |
---|
| 1013 | break; |
---|
| 1014 | } |
---|
| 1015 | } |
---|
| 1016 | } |
---|
| 1017 | } |
---|
| 1018 | } |
---|
| 1019 | }; |
---|
| 1020 | |
---|
| 1021 | dd.maxOffX = function(d_x, d_y) |
---|
| 1022 | { |
---|
| 1023 | return ( |
---|
| 1024 | (dd.obj.maxoffl+1 && (d_y = dd.obj.defx-dd.obj.maxoffl)-d_x > 0 |
---|
| 1025 | || dd.obj.maxoffr+1 && (d_y = dd.obj.defx+dd.obj.maxoffr)-d_x < 0)? d_y |
---|
| 1026 | : d_x |
---|
| 1027 | ); |
---|
| 1028 | }; |
---|
| 1029 | |
---|
| 1030 | dd.maxOffY = function(d_x, d_y) |
---|
| 1031 | { |
---|
| 1032 | return ( |
---|
| 1033 | (dd.obj.maxofft+1 && (d_y = dd.obj.defy-dd.obj.maxofft)-d_x > 0 |
---|
| 1034 | || dd.obj.maxoffb+1 && (d_y = dd.obj.defy+dd.obj.maxoffb)-d_x < 0)? d_y |
---|
| 1035 | : d_x |
---|
| 1036 | ); |
---|
| 1037 | }; |
---|
| 1038 | |
---|
| 1039 | dd.inWndW = function(d_x, d_y) |
---|
| 1040 | { |
---|
| 1041 | var d_wx = dd.getScrollX(), |
---|
| 1042 | d_ww = dd.getWndW(); |
---|
| 1043 | return ( |
---|
| 1044 | ((d_y = d_wx+2)-d_x > 0) || ((d_y = d_wx+d_ww+dd.obj.w-2)-d_x < 0)? d_y |
---|
| 1045 | : d_x |
---|
| 1046 | ); |
---|
| 1047 | }; |
---|
| 1048 | |
---|
| 1049 | dd.inWndH = function(d_x, d_y) |
---|
| 1050 | { |
---|
| 1051 | var d_wy = dd.getScrollY(), |
---|
| 1052 | d_wh = dd.getWndH(); |
---|
| 1053 | return ( |
---|
| 1054 | ((d_y = d_wy+2)-d_x > 0) || ((d_y = d_wy+d_wh+dd.obj.h-2)-d_x < 0)? d_y |
---|
| 1055 | : d_x |
---|
| 1056 | ); |
---|
| 1057 | }; |
---|
| 1058 | |
---|
| 1059 | // These two funcs limit the size of element when mouseresized. |
---|
| 1060 | // Implemented 22.5.2003 by Gregor Lï¿œtolf <gregor@milou.ch>, modified by Walter Zorn |
---|
| 1061 | dd.limW = function(d_w) |
---|
| 1062 | { |
---|
| 1063 | return ( |
---|
| 1064 | (dd.obj.minw-d_w > 0)? dd.obj.minw |
---|
| 1065 | : (dd.obj.maxw > 0 && dd.obj.maxw-d_w < 0)? dd.obj.maxw |
---|
| 1066 | : d_w |
---|
| 1067 | ); |
---|
| 1068 | }; |
---|
| 1069 | |
---|
| 1070 | dd.limH = function(d_h) |
---|
| 1071 | { |
---|
| 1072 | return ( |
---|
| 1073 | (dd.obj.minh-d_h > 0)? dd.obj.minh |
---|
| 1074 | : (dd.obj.maxh > 0 && dd.obj.maxh-d_h < 0)? dd.obj.maxh |
---|
| 1075 | : d_h |
---|
| 1076 | ); |
---|
| 1077 | }; |
---|
| 1078 | |
---|
| 1079 | |
---|
| 1080 | // Optional autoscroll-page functionality. Courtesy Cedric Savarese. |
---|
| 1081 | // Implemented by Walter Zorn |
---|
| 1082 | function DDScroll() |
---|
| 1083 | { |
---|
| 1084 | if (!dd.obj || !dd.obj.scroll && !dd.scroll || dd.op || dd.ie4 || dd.whratio) |
---|
| 1085 | { |
---|
| 1086 | dd.scrx = dd.scry = 0; |
---|
| 1087 | return; |
---|
| 1088 | } |
---|
| 1089 | var d_bnd = 0x1c, |
---|
| 1090 | d_wx = dd.getScrollX(), d_wy = dd.getScrollY(); |
---|
| 1091 | if (dd.msmoved) |
---|
| 1092 | { |
---|
| 1093 | var d_ww = dd.getWndW(), d_wh = dd.getWndH(), d_y; |
---|
| 1094 | dd.scrx = ((d_y = dd.e.x-d_ww-d_wx+d_bnd) > 0)? (d_y>>=2)*d_y |
---|
| 1095 | : ((d_y = d_wx+d_bnd-dd.e.x) > 0)? -(d_y>>=2)*d_y |
---|
| 1096 | : 0; |
---|
| 1097 | dd.scry = ((d_y = dd.e.y-d_wh-d_wy+d_bnd) > 0)? (d_y>>=2)*d_y |
---|
| 1098 | : ((d_y = d_wy+d_bnd-dd.e.y) > 0)? -(d_y>>=2)*d_y |
---|
| 1099 | : 0; |
---|
| 1100 | } |
---|
| 1101 | if (dd.scrx || dd.scry) |
---|
| 1102 | { |
---|
| 1103 | window.scrollTo( |
---|
| 1104 | d_wx + (dd.scrx = dd.obj.is_resized? dd.limW(dd.obj.w+dd.scrx)-dd.obj.w : dd.obj.vertical? 0 : (dd.maxOffX(dd.obj.x+dd.scrx)-dd.obj.x)), |
---|
| 1105 | d_wy + (dd.scry = dd.obj.is_resized? dd.limH(dd.obj.h+dd.scry)-dd.obj.h : dd.obj.horizontal? 0 : (dd.maxOffY(dd.obj.y+dd.scry)-dd.obj.y)) |
---|
| 1106 | ); |
---|
| 1107 | dd.obj.is_dragged? dd.obj.moveTo(dd.obj.x+dd.getScrollX()-d_wx, dd.obj.y+dd.getScrollY()-d_wy) |
---|
| 1108 | : dd.reszTo(dd.obj.w+dd.getScrollX()-d_wx, dd.obj.h+dd.getScrollY()-d_wy); |
---|
| 1109 | } |
---|
| 1110 | dd.msmoved = 0; |
---|
| 1111 | window.setTimeout('DDScroll()', 0x33); |
---|
| 1112 | } |
---|
| 1113 | |
---|
| 1114 | |
---|
| 1115 | |
---|
| 1116 | function PICK(d_ev) |
---|
| 1117 | { |
---|
| 1118 | dd.e = new dd.evt(d_ev); |
---|
| 1119 | if (dd.e.x >= dd.getWndW()+dd.getScrollX() || dd.e.y >= dd.getWndH()+dd.getScrollY()) return true; // on scrollbar |
---|
| 1120 | var d_o, d_cmp = -1, d_i = dd.elements.length; while (d_i--) |
---|
| 1121 | { |
---|
| 1122 | d_o = dd.elements[d_i]; |
---|
| 1123 | if (dd.n4 && dd.e.but > 1 && dd.e.src == d_o.oimg && !d_o.clone) return false; |
---|
| 1124 | if (d_o.visible && dd.e.but <= 1 && !d_o.nodrag && dd.e.x >= d_o.x && dd.e.x <= d_o.x+d_o.w && dd.e.y >= d_o.y && dd.e.y <= d_o.y+d_o.h) |
---|
| 1125 | { |
---|
| 1126 | if (d_o.z > d_cmp && dd.e.src.tag.indexOf('input') < 0 && dd.e.src.tag.indexOf('textarea') < 0 && dd.e.src.tag.indexOf('select') < 0 && dd.e.src.tag.indexOf('option') < 0) |
---|
| 1127 | { |
---|
| 1128 | d_cmp = d_o.z; |
---|
| 1129 | dd.obj = d_o; |
---|
| 1130 | } |
---|
| 1131 | } |
---|
| 1132 | } |
---|
| 1133 | if (dd.obj) |
---|
| 1134 | { |
---|
| 1135 | dd.e.e.cancelBubble = true; |
---|
| 1136 | var d_rsz = dd.e.modifKey && (dd.obj.resizable || dd.obj.scalable); |
---|
| 1137 | if (dd.op && !dd.op6) |
---|
| 1138 | { |
---|
| 1139 | (d_o = document.getElementById('OpBlUr')).style.pixelLeft = dd.e.x; |
---|
| 1140 | d_o.style.pixelTop = dd.e.y; |
---|
| 1141 | (d_o = d_o.children[0].children[0]).focus(); |
---|
| 1142 | d_o.blur(); |
---|
| 1143 | } |
---|
| 1144 | else if (dd.ie && !dd.ie4) |
---|
| 1145 | { |
---|
| 1146 | if (document.selection && document.selection.empty) document.selection.empty(); |
---|
| 1147 | dd.db.onselectstart = function() |
---|
| 1148 | { |
---|
| 1149 | event.returnValue = false; |
---|
| 1150 | }; |
---|
| 1151 | } |
---|
| 1152 | if (d_rsz) |
---|
| 1153 | { |
---|
| 1154 | dd.obj._setCrs('se-resize'); |
---|
| 1155 | dd.obj.is_resized = 1; |
---|
| 1156 | dd.whratio = dd.obj.scalable? dd.obj.defw/dd.obj.defh : 0; |
---|
| 1157 | if (dd.ie) |
---|
| 1158 | { |
---|
| 1159 | if (dd.ie4) |
---|
| 1160 | { |
---|
| 1161 | window.dd_x = dd.getScrollX(); |
---|
| 1162 | window.dd_y = dd.getScrollY(); |
---|
| 1163 | } |
---|
| 1164 | setTimeout( |
---|
| 1165 | 'if (dd.obj && document.selection && document.selection.empty)'+ |
---|
| 1166 | '{'+ |
---|
| 1167 | 'document.selection.empty();'+ |
---|
| 1168 | 'if (dd.ie4) window.scrollTo(window.dd_x, window.dd_y);'+ |
---|
| 1169 | '}' |
---|
| 1170 | ,0); |
---|
| 1171 | } |
---|
| 1172 | dd.setEvtHdl(1, RESIZE); |
---|
| 1173 | dd.reszTo(dd.obj.w, dd.obj.h); |
---|
| 1174 | } |
---|
| 1175 | else if (!dd.obj.nodrag) |
---|
| 1176 | { |
---|
| 1177 | dd.obj.is_dragged = 1; |
---|
| 1178 | dd.setEvtHdl(1, DRAG); |
---|
| 1179 | } |
---|
| 1180 | dd.setEvtHdl(2, DROP); |
---|
| 1181 | dd.embedVis('hidden'); |
---|
| 1182 | dd.obj.maximizeZ(); |
---|
| 1183 | dd.ofx = dd.obj.x+dd.obj.w-dd.e.x; |
---|
| 1184 | dd.ofy = dd.obj.y+dd.obj.h-dd.e.y; |
---|
| 1185 | if (window.my_PickFunc) my_PickFunc(); |
---|
| 1186 | DDScroll(); |
---|
| 1187 | return !( |
---|
| 1188 | dd.obj.is_resized |
---|
| 1189 | || dd.n4 && dd.obj.is_image |
---|
| 1190 | || dd.n6 || dd.w3c |
---|
| 1191 | ); |
---|
| 1192 | } |
---|
| 1193 | if (dd.downFunc) return dd.downFunc(d_ev); |
---|
| 1194 | return true; |
---|
| 1195 | } |
---|
| 1196 | |
---|
| 1197 | function DRAG(d_ev) |
---|
| 1198 | { |
---|
| 1199 | if (!dd.obj || !dd.obj.visible) return true; |
---|
| 1200 | if (dd.ie4 || dd.w3c || dd.n6 || dd.obj.children.length > 0xf) |
---|
| 1201 | { |
---|
| 1202 | if (dd.wait) return false; |
---|
| 1203 | dd.wait = 1; |
---|
| 1204 | setTimeout('dd.wait = 0;', 5); |
---|
| 1205 | } |
---|
| 1206 | dd.e = new dd.evt(d_ev); |
---|
| 1207 | if (dd.ie && !dd.e.but) |
---|
| 1208 | { |
---|
| 1209 | DROP(d_ev); |
---|
| 1210 | return true; |
---|
| 1211 | } |
---|
| 1212 | dd.msmoved = 1; |
---|
| 1213 | dd.obj.moveTo( |
---|
| 1214 | dd.obj.vertical? dd.obj.x : dd.maxOffX(dd.inWndW(dd.ofx+dd.e.x)-dd.obj.w), |
---|
| 1215 | dd.obj.horizontal? dd.obj.y : dd.maxOffY(dd.inWndH(dd.ofy+dd.e.y)-dd.obj.h) |
---|
| 1216 | ); |
---|
| 1217 | |
---|
| 1218 | if (window.my_DragFunc) my_DragFunc(); |
---|
| 1219 | return false; |
---|
| 1220 | } |
---|
| 1221 | |
---|
| 1222 | function RESIZE(d_ev) |
---|
| 1223 | { |
---|
| 1224 | if (!dd.obj || !dd.obj.visible) return true; |
---|
| 1225 | if (dd.wait) return false; |
---|
| 1226 | dd.wait = 1; |
---|
| 1227 | setTimeout('dd.wait = 0;', 5); |
---|
| 1228 | dd.e = new dd.evt(d_ev); |
---|
| 1229 | if (dd.ie && !dd.e.but) |
---|
| 1230 | { |
---|
| 1231 | DROP(d_ev); |
---|
| 1232 | return true; |
---|
| 1233 | } |
---|
| 1234 | dd.msmoved = 1; |
---|
| 1235 | var d_w = dd.limW(dd.inWndW(dd.ofx+dd.e.x)-dd.obj.x); |
---|
| 1236 | if (!dd.whratio) var d_h = dd.limH(dd.inWndH(dd.ofy+dd.e.y)-dd.obj.y); |
---|
| 1237 | else |
---|
| 1238 | { |
---|
| 1239 | var d_h = dd.limH(dd.inWndH(Math.round(d_w/dd.whratio)+dd.obj.y)-dd.obj.y); |
---|
| 1240 | d_w = Math.round(d_h*dd.whratio); |
---|
| 1241 | } |
---|
| 1242 | dd.reszTo(d_w, d_h); |
---|
| 1243 | if (window.my_ResizeFunc) my_ResizeFunc(); |
---|
| 1244 | return false; |
---|
| 1245 | } |
---|
| 1246 | |
---|
| 1247 | function DROP(d_ev) |
---|
| 1248 | { |
---|
| 1249 | if (dd.obj) |
---|
| 1250 | { |
---|
| 1251 | if (dd.obj.is_dragged) |
---|
| 1252 | { |
---|
| 1253 | if (!dd.obj.is_image) dd.getWH(dd.obj); |
---|
| 1254 | } |
---|
| 1255 | else if (dd.n4) |
---|
| 1256 | { |
---|
| 1257 | if (dd.obj.is_image) |
---|
| 1258 | { |
---|
| 1259 | dd.n4RectVis(0); |
---|
| 1260 | dd.obj.resizeTo(dd.obj.w, dd.obj.h); |
---|
| 1261 | } |
---|
| 1262 | } |
---|
| 1263 | if (!dd.n4 && !dd.op6 || !dd.obj.is_image) dd.recalc(); |
---|
| 1264 | dd.setEvtHdl(1, dd.moveFunc); |
---|
| 1265 | dd.setEvtHdl(2, dd.upFunc); |
---|
| 1266 | if (dd.db) dd.db.onselectstart = null; |
---|
| 1267 | dd.obj._setCrs(dd.obj.cursor); |
---|
| 1268 | dd.embedVis('visible'); |
---|
| 1269 | dd.obj._resetZ(); |
---|
| 1270 | if (window.my_DropFunc) |
---|
| 1271 | { |
---|
| 1272 | dd.e = new dd.evt(d_ev); |
---|
| 1273 | my_DropFunc(); |
---|
| 1274 | } |
---|
| 1275 | dd.msmoved = dd.obj.is_dragged = dd.obj.is_resized = dd.whratio = 0; |
---|
| 1276 | dd.obj = null; |
---|
| 1277 | } |
---|
| 1278 | dd.setEvtHdl(0, PICK); |
---|
| 1279 | } |
---|
| 1280 | |
---|
| 1281 | |
---|
| 1282 | |
---|
| 1283 | function SET_DHTML() |
---|
| 1284 | { |
---|
| 1285 | dd.elements = new Array(); |
---|
| 1286 | var d_a = SET_DHTML.arguments, d_ai, d_htm = '', d_o, d_i = d_a.length; while (d_i--) |
---|
| 1287 | { |
---|
| 1288 | if (dd.op6) |
---|
| 1289 | { |
---|
| 1290 | var d_t0 = (new Date()).getTime(); |
---|
| 1291 | while ((new Date()).getTime()-d_t0 < 0x99){}; |
---|
| 1292 | } |
---|
| 1293 | if (!(d_ai = d_a[d_i]).indexOf('c:')) dd.cursor = d_ai.substring(2); |
---|
| 1294 | else if (d_ai == NO_ALT) dd.noalt = 1; |
---|
| 1295 | else if (d_ai == SCROLL) dd.scroll = 1; |
---|
| 1296 | else if (d_ai == RESET_Z) dd.re_z = 1; |
---|
| 1297 | else if (d_ai == RESIZABLE) dd.resizable = 1; |
---|
| 1298 | else if (d_ai == SCALABLE) dd.scalable = 1; |
---|
| 1299 | else |
---|
| 1300 | { |
---|
| 1301 | d_o = new DDObj(d_ai); |
---|
| 1302 | dd.addElt(d_o); |
---|
| 1303 | d_htm += d_o.t_htm || ''; |
---|
| 1304 | if (d_o.oimg && d_o.cpy_n) |
---|
| 1305 | { |
---|
| 1306 | var d_j = 0; while (d_j < d_o.cpy_n) |
---|
| 1307 | { |
---|
| 1308 | var d_p = new DDObj(d_o.name+d_o.cmd, ++d_j); |
---|
| 1309 | dd.addElt(d_p, d_o); |
---|
| 1310 | d_p.defz = d_o.defz+d_j; |
---|
| 1311 | d_p.original = d_o; |
---|
| 1312 | d_htm += d_p.t_htm; |
---|
| 1313 | } |
---|
| 1314 | } |
---|
| 1315 | } |
---|
| 1316 | } |
---|
| 1317 | if (dd.n4 || dd.n6 || dd.ie || dd.op || dd.w3c) document.write( |
---|
| 1318 | (dd.n4? '<div style="position:absolute;"><\/div>\n' |
---|
| 1319 | : (dd.op && !dd.op6)? '<div id="OpBlUr" style="position:absolute;visibility:hidden;width:0px;height:0px;"><form><input type="text" style="width:0px;height:0px;"><\/form><\/div>' |
---|
| 1320 | : '') + d_htm |
---|
| 1321 | ); |
---|
| 1322 | dd.z = 0x33; |
---|
| 1323 | d_i = dd.elements.length; while (d_i--) |
---|
| 1324 | { |
---|
| 1325 | dd.addProps(d_o = dd.elements[d_i]); |
---|
| 1326 | if (d_o.is_image && !d_o.original && !d_o.clone) |
---|
| 1327 | dd.n4? d_o.oimg.src = spacer : d_o.oimg.style.visibility = 'hidden'; |
---|
| 1328 | } |
---|
| 1329 | dd.mkWzDom(); |
---|
| 1330 | if (window.onload) dd.loadFunc = window.onload; |
---|
| 1331 | window.onload = dd.initz; |
---|
| 1332 | window.onunload = dd.finlz; |
---|
| 1333 | dd.setEvtHdl(0, PICK); |
---|
| 1334 | } |
---|
| 1335 | |
---|
| 1336 | function ADD_DHTML(d_o) // layers only! |
---|
| 1337 | { |
---|
| 1338 | d_o = new DDObj(d_o); |
---|
| 1339 | dd.addElt(d_o); |
---|
| 1340 | dd.addProps(d_o); |
---|
| 1341 | dd.mkWzDom(); |
---|
| 1342 | } |
---|
| 1343 | |
---|
| 1344 | |
---|
| 1345 | |
---|
| 1346 | |
---|
| 1347 | //////////////////////////////////////////////////////////// |
---|
| 1348 | // If not needed, all code below this line may be removed |
---|
| 1349 | |
---|
| 1350 | |
---|
| 1351 | // For backward compatibility |
---|
| 1352 | dd.d = document; // < v. 2.72 |
---|
| 1353 | var RESET_ZINDEX = RESET_Z; // < 3.44 |
---|
| 1354 | var KEYDOWN_RESIZE = RESIZABLE; // < 4.43 |
---|
| 1355 | var CURSOR_POINTER = CURSOR_HAND; // < 4.44 |
---|
| 1356 | var NO_SCROLL = ''; // < v. 4.49 |
---|
| 1357 | |
---|
| 1358 | |
---|
| 1359 | |
---|
| 1360 | |
---|
| 1361 | //////////////////////////////////////////////////////////// |
---|
| 1362 | // FUNCTIONS FOR EXTENDED SCRIPTING |
---|
| 1363 | // Use these for your own extensions, |
---|
| 1364 | // or to call functions defined elsewhere |
---|
| 1365 | |
---|
| 1366 | |
---|
| 1367 | |
---|
| 1368 | /* my_PickFunc IS AUTOMATICALLY CALLED WHEN AN ITEM STARTS TO BE DRAGGED. |
---|
| 1369 | The following objects/properties are accessible from here: |
---|
| 1370 | |
---|
| 1371 | - dd.e: current mouse event |
---|
| 1372 | - dd.e.property: access to a property of the current mouse event. |
---|
| 1373 | Mostly requested properties: |
---|
| 1374 | - dd.e.x: document-related x co-ordinate |
---|
| 1375 | - dd.e.y: document-related y co-ord |
---|
| 1376 | - dd.e.src: target of mouse event (not identical with the drag drop object itself). |
---|
| 1377 | - dd.e.button: currently pressed mouse button. Left button: dd.e.button <= 1 |
---|
| 1378 | |
---|
| 1379 | - dd.obj: reference to currently dragged item. |
---|
| 1380 | - dd.obj.property: access to any property of that item. |
---|
| 1381 | - dd.obj.method(): for example dd.obj.resizeTo() or dd.obj.swapImage() . |
---|
| 1382 | Mostly requested properties: |
---|
| 1383 | - dd.obj.name: image name or layer ID passed to SET_DHTML(); |
---|
| 1384 | - dd.obj.x and dd.obj.y: co-ordinates; |
---|
| 1385 | - dd.obj.w and dd.obj.h: size; |
---|
| 1386 | - dd.obj.is_dragged: 1 while item is dragged, else 0; |
---|
| 1387 | - dd.obj.is_resized: 1 while item is resized, i.e. if <ctrl> or <shift> is pressed, else 0 |
---|
| 1388 | |
---|
| 1389 | For more properties and details, visit the API documentation |
---|
| 1390 | at http://www.walterzorn.com/dragdrop/api_e.htm (english) or |
---|
| 1391 | http://www.walterzorn.de/dragdrop/api.htm (german) */ |
---|
| 1392 | function my_PickFunc() |
---|
| 1393 | { |
---|
| 1394 | } |
---|
| 1395 | |
---|
| 1396 | |
---|
| 1397 | |
---|
| 1398 | |
---|
| 1399 | /* my_DragFunc IS CALLED WHILE AN ITEM IS DRAGGED |
---|
| 1400 | See the description of my_PickFunc above for what's accessible from here. */ |
---|
| 1401 | function my_DragFunc() |
---|
| 1402 | { |
---|
| 1403 | //window.status = 'dd.elements.' + dd.obj.name + '.x = ' + dd.obj.x + ' dd.elements.' + dd.obj.name + '.y = ' + dd.obj.y; |
---|
| 1404 | } |
---|
| 1405 | |
---|
| 1406 | |
---|
| 1407 | |
---|
| 1408 | |
---|
| 1409 | /* my_ResizeFunc IS CALLED WHILE AN ITEM IS RESIZED |
---|
| 1410 | See the description of my_PickFunc above for what's accessible from here. */ |
---|
| 1411 | function my_ResizeFunc() |
---|
| 1412 | { |
---|
| 1413 | //window.status = 'dd.elements.' + dd.obj.name + '.w = ' + dd.obj.w + ' dd.elements.' + dd.obj.name + '.h = ' + dd.obj.h; |
---|
| 1414 | } |
---|
| 1415 | |
---|
| 1416 | |
---|
| 1417 | |
---|
| 1418 | |
---|
| 1419 | /* THIS ONE IS CALLED ONCE AN ITEM IS DROPPED |
---|
| 1420 | See the description of my_PickFunc for what's accessible from here. |
---|
| 1421 | Here may be investigated, for example, what's the name (dd.obj.name) |
---|
| 1422 | of the dropped item, and where (dd.obj.x, dd.obj.y) it has been dropped... */ |
---|
| 1423 | function my_DropFunc() |
---|
| 1424 | { |
---|
| 1425 | } |
---|
| 1426 | |
---|
| 1427 | |
---|