diff --git a/htdocs/core/templates/google_ad.tpl.php b/htdocs/core/templates/google_ad.tpl.php
new file mode 100644
index 0000000000000000000000000000000000000000..38b3599edbf5265dbaf8cbede957b223681e7a02
--- /dev/null
+++ b/htdocs/core/templates/google_ad.tpl.php
@@ -0,0 +1,34 @@
+{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ *}
+ 
+<!-- BEGIN GOOGLE AD TEMPLATE -->
+
+<script type="text/javascript"><!--
+	google_ad_client = "{$main_google_ad_client}";
+	/* {$main_google_ad_width}x{$main_google_ad_height}, {$main_google_ad_name} */
+	google_ad_slot = "{$main_google_ad_slot}";
+	google_ad_width = {$main_google_ad_width};
+	google_ad_height = {$main_google_ad_height};
+	//-->
+</script>
+<script type="text/javascript"
+	src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
+
+<!-- END GOOGLE AD TEMPLATE -->
\ No newline at end of file
diff --git a/htdocs/core/templates/login.tpl.php b/htdocs/core/templates/login.tpl.php
index 6e913fa25c0fb71f34513dbfa62ea4c4bb71a524..5ccae2a1cc1906aef73b55cb8bf5033bcc79623f 100644
--- a/htdocs/core/templates/login.tpl.php
+++ b/htdocs/core/templates/login.tpl.php
@@ -29,7 +29,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
 <meta name="robots" content="noindex,nofollow">
 <title><?php echo $langs->trans('Login'); ?></title>
 
-<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>">
+<link rel="stylesheet" type="text/css" href="<?php echo $conf->css; ?>">
 
 <style type="text/css">
 <!--
@@ -54,7 +54,7 @@ function donnefocus() {
 	}
 </script>
 
-<?php	
+<?php
 	if ($main_html_header)
 		echo $main_html_header;
 ?>
@@ -82,8 +82,8 @@ function donnefocus() {
 <td valign="bottom" nowrap="nowrap">
 <input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="<?php echo $login; ?>" tabindex="1" /></td>
 
-<td rowspan="<?php echo $logo_rowspan; ?>" align="center" valign="top">
-<img alt="Logo" title="" src="<?php echo $logo; ?>" />
+<td rowspan="<?php echo $rowspan; ?>" align="center" valign="top">
+<img alt="Logo" title="" src="<?php echo $urllogo; ?>" />
 
 </td>
 </tr>
@@ -137,8 +137,8 @@ function donnefocus() {
 				echo '&nbsp;-&nbsp;';
 			} else {
 				echo '(';
-			}  
-			echo $langs->trans('NeedHelpCenter').')</a>';			
+			}
+			echo $langs->trans('NeedHelpCenter').')</a>';
 		}
 		echo '</td></tr>';
 	}
@@ -153,7 +153,7 @@ function donnefocus() {
 		<?php echo $_SESSION['dol_loginmesg']; ?>
 		</div></td></tr></table></center>
 	<?php } ?>
