Index: /trunk/phpgwapi/js/tools/xlink.js
===================================================================
--- /trunk/phpgwapi/js/tools/xlink.js	(revision 2630)
+++ /trunk/phpgwapi/js/tools/xlink.js	(revision 2642)
@@ -62,22 +62,31 @@
 							_container.appendChild( el.firstChild );
 
-						var _inline = [ ];
-						for ( var i = 0; i < _new_scripts.length; i++ )
-							if ( _new_scripts[ i ][ 2 ] == undefined || _new_scripts[ i ][ 2 ].length == 0 )
-								_inline[ _inline.length ] = _new_scripts[ i ][ 3 ];
+						var _count = 0;
+						function _scripts( )
+						{
+							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 ] );
 							else
-								_script.add( _new_scripts[ i ][ 2 ].substr(
-									URL_SERVER.length - 1,
-									_new_scripts[ i ][ 2 ].indexOf( '?' ) - URL_SERVER.length + 1
-								) );
+							{
+								_script.add(
+									_new_scripts[ _count ][ 2 ].substr(
+										URL_SERVER.length - 1,
+										_new_scripts[ _count ][ 2 ].indexOf( '?' ) - URL_SERVER.length + 1
+									)
+								);
+								if ( ++_count < _new_scripts.length )
+									_scripts( );
+							}
+						}
 
-						var _it_has_loaded = _script.load( function( )
+						if ( _new_scripts.length )
 						{
-							if ( _inline.length )
-								window.eval( _inline.join( '' ) );
-						} );
-
-						if ( ! _it_has_loaded && _inline.length )
-							window.eval( _inline.join( '' ) );
+							_scripts( );
+							_script.load( );
+						}
 					}
 				} );
Index: /trunk/phpgwapi/js/tools/xscript.js
===================================================================
--- /trunk/phpgwapi/js/tools/xscript.js	(revision 2630)
+++ /trunk/phpgwapi/js/tools/xscript.js	(revision 2642)
@@ -18,26 +18,38 @@
 	function _load( )
 	{
-		if ( ! _new.length )
-			return false;
-
 		var _handler = null;
 		if ( arguments.length && typeof arguments[ 0 ] == 'function' )
 			_handler = arguments[ 0 ];
 
-		_connector.go( {
-			"access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _new.join( ';' ),
-			"handler" : function( data )
-			{
-				for ( var i = 0; i < _new.length; i++ )
-					_loaded[ _loaded.length ] = _new[ i ];
+		var _inline = '';
+		if ( arguments.length && typeof arguments[ 1 ] == 'string' )
+			_inline = arguments[ 1 ];
 
-				_new = [ ];
+		if ( ! _new.length )
+		{
+			window.eval( _inline);
+			if ( _handler )
+				_handler( );
+		}
+		else
+		{
+			var _scripts = _new.join( ';' );
 
-				window.eval( data );
+			for ( var i = 0; i < _new.length; i++ )
+				_loaded[ _loaded.length ] = _new[ i ];
 
-				if ( _handler )
-					_handler( data );
-			}
-		} );
+			_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( );
+				}
+			} );
+		}
 	}
 
Index: /trunk/phpgwapi/js/tools/xconnector.js
===================================================================
--- /trunk/phpgwapi/js/tools/xconnector.js	(revision 2628)
+++ /trunk/phpgwapi/js/tools/xconnector.js	(revision 2642)
@@ -108,9 +108,9 @@
 									try
 									{
-										_request( _data );
+									  _request( _data );
 									}
-									catch( e )
+									catch ( _e )
 									{
-										//alert("#request\n\n" + _ID + "\n\n" + _e + "\n\n" + _e.description);
+										alert("#request\n\n" + _ID + "\n\n" + _e + "\n\n" + _e.description);
 									}
 
@@ -126,4 +126,5 @@
 					catch( e )
 					{
+						//alert( "e\n\n" + e );
 					}
 				break;
@@ -141,9 +142,4 @@
 
 		var _SEND = null;
-
-		//if ( _THREADS[_ID]._METHOD == 'GET' )
-		//	_TARGET += '?' + _ACTION;
-
-		//_TARGET += _ID;
 
 		_THREADS[ _ID ]._XHR.open( ( ( _THREADS[ _ID ]._POST ) ? 'POST' : 'GET' ), _TARGET, true);
