Index: trunk/phpgwapi/js/tools/xlink.js
===================================================================
--- trunk/phpgwapi/js/tools/xlink.js	(revision 2712)
+++ trunk/phpgwapi/js/tools/xlink.js	(revision 2729)
@@ -78,9 +78,9 @@
 		if ( js )
 		{
-			var tag = /<script([^>]* src="(\S+)"|[^>]*)>(.*?)<\/script>/;
+			var tag = /<script([^>]*src="(\S+)"[^>]*|[^>]*)>(.*?)<\/script>/;
 			for ( var i = 0; i < js.length; i++ )
 			{
 				var type = tag.exec( js[ i ] );
-				data = data.replace( "\n\t\t" + type[ 0 ], '' );
+				data = data.replace( type[ 0 ], '' );
 				_new_scripts[ _new_scripts.length ] = type;
 			}
@@ -98,37 +98,26 @@
 			_container.appendChild( el.firstChild );
 
-		var _count = 0;
-		function _scripts( )
+		for ( var i = 0; i < _new_scripts.length; i++ )
 		{
-			if ( _new_scripts[ _count ][ 2 ] == undefined || _new_scripts[ _count ][ 2 ].length == 0 )
-				_script.load( function( )
-				{
-					if ( ++_count < _new_scripts.length )
-						_scripts( );
-				}, _new_scripts[ _count ][ 3 ] );
+			if ( _new_scripts[ i ][ 2 ] == undefined || _new_scripts[ i ][ 2 ].length == 0 )
+				_script.inline( _new_scripts[ i ][ 3 ] );
 			else
 			{
-				if ( _new_scripts[ _count ][ 2 ].indexOf( window.location.host ) < 0 )
-					_new_scripts[ _count ][ 2 ] = window.location.protocol + '//' + window.location.host + _new_scripts[ _count ][ 2 ];
+				if ( _new_scripts[ i ][ 2 ].indexOf( window.location.host ) < 0 )
+					_new_scripts[ i ][ 2 ] = window.location.protocol + '//' + window.location.host + _new_scripts[ i ][ 2 ];
 
-				_script.add(
-					_new_scripts[ _count ][ 2 ].substr(
+				_script.external(
+					_new_scripts[ i ][ 2 ].substr(
 						_path.length - 1,
-						_new_scripts[ _count ][ 2 ].length - _path.length + 1 - (
-							( _new_scripts[ _count ][ 2 ].indexOf( '?' ) < 0 ) ?
-								0 : ( _new_scripts[ _count ][ 2 ].length - _new_scripts[ _count ][ 2 ].indexOf( '?' ) )
+						_new_scripts[ i ][ 2 ].length - _path.length + 1 - (
+							( _new_scripts[ i ][ 2 ].indexOf( '?' ) < 0 ) ?
+								0 : ( _new_scripts[ i ][ 2 ].length - _new_scripts[ i ][ 2 ].indexOf( '?' ) )
 						)
 					)
 				);
-				if ( ++_count < _new_scripts.length )
-					_scripts( );
 			}
 		}
 
-		if ( _new_scripts.length )
-		{
-			_scripts( );
-			_script.load( );
-		}
+		_script.load( );
 	}
 
Index: trunk/phpgwapi/js/tools/xscript.js
===================================================================
--- trunk/phpgwapi/js/tools/xscript.js	(revision 2703)
+++ trunk/phpgwapi/js/tools/xscript.js	(revision 2729)
@@ -5,51 +5,72 @@
 	var _new = [ ];
 
-	function _add( pURL )
+	function _inline( )
 	{
-		for ( var i = 0; i < _loaded.length; i++ )
-			if ( _loaded[ i ] == pURL )
-				return false;
+		_new[ _new.length ] = {
+			"type" : "inline",
+			"content" : arguments[ 0 ]
+		};
+	}
 
-		_new[ _new.length ] = pURL;
-
-		return true;
+	function _external( )
+	{
+		_new[ _new.length ] = {
+			"type" : "external",
+			"content" : arguments[ 0 ]
+		};
 	}
 
 	function _load( )
 	{
-		var _handler = null;
-		if ( arguments.length && typeof arguments[ 0 ] == 'function' )
-			_handler = arguments[ 0 ];
+		var _count = 0;
+		function _handler( )
+		{
+			var _scripts = [ ];
+			_script : while ( _count < _new.length && _new[ _count ].type != 'inline' )
+			{
+				for ( var i = 0; i < _loaded.length; i++ )
+					if ( _loaded[ i ] == _new[ _count ].content )
+					{
+						_count++;
+						continue _script;
+					}
 
-		var _inline = '';
-		if ( arguments.length && typeof arguments[ 1 ] == 'string' )
-			_inline = arguments[ 1 ];
+				_scripts[ _scripts.length ] = _loaded[ _loaded.length ] = _new[ _count ].content;
+				_count++;
+			}
 
-		if ( ! _new.length )
-		{
-			window.eval( _inline);
-			if ( _handler )
-				_handler( );
+			_scripts = _scripts.join( ';' );
+
+			if ( _scripts.length )
+				_connector.go( {
+					"access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _scripts,
+					"handler" : function( data )
+					{
+						window.eval( data );
+						if ( _count < _new.length && _new[ _count ].type == 'inline' )
+						{
+							window.eval( _new[ _count ].content );
+							_count++;
+							_handler( );
+						}
+						else
+						{
+							_count++;
+							_handler( );
+						}
+					}
+				} );
+			else
+				if ( _count < _new.length && _new[ _count ].type == 'inline' )
+				{
+					window.eval( _new[ _count ].content );
+					_count++;
+					_handler( );
+				}
+
+			if ( _count == _new.length )
+				_new = [ ];
 		}
-		else
-		{
-			var _scripts = _new.join( ';' );
-
-			for ( var i = 0; i < _new.length; i++ )
-				_loaded[ _loaded.length ] = _new[ i ];
-
-			_new = [ ];
-
-			_connector.go( {
-				"access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _scripts,
-				"handler" : function( data )
-				{
-					window.eval( data + _inline);
-
-					if ( _handler )
-						_handler( );
-				}
-			} );
-		}
+		_handler( );
 	}
 
@@ -61,5 +82,6 @@
 	}
 
-	Script.prototype.add = _add;
+	Script.prototype.external = _external;
+	Script.prototype.inline = _inline;
 	Script.prototype.load = _load;
 
Index: trunk/phpgwapi/js/expressolivre/expressolivre.js
===================================================================
--- trunk/phpgwapi/js/expressolivre/expressolivre.js	(revision 2712)
+++ trunk/phpgwapi/js/expressolivre/expressolivre.js	(revision 2729)
@@ -25,4 +25,5 @@
 		_xconnector.go( {
 			'access' : 'phpgwapi.expressolivre.lang&lang=' + lang + '&module=' + module,
+			'cache' : true,
 			'handler' : function( data )
 			{