-	
+
 	<?php if ($main_home) { ?>
 		<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
 		<tr><td align="center">
@@ -163,7 +163,7 @@ function donnefocus() {
 
 	<?php if ($main_google_ad_client) { ?>
 		<div align="center">
-		<?php include($google_ad_tpl); ?>
+		<?php include('google_ad.tpl.php'); ?>
 		</div>
 	<?php } ?>
 
diff --git a/htdocs/user/templates/passwordforgotten.tpl b/htdocs/core/templates/passwordforgotten.tpl
similarity index 100%
rename from htdocs/user/templates/passwordforgotten.tpl
rename to htdocs/core/templates/passwordforgotten.tpl
diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php
index 16edcc3e0c087384be13bf0f6ec84fa6979b233c..a82e1b14508458d42379a7de175fa3d0e0bcd6b5 100644
--- a/htdocs/lib/security.lib.php
+++ b/htdocs/lib/security.lib.php
@@ -34,18 +34,15 @@
  */
 function dol_loginfunction($langs,$conf,$mysoc)
 {
+	global $dolibarr_main_demo,$db;
+
 	$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
 	$langs->setDefaultLang($langcode);
 
 	$langs->load("main");
 	$langs->load("other");
 
-	$conf->css  = "theme/".$conf->theme."/".$conf->theme.".css";
-	// Si feuille de style en php existe
-	if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
-
-	header('Cache-Control: Public, must-revalidate');
-	header("Content-type: text/html; charset=".$conf->file->character_set_client);
+	$conf->css  = "theme/".$conf->theme."/".$conf->theme.".css.php";
 
 	// Set cookie for timeout management
 	$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
@@ -54,6 +51,46 @@ function dol_loginfunction($langs,$conf,$mysoc)
 	if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
 	else unset($_SESSION["urlfrom"]);
 
+	$demologin='';
+	$demopassword='';
+	if (! empty($dolibarr_main_demo))
+	{
+		$tab=explode(',',$dolibarr_main_demo);
+		$demologin=$tab[0];
+		$demopassword=$tab[1];
+	}
+
+	// Entity cookie
+	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
+	{
+		$lastuser = '';
+		$lastentity = $_POST['entity'];
+
+		if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
+		{
+			$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
+			if (isset($_COOKIE[$entityCookieName]))
+			{
+				include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
+
+				$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
+
+				$entityCookie = new DolCookie($cryptkey);
+				$cookieValue = $entityCookie->_getCookie($entityCookieName);
+				list($lastuser, $lastentity) = explode('|', $cookieValue);
+			}
+		}
+	}
+
+	$title='Dolibarr '.DOL_VERSION;
+	if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
+
+
+
+	header('Cache-Control: Public, must-revalidate');
+	header("Content-type: text/html; charset=".$conf->file->character_set_client);
+
+
 	// Ce DTD est KO car inhibe document.body.scrollTop
 	//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
 	// Ce DTD est OK
@@ -112,8 +149,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 
 	// Table 1
-	$title='Dolibarr '.DOL_VERSION;
-	if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
 	print '<table class="login" summary="'.$title.'" cellpadding="0" cellspacing="0" border="0" align="center">'."\n";;
 	print '<tr class="vmenu"><td align="center">'.$title.'</td></tr>'."\n";
 	print '</table>'."\n";
@@ -126,38 +161,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
 
 	print '<tr>';
 
-	$demologin='';
-	$demopassword='';
-	global $dolibarr_main_demo;
-	if (! empty($dolibarr_main_demo))
-	{
-		$tab=explode(',',$dolibarr_main_demo);
-		$demologin=$tab[0];
-		$demopassword=$tab[1];
-	}
-
-	// Entity cookie
-	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
-	{
-		$lastuser = '';
-		$lastentity = $_POST['entity'];
-
-		if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
-		{
-			$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
-			if (isset($_COOKIE[$entityCookieName]))
-			{
-				include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
-
-				$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
-
-				$entityCookie = new DolCookie($cryptkey);
-				$cookieValue = $entityCookie->_getCookie($entityCookieName);
-				list($lastuser, $lastentity) = explode('|', $cookieValue);
-			}
-		}
-	}
-
 	// Login field
 	print '<td valign="bottom"> &nbsp; <b>'.$langs->trans("Login").'</b> &nbsp; </td>'."\n";
 	print '<td valign="bottom" nowrap="nowrap"><input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="';
@@ -204,9 +207,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
 	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
 	{
 		require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
-		
-		global $db;
-		
+
 		$mc = new Multicompany($db);
 		$mc->getEntities();
 
@@ -248,7 +249,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
 		if (! empty($conf->browser->phone)) print '<tr><td colspan="3">&nbsp;</td></tr>';	// More space with phones
 
 		print '<tr><td colspan="3" align="center">';
-		
+
 		if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
 		{
 			print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">(';
@@ -336,6 +337,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
  */
 function dol_loginfunction2($langs,$conf,$mysoc)
 {
+	global $dolibarr_main_demo,$db;
 	global $smarty;
 
 	$langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]);
@@ -344,14 +346,14 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 	$langs->load("main");
 	$langs->load("other");
 	$langs->load("help");
-	
+
 	$smarty->assign('langs', $langs);
-	
+
 	if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER);
-	
+
 	$php_self = $_SERVER['PHP_SELF'];
 	$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
-	
+
 	$smarty->assign('php_self', $php_self);
 	$smarty->assign('character_set_client',$conf->file->character_set_client);
 
@@ -378,11 +380,9 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 		{
 			$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
 		}
-		
-		$conf->css  = "theme/".$conf->theme."/".$conf->theme.".css";
-		
-		// Si feuille de style en php existe
-		if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang;
+
+		$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
+		$conf->css.=".php?lang=".$langs->defaultlang;
 		$smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css);
 	}
 
@@ -394,28 +394,24 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 
 	if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
 	else unset($_SESSION["urlfrom"]);
-	
+
 	if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
 	else $smarty->assign('focus_element', 'password');
-	
+
+	$login_background=DOL_URL_ROOT.'/theme/login_background.png';
 	if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
 	{
 		$smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png');
 	}
-	else
-	{
-		$smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png');
-	}
 
 	// Title
 	$title='Dolibarr '.DOL_VERSION;
 	if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
-	
+
 	$smarty->assign('title', $title);
 
 	$demologin='';
 	$demopassword='';
-	global $dolibarr_main_demo;
 	if (! empty($dolibarr_main_demo))
 	{
 		$tab=explode(',',$dolibarr_main_demo);
@@ -447,14 +443,15 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 
 	// Login
 	$login = (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin));
+	$password = $demopassword;
 	$smarty->assign('login', $login);
-	$smarty->assign('password', $demopassword);
+	$smarty->assign('password', $password);
 
 	// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
 	$width=0;
 	$rowspan=2;
 	$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
-	
+
 	if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
 	{
 		$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
@@ -468,30 +465,30 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 	{
 		$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
 	}
-	
+
 	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
-	
+
 	$smarty->assign('logo', $urllogo);
 	$smarty->assign('logo_width', $width);
 	$smarty->assign('logo_rowspan', $rowspan);
-	
+
 	// Entity field
 	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
 	{
 		require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
-		
-		global $db;
-		
+
 		$mc = new Multicompany($db);
 		$mc->getEntities();
 
-		$smarty->assign('select_entity', $mc->select_entities($mc->entities,$lastentity,'tabindex="3"'));
+		$select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
+		$smarty->assign('select_entity', $select_entity);
 	}
 
 	// Security graphical code
 	if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
 	{
-		$smarty->assign('captcha', 1);
+		$captcha=1;
+		$smarty->assign('captcha', $captcha);
 		$smarty->assign('captcha_refresh', img_refresh());
 	}
 
@@ -500,12 +497,14 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 	{
 		if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
 		{
-			$smarty->assign('forgetpasslink', 1);
+			$forgetpasslink=1;
+			$smarty->assign('forgetpasslink', $forgetpasslink);
 		}
 
 		if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
 		{
-			$smarty->assign('helpcenterlink', 1);
+			$helpcenterlink=1;
+			$smarty->assign('helpcenterlink', $helpcenterlink);
 		}
 	}
 
@@ -529,28 +528,29 @@ function dol_loginfunction2($langs,$conf,$mysoc)
 		$smarty->assign('main_google_ad_slot', $conf->global->MAIN_GOOGLE_AD_SLOT);
 		$smarty->assign('main_google_ad_width', $conf->global->MAIN_GOOGLE_AD_WIDTH);
 		$smarty->assign('main_google_ad_height', $conf->global->MAIN_GOOGLE_AD_HEIGHT);
-		
+
 		$google_ad_template = DOL_DOCUMENT_ROOT."/core/templates/google_ad.tpl";
 		$smarty->assign('google_ad_tpl', $google_ad_template);
 	}
-	
+
 	if (! empty($conf->global->MAIN_HTML_FOOTER)) $smarty->assign('main_html_footer', $conf->global->MAIN_HTML_FOOTER);
-	
+
 	$smarty->assign('main_authentication', $conf->file->main_authentication);
 	$smarty->assign('session_name', session_name());
-	
+
 	// Message
 	if (! empty($_SESSION["dol_loginmesg"]))
 	{
 		$smarty->assign('dol_loginmesg', $_SESSION["dol_loginmesg"]);
 	}
-	
+
 	// Creation du template
-	$smarty->display('login.tpl');
-	
+	$smarty->display('login.tpl');	// To use Smarty
+//	include(DOL_DOCUMENT_ROOT.'/core/templates/login.tpl.php');	// To use native PHP
+
 	// Suppression de la version compilee
 	$smarty->clear_compiled_tpl('login.tpl');
-	
+
 	$_SESSION["dol_loginmesg"] = '';
 }
 
