( function( ) { var _connector = new XConnector; var _container = null; var _divAppboxHeader = null; var _loading = new Image( ); _loading.src = URL_SERVER + '/phpgwapi/images/loading.gif'; function handler( pLink ) { var action = pLink.href; if ( action == '' ) return false; var a = ( action.indexOf( 'javascript:' ) === 0 ); a = ( a || ( action.indexOf( '#' ) === 0 ) ); a = ( a || ( action.indexOf( window.location + '#' ) === 0 ) ); a = ( a || ! ( action.indexOf( 'workflow' ) < 0 ) ); if ( ! a ) pLink.onclick = function( ) { _divAppboxHeader.innerHTML = ''; _container.innerHTML = ''; _container.appendChild( _loading ); var _cacheit = ( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false ); var request = _connector.cache( _cacheit ).go( { 'access' : action, 'handler' : function( data ) { var el = document.createElement( 'div' ); el.innerHTML = data; var _links = el.getElementsByTagName( 'a' ); for ( var i = 0; i < _links.length; i++ ) handler( _links.item( i ) ); var _head = document.getElementsByTagName( 'head' ).item( 0 ); var _loaded = _head.getElementsByTagName( 'script' ); var _scripts = el.getElementsByTagName( 'script' ); var _new_scripts = [ ]; while ( _scripts.length ) _new_scripts[ _new_scripts.length ] = el.removeChild( _scripts.item( 0 ) ); _container.innerHTML = ''; while ( el.hasChildNodes( ) ) _container.appendChild( el.firstChild ); fix : for ( var i = 0; i < _new_scripts.length; i++ ) { var _script = _new_scripts[ i ]; if ( _script.getAttribute( 'src' ) == null ) { _container.appendChild( _script ); continue; } else { for ( var j = 0; j < _loaded.length; j++ ) if ( _script.getAttribute( 'src' ) === _loaded.item( j ).getAttribute( 'src' ) ) continue fix; _head.appendChild( _script ); } } } } ); return false; }; } XEvents.add( window, 'onload', function( ) { var _center = document.createElement( 'center' ); _center.appendChild( _loading ); _divAppboxHeader = document.getElementById( 'divAppboxHeader' ); _divAppboxHeader.innerHTML = ''; _container = document.getElementById( 'divAppbox' ); _loading = _center; document.getElementsByTagName( 'body' ).item( 0 ).style.overflowY = 'scroll'; var _links = document.getElementsByTagName( 'a' ); for ( var i = 0; i < _links.length; i++ ) handler( _links.item( i ) ); } ); } )( );