Index: /trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- /trunk/phpgwapi/inc/functions.inc.php	(revision 2645)
+++ /trunk/phpgwapi/inc/functions.inc.php	(revision 2674)
@@ -309,4 +309,10 @@
 				}
 			}
+
+			$relpath = str_replace( 'index.php', '', $relpath );
+			if ( $relpath[ 0 ] == '/' )
+				$relpath = substr( $relpath, 1 );
+			$relpath = '#' . $relpath;
+
 			// this removes the sessiondata if its saved in the URL
 			$query = preg_replace('/[&]?sessionid(=|%3D)[^&]+&kp3(=|%3D)[^&]+&domain=.*$/','',$_SERVER['QUERY_STRING']);
Index: /trunk/phpgwapi/js/tools/xlink.js
===================================================================
--- /trunk/phpgwapi/js/tools/xlink.js	(revision 2656)
+++ /trunk/phpgwapi/js/tools/xlink.js	(revision 2674)
@@ -49,5 +49,8 @@
 					_new_scripts[ _count ][ 2 ].substr(
 						URL_SERVER.length - 1,
-						_new_scripts[ _count ][ 2 ].indexOf( '?' ) - URL_SERVER.length + 1
+						_new_scripts[ _count ][ 2 ].length - URL_SERVER.length + 1 - (
+							( _new_scripts[ _count ][ 2 ].indexOf( '?' ) < 0 ) ?
+								0 : ( _new_scripts[ _count ][ 2 ].length - _new_scripts[ _count ][ 2 ].indexOf( '?' ) )
+						)
 					)
 				);
@@ -86,5 +89,5 @@
 				_container.appendChild( _center );
 
-				var _cacheit = true;//( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false );
+				var _cacheit = false;//( ( pLink.hasAttribute( 'cacheit' ) && pLink.getAttribute( 'cacheit' ) === 'true' ) ? true : false );
 
 				_connector.go(
@@ -94,4 +97,10 @@
 					'handler' : _handler
 				} );
+
+				window.location = '#' + (
+					( action.indexOf( URL_SERVER ) < 0 ) ?
+						action : action.substr( action.indexOf( URL_SERVER ) + URL_SERVER.length )
+				);
+
 				return false;
 			};
Index: /trunk/phpgwapi/js/expressoAjax/dom.js
===================================================================
--- /trunk/phpgwapi/js/expressoAjax/dom.js	(revision 2630)
+++ /trunk/phpgwapi/js/expressoAjax/dom.js	(revision 2674)
@@ -1,5 +1,5 @@
 XEvents.add( window, "onload", function( )
 {
-	if ( template == 'classic' )
+	if ( template == 'classic' || template == 'celepar' )
 		return false;
 
Index: /trunk/phpgwapi/templates/default/login_default.php
===================================================================
--- /trunk/phpgwapi/templates/default/login_default.php	(revision 2613)
+++ /trunk/phpgwapi/templates/default/login_default.php	(revision 2674)
@@ -184,13 +184,9 @@
 				list($forward,$extra_vars) = explode('?',$forward,2);
 			}
+
 			if ($GLOBALS['phpgw_info']['server']['use_https'] != 2)
-			{
-				$forward = 'http://'.$_SERVER['HTTP_HOST'].($GLOBALS['phpgw']->link($forward.'?cd=yes'));
-				echo "<script language='Javascript1.3'>location.href='".$forward."'</script>";
-			}
+				$GLOBALS['phpgw']->redirect_link( $forward );
 			else
-			{
 				$GLOBALS['phpgw']->redirect_link($forward,$extra_vars);
-			}
 		}
 	}
Index: /trunk/login.php
===================================================================
--- /trunk/login.php	(revision 1742)
+++ /trunk/login.php	(revision 2674)
@@ -51,8 +51,10 @@
 	{
 		include('./header.inc.php');
-		// Force location to home, while logged in.
+
 		$GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
+
 		if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10)
-			$GLOBALS['phpgw']->redirect_link('/home.php');
+			$GLOBALS['phpgw']->redirect_link('/');
+
 		if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)
 		{
Index: /trunk/index.php
===================================================================
--- /trunk/index.php	(revision 2656)
+++ /trunk/index.php	(revision 2674)
@@ -66,5 +66,11 @@
 	if ( $app == 'home' && ! $api_requested )
 	{
-		echo '<script>XLink( "' . $GLOBALS[ 'phpgw' ] -> link( '/home.php' ) . '", true );</script>';
+		$target = 'home.php';
+		if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] && $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']])
+			$target = $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/index.php';
+
+		echo '<script>XEvents.add( window, "onload", function( ) { var target = window.location.hash; target = ( ( target && target.length > 1 ) ? URL_SERVER + target.substr( 1 ) : "'
+			. $GLOBALS[ 'phpgw' ] -> link( $target ). '" );XLink( target ); } );</script>';
+
 		exit;
 	}