@@ -746,7 +746,7 @@ function dol_avscan_file($file)
 
 /**
  * Return array of ciphers mode available
- * 
+ *
  * @return strAv	Configuration file content
  */
 function dol_efc_config()
@@ -756,59 +756,59 @@ function dol_efc_config()
 	{
 		return -1;
 	}
-	
+
 	// Set a temporary $key and $data for encryption tests
 	$key = md5(time() . getmypid());
 	$data = mt_rand();
-	
+
 	// Get and sort available cipher methods
 	$ciphers = mcrypt_list_algorithms();
 	natsort($ciphers);
-	
+
 	// Get and sort available cipher modes
 	$modes = mcrypt_list_modes();
 	natsort($modes);
-	
+
 	foreach ($ciphers as $cipher)
 	{
 		foreach ($modes as $mode)
 		{
 			// Not Compatible
 			$result = 'false';
-			
+
 			// open encryption module
 			$td = @mcrypt_module_open($cipher, '', $mode, '');
-			
+
 			// if we could open the cipher
 			if ($td)
 			{
 				// try to generate the iv
 				$iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
-				
+
 				// if we could generate the iv
 				if ($iv)
 				{
 					// initialize encryption
 					@mcrypt_generic_init ($td, $key, $iv);
-					
+
 					// encrypt data
 					$encrypted_data = mcrypt_generic($td, $data);
-					
+
 					// cleanup
 					mcrypt_generic_deinit($td);
-					
+
 					// No error issued
 					$result = 'true';
 				}
-				
+
 				// close
 				@mcrypt_module_close($td);
 			}
-			
+
 			if ($result == "true") $available["$cipher"][] = $mode;
 		}
 	}
