1 | (function() |
---|
2 | { |
---|
3 | var Xtools = null; |
---|
4 | var dragDrop = null; |
---|
5 | var path = path_jabberit; |
---|
6 | |
---|
7 | function build(pObj) |
---|
8 | { |
---|
9 | var _window = document.getElementById( pObj.id_window + '__parent'); |
---|
10 | Xtools = new JITXtools(path); |
---|
11 | |
---|
12 | if( _window == null ) |
---|
13 | { |
---|
14 | pObj.width = ( ( pObj.width > 160 ) ? pObj.width : 160 ); |
---|
15 | pObj.height = ( ( pObj.height > 80 ) ? pObj.height : 80 ); |
---|
16 | pObj.onclick = "winBuild ('" + pObj.id_window + "', '" + pObj.closeAction + "')"; |
---|
17 | |
---|
18 | _window = document.createElement("div"); |
---|
19 | _window.id = pObj.id_window + "__parent"; |
---|
20 | _window.setAttribute("onselectstart" , "return false"); |
---|
21 | _window.style.width = pObj.width + "px"; |
---|
22 | _window.style.height = pObj.height + "px"; |
---|
23 | _window.style.top = pObj.top + "px"; |
---|
24 | _window.style.left = pObj.left + "px"; |
---|
25 | _window.style.position = "absolute"; |
---|
26 | _window.style.zIndex = pObj.zindex; |
---|
27 | _window.innerHTML = Xtools.parse( Xtools.xml('window_main'), 'window.xsl', pObj ); |
---|
28 | |
---|
29 | window.document.body.insertBefore( _window, document.body.lastChild ); |
---|
30 | |
---|
31 | if( pObj.draggable ) |
---|
32 | { |
---|
33 | dragDrop = new dragdrop(); |
---|
34 | dragDrop.set( pObj.id_window ); |
---|
35 | } |
---|
36 | } |
---|
37 | else |
---|
38 | _load(pObj.id_window, "display"); |
---|
39 | } |
---|
40 | |
---|
41 | function _content( pId, pContent ) |
---|
42 | { |
---|
43 | var _contentWindow = function() |
---|
44 | { |
---|
45 | var _win_content = document.getElementById(pId + "__content"); |
---|
46 | _win_content.innerHTML = pContent; |
---|
47 | }; |
---|
48 | |
---|
49 | setTimeout( _contentWindow, 220 ); |
---|
50 | } |
---|
51 | |
---|
52 | function Load( pId, pVisible ) |
---|
53 | { |
---|
54 | var winM = document.getElementById( pId + '__parent'); |
---|
55 | |
---|
56 | if( winM != null ) |
---|
57 | { |
---|
58 | if ( pVisible == "display" ) |
---|
59 | winM.style.left = "70px"; |
---|
60 | |
---|
61 | if ( pVisible == "hidden") |
---|
62 | winM.style.left = "-1500px"; |
---|
63 | |
---|
64 | if( pVisible == "remove" ) |
---|
65 | document.body.removeChild( winM ); |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | function _window() |
---|
70 | { |
---|
71 | var objectW = null; |
---|
72 | |
---|
73 | if( arguments.length == 1 ) |
---|
74 | { |
---|
75 | objectW = arguments[0]; |
---|
76 | |
---|
77 | JSLoader.load([path + "js/dragdrop.js"]); |
---|
78 | JSLoader.load([path + "templates/default/css/button.css"]) |
---|
79 | |
---|
80 | setTimeout( function(){ build(objectW); }, 200 ); |
---|
81 | } |
---|
82 | |
---|
83 | if( arguments.length == 2 ) |
---|
84 | Load(arguments[0], arguments[1]); |
---|
85 | |
---|
86 | if( arguments.length === 3 ) |
---|
87 | _content( arguments[0], arguments[1]); |
---|
88 | } |
---|
89 | |
---|
90 | window.bWindow = _window; |
---|
91 | |
---|
92 | })(); |
---|
93 | |
---|
94 | function winBuild() |
---|
95 | { |
---|
96 | if( arguments.length == 1 ) |
---|
97 | _win = new bWindow( arguments[0] ); |
---|
98 | |
---|
99 | if( arguments.length == 2 ) |
---|
100 | _win = new bWindow( arguments[0], arguments[1] ); |
---|
101 | |
---|
102 | if( arguments.length == 3 ) |
---|
103 | _win = new bWindow( arguments[0], arguments[1], arguments[2] ); |
---|
104 | } |
---|