Index: /trunk/expressoMail1_2/js/jscode/draw_api_folders.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/draw_api_folders.js	(revision 2630)
+++ /trunk/expressoMail1_2/js/jscode/draw_api_folders.js	(revision 2642)
@@ -224,66 +224,68 @@
 	else{
 		if(div)
+		{
 			div.innerHTML = '';
-		value = data['quota_percent'];
-		q_used = data['quota_used'];
-		table = document.getElementById("table_quota");
-		if(table)
-			table.parentNode.removeChild(table);
-		table = document.createElement("TABLE");	
-		tbody = document.createElement("TBODY");	
-		table.appendChild(tbody);
-		table.id = "table_quota";
-		table.width="102";
-		table.border="0";
-		table.cellSpacing = 0;
-		table.cellPadding = 0;
-
-		//tr1 = document.createElement("TR");
-		td11 = document.createElement("TD");
-		td11.align="center";
-		td11.setAttribute("noWrap","true");
-		td11.innerHTML += '&nbsp;<span class="boxHeaderText">' + value+"% ("+q_used+"M/"+q_limit+"M)</span>";
-		//tr1.appendChild(td11);
-
-		tr2 = document.createElement("TR");
-		td21 = document.createElement("TD");
-		td21.setAttribute("noWrap","true");
-		td21.height="15";
-		td22 = document.createElement("TD");	
-		td21.setAttribute("background", URL_SERVER + 'phpgwapi/templates/' + template + '/images/dsunused.gif');
-		table221 = document.createElement("TABLE");
-		tbody221 = document.createElement("TBODY");
-		table221.appendChild(tbody221);
-		table221.style.width=value+"%";	
-		td21.width="102";
-		table221.border="0";
-		table221.cellSpacing = 0;
-		table221.cellPadding = 0;
-		tr221 = document.createElement("TR");
-		td221 = document.createElement("TD");
-		td221.height="15";
-		if(value > 90) {
-			if(value >= 100)
-				write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));
+			value = data['quota_percent'];
+			q_used = data['quota_used'];
+			table = document.getElementById("table_quota");
+			if(table)
+				table.parentNode.removeChild(table);
+			table = document.createElement("TABLE");	
+			tbody = document.createElement("TBODY");	
+			table.appendChild(tbody);
+			table.id = "table_quota";
+			table.width="102";
+			table.border="0";
+			table.cellSpacing = 0;
+			table.cellPadding = 0;
+
+			//tr1 = document.createElement("TR");
+			td11 = document.createElement("TD");
+			td11.align="center";
+			td11.setAttribute("noWrap","true");
+			td11.innerHTML += '&nbsp;<span class="boxHeaderText">' + value+"% ("+q_used+"M/"+q_limit+"M)</span>";
+			//tr1.appendChild(td11);
+
+			tr2 = document.createElement("TR");
+			td21 = document.createElement("TD");
+			td21.setAttribute("noWrap","true");
+			td21.height="15";
+			td22 = document.createElement("TD");	
+			td21.setAttribute("background", URL_SERVER + 'phpgwapi/templates/' + template + '/images/dsunused.gif');
+			table221 = document.createElement("TABLE");
+			tbody221 = document.createElement("TBODY");
+			table221.appendChild(tbody221);
+			table221.style.width=value+"%";	
+			td21.width="102";
+			table221.border="0";
+			table221.cellSpacing = 0;
+			table221.cellPadding = 0;
+			tr221 = document.createElement("TR");
+			td221 = document.createElement("TD");
+			td221.height="15";
+			if(value > 90) {
+				if(value >= 100)
+					write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));
+				else
+					write_msg(get_lang("Warning: Your Mailbox is almost full!"));
+				td221.setAttribute("background","templates/"+template+"/images/dsalert.gif");
+			}
+			else if(value > 80)
+				td221.setAttribute("background", URL_SERVER + 'expressoMail1_2/templates/' + template + '/images/dswarn.gif');
 			else