-	
+
 	if (count($available) > 0)
 	{
        // Content of configuration
@@ -820,7 +820,7 @@ function dol_efc_config()
        $strAv.= " * This file is licensed under GNU GPL version 2 or above.\n";
        $strAv.= " * Please visit http://www.gnu.org to now more about it.\n";
        $strAv.= " */\n\n";
-       $strAv.= "/**\n"; 
+       $strAv.= "/**\n";
        $strAv.= " *  Name: EasyFileCrypt Extending Crypt Class\n";
        $strAv.= " *  Version: 1.0\n";
        $strAv.= " *  Created: ".date("r")."\n";
@@ -847,7 +847,7 @@ function dol_efc_config()
           $strAv = substr($strAv, 0, strlen($strAv) - 1);
        $strAv .= " );\n\n";
        $strAv .= "?>";
-       
+
        return $strAv;
    }
 }
diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php
index f620032dc8919336a96cfdea69e530ea9eeb81a8..d22734d97d0cdaad32fab5aef35c34fc922ac0ec 100644
--- a/htdocs/user/passwordforgotten.php
+++ b/htdocs/user/passwordforgotten.php
@@ -142,16 +142,16 @@ if ($_POST["action"] == 'buildnewpassword' && $_POST["username"])
 if ($conf->global->MAIN_SMARTY)
 {
 	$smarty->assign('langs', $langs);
-	
+
 	$php_self = $_SERVER['PHP_SELF'];
 	$php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
-	
+
 	$smarty->assign('php_self', $php_self);
 	$smarty->assign('character_set_client',$conf->file->character_set_client);
 	$smarty->assign('dol_url_root', DOL_URL_ROOT);
 	$smarty->assign('mode', $mode);
 	$smarty->assign('login', $login);
-	
+
 	// Select templates
 	if ($conf->browser->phone)
 	{
@@ -167,22 +167,22 @@ if ($conf->global->MAIN_SMARTY)
 	}
 	else
 	{
-		if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/user/passwordforgotten.tpl"))
+		if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/core/templates/passwordforgotten.tpl"))
 		{
-			$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/user/";
+			$smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/core/";
 		}
 		else
 		{
-			$smarty->template_dir = DOL_DOCUMENT_ROOT."/user/templates/";
+			$smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/";
 		}
-		
+
 		$conf->css  = "theme/".$conf->theme."/".$conf->theme.".css";
-		
+
 		// Si feuille de style en php existe
 		if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang;
 		$smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css);
 	}
