[2397] | 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 = getElement( pObj.id_window + '__parent'); |
---|
| 10 | _xtools = new xtools(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 | if( pObj.closeAction == "hidden" ) |
---|
| 30 | _window.setAttribute("leftOld", pObj.left + "px" ); |
---|
| 31 | |
---|
| 32 | window.document.body.insertBefore( _window, document.body.lastChild ); |
---|
| 33 | |
---|
| 34 | getElement(pObj.id_window + '__content').innerHTML = pObj.content; |
---|
| 35 | |
---|
| 36 | if( pObj.draggable ) |
---|
| 37 | { |
---|
| 38 | dragDrop = new _drag_drop(); |
---|
| 39 | dragDrop.set( pObj.id_window ); |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | else |
---|
| 43 | { |
---|
| 44 | load(pObj.id_window, "display"); |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | function getElement(pElement) |
---|
| 49 | { |
---|
| 50 | return document.getElementById(pElement); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | function load( pId, pVisible ) |
---|
| 54 | { |
---|
| 55 | var _window = document.getElementById( pId + '__parent') |
---|
| 56 | |
---|
| 57 | if( _window != null ) |
---|
| 58 | { |
---|
| 59 | if ( pVisible == "display" ) |
---|
| 60 | { |
---|
| 61 | if( _window.style.left == "-1500px" ) |
---|
| 62 | _window.style.left = _window.getAttribute("leftOld"); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | if ( pVisible == "hidden") |
---|
| 66 | { |
---|
| 67 | _window.setAttribute("leftOld" , _window.style.left ); |
---|
| 68 | _window.style.left = "-1500px"; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | if( pVisible == "remove" ) |
---|
| 72 | { |
---|
| 73 | document.body.removeChild( _window ); |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | function _window() |
---|
| 79 | { |
---|
| 80 | if( arguments.length > 0 ) |
---|
| 81 | { |
---|
| 82 | if( arguments.length == 1 ) |
---|
| 83 | { |
---|
| 84 | var obj = arguments[0]; |
---|
| 85 | build(obj); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | if( arguments.length == 2 ) |
---|
| 89 | { |
---|
| 90 | load(arguments[0], arguments[1]); |
---|
| 91 | } |
---|
| 92 | } |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | window.bWindow = _window; |
---|
| 96 | |
---|
| 97 | })(); |
---|
| 98 | |
---|
| 99 | function _winBuild() |
---|
| 100 | { |
---|
| 101 | if( arguments.length > 0 ) |
---|
| 102 | { |
---|
| 103 | if( arguments.length == 1 ) |
---|
| 104 | _win = new bWindow( arguments[0] ); |
---|
| 105 | |
---|
| 106 | if( arguments.length == 2 ) |
---|
| 107 | _win = new bWindow( arguments[0], arguments[1]); |
---|
| 108 | } |
---|
| 109 | } |
---|