-				write_msg(get_lang("Warning: Your Mailbox is almost full!"));
-			td221.setAttribute("background","templates/"+template+"/images/dsalert.gif");
-		}
-		else if(value > 80)
-			td221.setAttribute("background", URL_SERVER + 'expressoMail1_2/templates/' + template + '/images/dswarn.gif');
-		else
-			td221.className = 'dsused';
-
-		tr221.appendChild(td221);
-		tbody221.appendChild(tr221);
-		td21.appendChild(table221);	
-		tr2.appendChild(td21);
-		tr2.appendChild(td11);
-
-		//tr2.appendChild(td1);
-
-		tbody.appendChild(tr2); //Desenho
-		//tbody.appendChild(tr1); //Letras
-		div.appendChild(table);
+				td221.className = 'dsused';
+
+			tr221.appendChild(td221);
+			tbody221.appendChild(tr221);
+			td21.appendChild(table221);	
+			tr2.appendChild(td21);
+			tr2.appendChild(td11);
+
+			//tr2.appendChild(td1);
+
+			tbody.appendChild(tr2); //Desenho
+			//tbody.appendChild(tr1); //Letras
+			div.appendChild(table);
+		}
 	}
 }
@@ -318,5 +320,7 @@
 		span_paging.className = "boxHeaderText";
 		span_paging.align="right";
-		document.getElementById("div_menu_c3").appendChild(span_paging);	
+		var div_menu_c3 = document.getElementById("div_menu_c3");
+		if ( div_menu_c3 )
+			div_menu_c3.appendChild(span_paging);	
 	}
 	span_paging.style.width="100%";		  	 		
Index: /trunk/expressoMail1_2/js/jscode/abas.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/abas.js	(revision 2630)
+++ /trunk/expressoMail1_2/js/jscode/abas.js	(revision 2642)
@@ -1,5 +1,2 @@
-var BordersArray = new Array();
-BordersArray[0] = new setBorderAttributes(0);
-
 function setBorderAttributes(ID)
 {
Index: /trunk/expressoMail1_2/js/jscode/common_functions.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/common_functions.js	(revision 2618)
+++ /trunk/expressoMail1_2/js/jscode/common_functions.js	(revision 2642)
@@ -1,9 +1,7 @@
 // BEGIN: FUNCTION RESIZE WINDOW
-/*
 if (!expresso_offline) {
 	var _showBar = showBar;
 	var _hideBar = hideBar;
 }
-*/
 
 function __showBar(){
@@ -19,5 +17,5 @@
 hideBar = __hideBar;
 
-window.onresize = resizeWindow;
+XEvents.add( window, 'onresize', resizeWindow );
 
 function resizeWindow(){
@@ -36,11 +34,8 @@
 			var div = Element("content_id_"+BordersArray[i].sequence);
 
-			// This comented code cause/avoid (!?) Firefox to stuck some request
 			if(div)
-//				div.setAttribute("style","height: "+parseInt(defaultHeight - 90)+"px;");
-				div.style.height = defaultHeight - 90;
+				div.style.height = ( defaultHeight - 90 ) + 'px';
 			if(div_scroll)
-//				div_scroll.setAttribute("style","height: "+parseInt(defaultHeight - 130)+"px;");
-				div_scroll.style.height = defaultHeight - 130;
+				div_scroll.style.height = ( defaultHeight - 130 ) + 'px';
 		}
 	}
Index: /trunk/expressoMail1_2/js/jscode/main.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/main.js	(revision 2630)
+++ /trunk/expressoMail1_2/js/jscode/main.js	(revision 2642)
@@ -6,4 +6,10 @@
 
 function init(){
+	BordersArray[0] = new setBorderAttributes(0);
+	expresso_local_messages = new local_messages();
+	expresso_local_messages.create_objects();
+	proxy_mensagens = new messages_proxy();
+	wfolders = new cWFolders();
+
 	current_folder = "INBOX";
 	if (!is_ie)
Index: /trunk/expressoMail1_2/js/jscode/messages_controller.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/messages_controller.js	(revision 2572)
+++ /trunk/expressoMail1_2/js/jscode/messages_controller.js	(revision 2642)
@@ -324,4 +324,2 @@
 	};
 
-	var proxy_mensagens;
-	proxy_mensagens = new messages_proxy();
Index: /trunk/expressoMail1_2/js/jscode/local_messages.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/local_messages.js	(revision 2566)
+++ /trunk/expressoMail1_2/js/jscode/local_messages.js	(revision 2642)
@@ -1588,5 +1588,2 @@
 	};
 
-	var expresso_local_messages;
-	expresso_local_messages = new local_messages();
-	expresso_local_messages.create_objects();
Index: /trunk/expressoMail1_2/js/jscode/globals.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/globals.js	(revision 2630)
+++ /trunk/expressoMail1_2/js/jscode/globals.js	(revision 2642)
@@ -46,4 +46,8 @@
 
 var special_folders = new Array(4);