-	
+
 	if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
 	{
 		$smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png');
@@ -191,26 +191,26 @@ if ($conf->global->MAIN_SMARTY)
 	{
 		$smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png');
 	}
-	
+
 	if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username');
 	else $smarty->assign('focus_element', 'password');
-	
+
 	// Title
 	$title='Dolibarr '.DOL_VERSION;
 	if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
 	$smarty->assign('title', $title);
-	
+
 	// Send password button enabled ?
 	$disabled='disabled';
 	if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled='';
 	if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled='';	 // To force button enabled
 	$smarty->assign('disabled', $disabled);
-	
+
 	// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
 	$width=0;
 	$rowspan=2;
 	$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
-	
+
 	if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
 	{
 		$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('thumbs/'.$mysoc->logo_small);
@@ -224,20 +224,20 @@ if ($conf->global->MAIN_SMARTY)
 	{
 		$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
 	}
-	
+
 	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
-	
+
 	$smarty->assign('logo', $urllogo);
 	$smarty->assign('logo_width', $width);
 	$smarty->assign('logo_rowspan', $rowspan);
-	
+
 	// Entity field
 	if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)  && ! $disabled)
 	{
 		require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
-		
+
 		global $db;
-		
+
 		$mc = new Multicompany($db);
 		$mc->getEntities();
 
@@ -250,16 +250,16 @@ if ($conf->global->MAIN_SMARTY)
 		$smarty->assign('captcha', 1);
 		$smarty->assign('captcha_refresh', img_refresh());
 	}
-	
+
 	// Message
 	if ($message)
 	{
 		$smarty->assign('error_message', $message);
 	}
-	
+
 	// Creation du template
 	$smarty->display('passwordforgotten.tpl');
-	
+
 	// Suppression de la version compilee
 	$smarty->clear_compiled_tpl('passwordforgotten.tpl');
 }
@@ -268,11 +268,11 @@ else
 	$conf->css  = "theme/".$conf->theme."/".$conf->theme.".css";
 	// Si feuille de style en php existe
 	if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
-	
+
 	header('Cache-Control: Public, must-revalidate');
-	
+
 	print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
-	
+
 	// En tete html
 	print "<html>\n";
 	print "<head>\n";
@@ -310,15 +310,15 @@ else
 	print "}\n";
 	print '</script>'."\n";
 	print '</head>'."\n";
-	
+
 	// Body
 	print '<body class="body" onload="donnefocus();">'."\n";