Index: /trunk/expressoMail1_2/templates/classic/index.tpl
===================================================================
--- /trunk/expressoMail1_2/templates/classic/index.tpl	(revision 2603)
+++ /trunk/expressoMail1_2/templates/classic/index.tpl	(revision 2674)
@@ -16,7 +16,7 @@
 						<tr><td><div class='content-menu'>
 							<table border="0" cellspacing="0" cellpadding="0" border="0"><tbody>
-								<tr><td class='content-menu-td' onclick='javascript:new_message("new","null");' onmouseover='javascript:set_menu_bg(this);' onmouseout='javascript:unset_menu_bg(this);'><div class='em_div_sidebox_menu'><img src='./templates/default/images/menu/createmail.gif'><span class="em_sidebox_menu">{new_message}</span></div></td></tr>
-								<tr><td class='content-menu-td' id='em_refresh_button' onclick='javascript:refresh();' onmouseover='javascript:set_menu_bg(this);' onmouseout='javascript:unset_menu_bg(this);'><div class='em_div_sidebox_menu'><img src='./templates/default/images/menu/checkmail.gif'><span class="em_sidebox_menu">{refresh}</span></div></td></tr>
-								<tr><td id="link_tools" class='content-menu-td' onmouseover='javascript:set_menu_bg(Element("link_tools"));' onmouseout='javascript:unset_menu_bg(this);'><div class='em_div_sidebox_menu'><img height='16px' src='./templates/default/images/menu/tools.gif'><span class="em_sidebox_menu">{tools} ...</span></div></td></tr>								
+								<tr><td class='content-menu-td' onclick='javascript:new_message("new","null");' onmouseover='javascript:set_menu_bg(this);' onmouseout='javascript:unset_menu_bg(this);'><div class='em_div_sidebox_menu'><img src='{url}/templates/default/images/menu/createmail.gif'><span class="em_sidebox_menu">{new_message}</span></div></td></tr>
+								<tr><td class='content-menu-td' id='em_refresh_button' onclick='javascript:refresh();' onmouseover='javascript:set_menu_bg(this);' onmouseout='javascript:unset_menu_bg(this);'><div class='em_div_sidebox_menu'><img src='{url}/templates/default/images/menu/checkmail.gif'><span class="em_sidebox_menu">{refresh}</span></div></td></tr>
+								<tr><td id="link_tools" class='content-menu-td' onmouseover='javascript:set_menu_bg(Element("link_tools"));' onmouseout='javascript:unset_menu_bg(this);'><div class='em_div_sidebox_menu'><img height='16px' src='{url}/templates/default/images/menu/tools.gif'><span class="em_sidebox_menu">{tools} ...</span></div></td></tr>								
 							</tbody></table>
 						</div></td></tr>
@@ -30,8 +30,8 @@
 					<input type="text" id="em_message_search" size="16" maxlength="22" onfocus="javascript:onFocusQuickSearchEmail(this); return false;"/>
 					<a class='' onMouseOut="window.status='';return true;" title='{lang_Open_Search_Window}' onMouseOver="window.status='{lang_Open_Search_Window}';return true;" href="javascript:void(0);"  onClick="javascript:search_emails(Element('em_message_search').value)">
-						<img valign="center" align="center" src="templates/default/images/search.gif">
+						<img valign="center" align="center" src="{url}/templates/default/images/search.gif">
 					</a>
 					<a class='' onMouseOut="window.status='';return true;" title='{lang_search_user}' onMouseOver="window.status='{lang_search_user}' ;return true;" href="javascript:void(0);"  onClick="javascript:emQuickSearch(Element('em_message_search').value, 'null', 'null')">
-						<img valign="center" align="center" src="templates/default/images/users.jpg">
+						<img valign="center" align="center" src="{url}/templates/default/images/users.jpg">
 					</a>
 				</div>
Index: /trunk/home.php
===================================================================
--- /trunk/home.php	(revision 2623)
+++ /trunk/home.php	(revision 2674)
@@ -58,9 +58,4 @@
 	}
 
-	if ($_GET['cd']=='yes' && $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] &&
-		$GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']])
-	{
-		$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/' . 'index.php'));
-	}
 	// Default Applications (Home Page) 
 	$default_apps = Array(			