+special_folders[ 'Trash' ] = 'Trash';
+special_folders[ 'Drafts' ] = 'Drafts';
+special_folders[ 'Spam' ] = 'Spam';
+special_folders[ 'Sent' ] = 'Sent';
 var trashfolder = 'Trash';
 var draftsfolder = 'Drafts';
@@ -61,2 +65,8 @@
 	"controller" : "/controller.php?action="
 } );
+
+var BordersArray = new Array();
+var expresso_local_messages;
+var proxy_mensagens;
+var wfolders;
+var use_spam_filter;
Index: /trunk/expressoMail1_2/js/jscode/wfolders.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/wfolders.js	(revision 2572)
+++ /trunk/expressoMail1_2/js/jscode/wfolders.js	(revision 2642)
@@ -160,4 +160,2 @@
 	
 /* Build the Object */
-	var wfolders;
-	wfolders = new cWFolders();
Index: /trunk/expressoMail1_2/index.php
===================================================================
--- /trunk/expressoMail1_2/index.php	(revision 2603)
+++ /trunk/expressoMail1_2/index.php	(revision 2642)
@@ -11,7 +11,6 @@
 \**************************************************************************/
 
-$GLOBALS['phpgw_info']['flags'] = array(
-	//'noheader' => False,
-	//'nonavbar' => False,
+$GLOBALS['phpgw_info']['flags'] = array
+(
 	'currentapp' => 'expressoMail1_2',
 	'update_version'	=> '1.235',
@@ -20,6 +19,4 @@
 
 require_once('../header.inc.php');
-
-//include_once("inc/load_lang.php");
 
 $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
@@ -120,5 +117,4 @@
 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];
-echo '<script> var use_spam_filter = "' . $current_config['expressoMail_use_spam_filter'] . '"</script>';
 // End Set Anti-Spam options.
 
@@ -148,22 +144,22 @@
 
 //$GLOBALS['phpgw']->js->validate_file( 'modal', 'modal', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscalendar', 'calendar', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscalendar', 'calendar-setup', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscalendar', 'lang/calendar-br', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'globals', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'sniff_browser', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'common_functions', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'abas', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'doiMenuData', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'drag_area', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'draw_api_messages', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'draw_api_folders', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'DropDownContacts', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'InfoContact', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'local_messages', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'messages_controller', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'rich_text_editor', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'wfolders', 'expressoMail1_2' );
-$GLOBALS['phpgw']->js->validate_file( 'jscode', 'main', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscalendar', 'calendar', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscalendar', 'calendar-setup', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscalendar', 'lang/calendar-br', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'globals', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'sniff_browser', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'common_functions', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'abas', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'doiMenuData', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'drag_area', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'draw_api_messages', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'draw_api_folders', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'DropDownContacts', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'InfoContact', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'local_messages', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'messages_controller', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'rich_text_editor', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'wfolders', 'expressoMail1_2' );
+$GLOBALS[ 'phpgw' ] -> js -> validate_file( 'jscode', 'main', 'expressoMail1_2' );
 
 if ( $GLOBALS[ 'phpgw_info' ][ 'user' ][ 'preferences' ][ 'expressoMail' ][ 'use_shortcuts' ] )
@@ -181,4 +177,5 @@
 $script .= '<style type="text/css">@import url(' . $phpgwapi_url . '/js/jscalendar/calendar-win2k-1.css);</style>';
 $script .= '<script type="text/javascript">';
+$script .= '	use_spam_filter = "' . $current_config['expressoMail_use_spam_filter'] . '";';
 $script .= '	special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'"] = \'Trash\';';
 $script .= '	special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'"] = \'Drafts\';';
@@ -192,5 +189,4 @@
 $script .= '	var locale = "'.$GLOBALS['phpgw']->common->getPreferredLanguage().'";';
 $script .= '	var account_id = ' . $GLOBALS['phpgw_info']['user']['account_id'] . ';';
-$script .= '	expresso.connector.updateVersion = "'. $GLOBALS['phpgw_info']['flags']['update_version'] . '";';
 $script .= '	var cyrus_delimiter = "' . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'] . '";';
 $script .= ( ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) || array_key_exists( 'BackgroundRequest', $_GET ) ) ? 'init( );' : 'XEvents.add( window, "onload", init)' );