-	
+
 	// Form
 	print '<form id="login" action="'.$_SERVER["PHP_SELF"].'" method="post" name="login">'."\n";
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 	print '<input type="hidden" name="action" value="buildnewpassword">'."\n";
-	
+
 	// Table 1
 	$title='Dolibarr '.DOL_VERSION;
 	if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
@@ -334,23 +334,23 @@ else
 	}
 	print '</table>'."\n";
 	print '<br>'."\n";
-	
+
 	// Send password button enabled ?
 	$disabled='disabled';
 	if ($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') $disabled='';
 	if ($conf->global->MAIN_SECURITY_ENABLE_SENDPASSWORD) $disabled='';				// To force button enabled
-	
+
 	// Table 2
 	print '<table class="login" cellpadding="2" align="center">'."\n";
-	
+
 	print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
-	
+
 	print '<tr>';
 	print '<td align="left" valign="bottom"><br> &nbsp; <b>'.$langs->trans("Login").'</b>  &nbsp;</td>';
 	print '<td valign="bottom"><input id="username" type="text" '.$disabled.' name="username" class="flat" size="15" maxlength="25" value="'.$login.'" tabindex="1" /></td>';
-	
+
 	$title='';
-	
+
 	// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
 	$width=0;
 	$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
@@ -376,15 +376,15 @@ else
 	}
 	print '</td>';
 	print '</tr>'."\n";
-	
+
 	if (function_exists("imagecreatefrompng") && ! $disabled)
 	{
 		if (! empty($conf->browser->phone)) print '<tr><td colspan="3">&nbsp;</td></tr>';	// More space with phones
-		
+
 		//print "Info session: ".session_name().session_id();print_r($_SESSION);
 		print '<tr><td align="left" valign="middle" nowrap="nowrap"> &nbsp; <b>'.$langs->trans("SecurityCode").'</b></td>';
 		print '<td valign="top" nowrap="nowrap" align="left" class="e">';
-		
+
 		print '<table style="width: 100px;"><tr>';	// Force width to a small value
 		print '<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="2"></td>';
 		$width=128;$height=36;
@@ -392,21 +392,21 @@ else
 		print '<td><img src="'.DOL_URL_ROOT.'/lib/antispamimage.php" border="0" width="'.$width.'" height="'.$height.'"></td>';
 		print '<td><a href="'.$_SERVER["PHP_SELF"].'">'.img_refresh().'</a></td>';
 		print '</tr></table>';
-		
+
 		print '</td>';
 		print '</tr>';
 	}
-	
+
 	print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
-	
+
 	print '<tr><td colspan="3" style="text-align:center;"><br>';
 	print '<input id="password" type="submit" '.$disabled.' class="button" name="password" value="'.$langs->trans("SendNewPassword").'" tabindex="4">';
 	print '</td></tr>'."\n";
-	
+
 	print "</table>"."\n";
-	
+
 	print "</form>"."\n";
-	
+
 	print '<center>'."\n";
 	print '<table width="90%"><tr><td align="center">';
 	if (($mode == 'dolibarr' || $mode == 'dolibarr_mdb2') || (! $disabled))
@@ -418,20 +418,20 @@ else
 		print '<div class="warning" align="center">'.$langs->trans("AuthenticationDoesNotAllowSendNewPassword",$mode).'</div>'."\n";
 	}
 	print '</td></tr></table><br>';
-	
+
 	if ($message)
 	{
 		print '<table width="90%"><tr><td align="center" style="font-size: 12px;">';
 		print $message.'</td></tr></table><br>';
 	}
-	
+
 	print '<br>'."\n";
 	print '<a href="'.DOL_URL_ROOT.'/">'.$langs->trans("BackToLoginPage").'</a>';
 	print '</center>'."\n";
-	
+
 	print "<br>";
 	print "<br>";
-	
+
 	// Fin entete html
 	print "\n</body>\n</html>";
 }
diff --git a/htdocs/user/templates/index.php b/htdocs/user/templates/index.php
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000