diff --git a/admin/index.php b/admin/index.php
index 4c5ebf7ded3021a8e0026d79ed39725773aa2cbe..e1abb1efaf7997ae4d2efc6f544a3ab96d207e6d 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -60,7 +60,9 @@ while($dsondage = $sondage->FetchNextObject(false)) {
 $sondage=$connect->Execute("select * from sondage WHERE date_fin > DATE_SUB(now(), INTERVAL 3 MONTH) ORDER BY date_fin ASC");
 $nbsondages=$sondage->RecordCount();
 
-echo '<p>' . $nbsondages. ' ' . _("polls in the database at this time") .'</p>'."\n";
+$btn_logs = (is_readable('logs_studs.txt')) ? '<a role="button" class="btn btn-default btn-xs pull-right" href="'.str_replace('/admin','', Utils::get_server_name()).'admin/logs_studs.txt">'. _("Logs") .'</a>' : '';
+
+echo '<p>' . $nbsondages. ' ' . _("polls in the database at this time") . $btn_logs .'</p>'."\n";
 
 // tableau qui affiche tous les sondages de la base
 echo '<table class="table table-bordered">
@@ -101,9 +103,9 @@ while($dsondage = $sondage->FetchNextObject(false)) {
     }
     echo '
         <td>'.$nbuser.'</td>
-        <td><a href="' . Utils::getUrlSondage($dsondage->id_sondage) . '" class="btn btn-link" title="'. _("See the poll") .'"><span class="glyphicon glyphicon-eye-open"></span></a></td>
-        <td><a href="' . Utils::getUrlSondage($dsondage->id_sondage_admin, true) . '" class="btn btn-link" title="'. _("Change the poll") .'"><span class="glyphicon glyphicon-pencil"></span></a></td>
-        <td><button type="submit" name="supprimersondage'.$dsondage->id_sondage.'" value="'. _("Remove the poll") .'" class="btn btn-link" title="'. _("Remove the poll") .'"><span class="glyphicon glyphicon-trash text-danger"></span></td>
+        <td><a href="' . Utils::getUrlSondage($dsondage->id_sondage) . '" class="btn btn-link" title="'. _("See the poll") .'"><span class="glyphicon glyphicon-eye-open"></span><span class="sr-only">' . _("See the poll") . '</span></a></td>
+        <td><a href="' . Utils::getUrlSondage($dsondage->id_sondage_admin, true) . '" class="btn btn-link" title="'. _("Change the poll") .'"><span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _("Change the poll") . '</span></a></td>
+        <td><button type="submit" name="supprimersondage'.$dsondage->id_sondage.'" value="'. _("Remove the poll") .'" class="btn btn-link" title="'. _("Remove the poll") .'"><span class="glyphicon glyphicon-trash text-danger"></span><span class="sr-only">' . _("Remove the poll") . '</span></td>
     </tr>'."\n";
     $i++;
 }
diff --git a/adminstuds.php b/adminstuds.php
index fc2ffebde1cbd51574dcc7ee15281d20ff5389a2..67759b81208150bce887afff01410e3de6cb2ce7 100644
--- a/adminstuds.php
+++ b/adminstuds.php
@@ -76,26 +76,36 @@ if (!$sondage || $sondage->RecordCount() != 1){
 $dsujet=$sujets->FetchObject(false);
 $dsondage=$sondage->FetchObject(false);
 
+// Send email (only once during the session) to alert admin of the change he made
+$email_admin = $dsondage->mail_admin;
+function send_mail_admin() {
+    global $email_admin;
+    global $numsondageadmin;
+
+    if(!isset($_SESSION["mail_admin_sent"])) {
+        Utils::sendEmail( $email_admin,
+            _("[ADMINISTRATOR] New settings for your poll") . ' ' . stripslashes( $dsondage->titre ),
+            _("You have changed the settings of your poll. \nYou can modify this poll with this link") .
+              " :\n\n" . Utils::getUrlSondage($numsondageadmin, true) . "\n\n" .
+            _("Thanks for your confidence.") . "\n" . NOMAPPLICATION
+            );
+        $_SESSION["mail_admin_sent"]=true;
+    }
+}
 
 //si la valeur du nouveau titre est valide et que le bouton est activé
-$adresseadmin = $dsondage->mail_admin;
-
 if (isset($_POST["boutonnouveautitre"])) {
     if (Utils::issetAndNoEmpty('nouveautitre') === false) {
         $err |= TITLE_EMPTY;
     } else {
-        //modification de la base SQL avec le nouveau titre
+        //Update SQL database with new title
         $nouveautitre = htmlentities(html_entity_decode($_POST['nouveautitre'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
         $sql = 'UPDATE sondage SET titre = '.$connect->Param('nouveautitre').' WHERE id_sondage = '.$connect->Param('numsondage');
         $sql = $connect->Prepare($sql);
 
-        //envoi du mail pour prevenir l'admin de sondage
+        //Email sent to the admin
         if ($connect->Execute($sql, array($nouveautitre, $numsondage))) {
-            Utils::sendEmail( $adresseadmin,
-                _("[ADMINISTRATOR] New title for your poll") . ' ' . NOMAPPLICATION,
-                _("You have changed the title of your poll. \nYou can modify this poll with this link") .
-                " :\n\n" . Utils::getUrlSondage($numsondageadmin, true) . "\n\n" .
-                _("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
+            send_mail_admin();
         }
     }
 }
@@ -107,17 +117,13 @@ if (isset($_POST["boutonnouveauxcommentaires"])) {
     } else {
         $commentaires = htmlentities(html_entity_decode($_POST['nouveauxcommentaires'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
 
-        //modification de la base SQL avec les nouveaux commentaires
+        //Update SQL database with new description
         $sql = 'UPDATE sondage SET commentaires = '.$connect->Param('commentaires').' WHERE id_sondage = '.$connect->Param('numsondage');
         $sql = $connect->Prepare($sql);
 
+        //Email sent to the admin
         if ($connect->Execute($sql, array($commentaires, $numsondage))) {
-            //envoi du mail pour prevenir l'admin de sondage
-            Utils::sendEmail( $adresseadmin,
-                _("[ADMINISTRATOR] New description of your poll") . ' ' . NOMAPPLICATION,
-                _("You have changed the description of your poll. \nYou can modify this poll with this link") .
-                " :\n\n" . Utils::getUrlSondage($numsondageadmin, true) . " \n\n" .
-                _("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
+            send_mail_admin();
         }
     }
 }
@@ -129,21 +135,38 @@ if (isset($_POST["boutonnouvelleadresse"])) {
     } else {
         $nouvelleadresse = htmlentities(html_entity_decode($_POST['nouvelleadresse'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
 
-        //modification de la base SQL avec la nouvelle adresse
+        //Update SQL database with new email
         $sql = 'UPDATE sondage SET mail_admin = '.$connect->Param('nouvelleadresse').' WHERE id_sondage = '.$connect->Param('numsondage');
         $sql = $connect->Prepare($sql);
 
+        //Email sent to the admin
         if ($connect->Execute($sql, array($nouvelleadresse, $numsondage))) {
-            //envoi du mail pour prevenir l'admin de sondage
-            Utils::sendEmail( $_POST['nouvelleadresse'],
-                _("[ADMINISTRATOR] New email address for your poll") . ' ' . NOMAPPLICATION,
-                _("You have changed your email address in your poll. \nYou can modify this poll with this link") .
-                " :\n\n" . Utils::getUrlSondage($numsondageadmin, true) . "\n\n" .
-                _("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
+            send_mail_admin();
         }
     }
 }
 
+//New poll rules
+if (isset($_POST["btn_poll_rules"])) {
+    echo '<!-- '; print_r($_POST); echo ' -->';
+    if($_POST['poll_rules'] == '+') {
+        $new_poll_rules = substr($dsondage->format, 0, 1).'+';
+    } elseif($_POST['poll_rules'] == '-') {
+        $new_poll_rules = substr($dsondage->format, 0, 1).'-';
+    } else {
+        $new_poll_rules = substr($dsondage->format, 0, 1);
+    }
+
+    //Update SQL database with new rules
+    $sql = 'UPDATE sondage SET format = '.$connect->Param('new_poll_rules').' WHERE id_sondage = '.$connect->Param('numsondage');
+    $sql = $connect->Prepare($sql);
+
+    //Email sent to the admin
+    if ($connect->Execute($sql, array($new_poll_rules, $numsondage))) {
+        send_mail_admin();
+    }
+}
+
 // reload
 $dsujet=$sujets->FetchObject(false);
 $dsondage=$sondage->FetchObject(false);
@@ -161,7 +184,7 @@ if (isset($_POST["ajoutsujet"])) {
             <form name="formulaire" class="form-horizontal" action="' . Utils::getUrlSondage($numsondageadmin, true) . '" method="POST">
                 <h2>' . _("Column's adding") . '</h2>'."\n";
 
-    if ($dsondage->format=="A"||$dsondage->format=="A+"){
+    if (substr($dsondage->format, 0, 1)=="A"){
         echo '
                 <div class="form-group">
                     <label for="nouvellecolonne" class="col-md-6">' . _("Add a column") .' :</label>
@@ -224,6 +247,20 @@ if (isset($_POST["suppressionsondage"])) {
     die();
 }
 
+// Remove all the comments
+if (isset($_POST["removecomments"])) {
+    $sql = 'DELETE FROM comments WHERE id_sondage='.$connect->Param('numsondage');
+    $sql = $connect->Prepare($sql);
+    $cleaning = $connect->Execute($sql, array($numsondage));
+}
+
+// Remove all the votes
+if (isset($_POST["removevotes"])) {
+    $sql = 'DELETE FROM user_studs WHERE id_sondage='.$connect->Param('numsondage');
+    $sql = $connect->Prepare($sql);
+    $cleaning = $connect->Execute($sql, array($numsondage));
+}
+
 //action si bouton confirmation de suppression est activé
 if (isset($_POST["confirmesuppression"])) {
     $nbuser=$user_studs->RecordCount();
@@ -233,13 +270,8 @@ if (isset($_POST["confirmesuppression"])) {
         // on ecrit dans le fichier de logs la suppression du sondage
         error_log($date . " SUPPRESSION: $dsondage->id_sondage\t$dsondage->format\t$dsondage->nom_admin\t$dsondage->mail_admin\n", 3, 'admin/logs_studs.txt');
 
-        //envoi du mail a l'administrateur du sondage
-        Utils::sendEmail( $adresseadmin,
-            _("[ADMINISTRATOR] Removing of your poll") . ' ' . NOMAPPLICATION,
-            _("You have removed your poll. \nYou can make new polls with this link") .
-            " :\n\n" . Utils::get_server_name() . "index.php \n\n" .
-            _("Thanks for your confidence.") . "\n" . NOMAPPLICATION );
-
+        // Email sent
+        send_mail_admin();
         //affichage de l'ecran de confirmation de suppression de sondage
         Utils::print_header(_("Your poll has been removed!"));
 
@@ -347,7 +379,7 @@ if (isset($_POST["boutonp"])) {
 
 
 //action quand on ajoute une colonne au format AUTRE
-if (isset($_POST["ajoutercolonne"]) && Utils::issetAndNoEmpty('nouvellecolonne') && ($dsondage->format == "A" || $dsondage->format == "A+")) {
+if (isset($_POST["ajoutercolonne"]) && Utils::issetAndNoEmpty('nouvellecolonne') && (substr($dsondage->format, 0, 1) == "A" )) {
     $nouveauxsujets=$dsujet->sujet;
 
     //on rajoute la valeur a la fin de tous les sujets deja entrés
@@ -359,16 +391,13 @@ if (isset($_POST["ajoutercolonne"]) && Utils::issetAndNoEmpty('nouvellecolonne')
     $sql = 'UPDATE sujet_studs SET sujet = '.$connect->Param('nouveauxsujets').' WHERE id_sondage = '.$connect->Param('numsondage');
     $sql = $connect->Prepare($sql);
     if ($connect->Execute($sql, array($nouveauxsujets, $numsondage))) {
-      //envoi d'un mail pour prévenir l'administrateur du changement
-      Utils::sendEmail( "$adresseadmin", "" . _("[ADMINISTRATOR] New column for your poll").NOMAPPLICATION, "" .
-          _("You have added a new column in your poll. \nYou can inform the voters of this change with this link") .
-          " : \n\n" . Utils::getUrlSondage($numsondage) . " \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
+        send_mail_admin();
     }
 }
 
 
 //action quand on ajoute une colonne au format DATE
-if (isset($_POST["ajoutercolonne"]) && ($dsondage->format == "D" || $dsondage->format == "D+")) {
+if (isset($_POST["ajoutercolonne"]) && (substr($dsondage->format, 0, 1) == "D")) {
     $nouveauxsujets=$dsujet->sujet;
 
     if (isset($_POST["newdate"]) && $_POST["newdate"] != "vide") {
@@ -446,13 +475,8 @@ if (isset($_POST["ajoutercolonne"]) && ($dsondage->format == "D" || $dsondage->f
             }
         }
 
-        //envoi d'un mail pour prévenir l'administrateur du changement
-        $adresseadmin = $dsondage->mail_admin;
-
-        Utils::sendEmail( $adresseadmin,
-            _("[ADMINISTRATOR] New column for your poll"),
-            _("You have added a new column in your poll. \nYou can inform the voters of this change with this link").
-            " : \n\n" . Utils::getUrlSondage($numsondage) . " \n\n " . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
+        //Email sent to the admin
+        send_mail_admin();
 
     } else {
         $erreur_ajout_date="yes";
@@ -644,6 +668,20 @@ $title = (isset($_POST["boutonnouveautitre"]) && Utils::issetAndNoEmpty('nouveau
 $description = (isset($_POST["nouveauxcommentaires"])) ? stripslashes(htmlentities(html_entity_decode($_POST['nouveauxcommentaires'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8')) : stripslashes( $dsondage->commentaires );
 $email_admin = (isset($_POST["boutonnouvelleadresse"]) && Utils::issetAndNoEmpty('nouvelleadresse')) ? htmlentities(html_entity_decode($_POST['nouvelleadresse'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8') : stripslashes( $dsondage->mail_admin );
 
+//Poll format (locked A-/D-, open A/D, editable A+/D+)
+$poll_rules = (isset($_POST["poll_rules"]) && Utils::issetAndNoEmpty('btn_poll_rules')) ? $_POST["poll_rules"] : substr($dsondage->format, 1, 1);
+$poll_rules_opt1 = '';$poll_rules_opt2 = '';$poll_rules_opt3 = '';
+if($poll_rules == '+') {
+    $poll_rules_text = '<span class="glyphicon glyphicon-edit"></span> '. _("Votes are editable");
+    $poll_rules_opt3 = 'selected';
+} elseif($poll_rules == '-') {
+    $poll_rules_text = '<span class="glyphicon glyphicon-lock"></span> '. _("Votes and comments are locked");
+    $poll_rules_opt1 = 'selected';
+} else {
+    $poll_rules_text = '<span class="glyphicon glyphicon-check"></span> '. _("Votes and comments are open");
+    $poll_rules_opt2 = 'selected';
+}
+
 if ($errors!='') {
     Utils::print_header(_("Error!"));
     bandeau_titre(_("Error!"));
@@ -668,8 +706,8 @@ echo '
                         <div class="input-group">
                             <input type="text" class="form-control" id="newtitle" name="nouveautitre" size="40" value="'.$title.'" />
                             <span class="input-group-btn">
-                                <button type="submit" class="btn btn-success" name="boutonnouveautitre" value="1" title="'. _('Save the new title') .'"><span class="glyphicon glyphicon-ok"></span></button>
-                                <button class="btn btn-link btn-cancel" title="'. _('Cancel the title edit') .'"><span class="glyphicon glyphicon-remove"></span></button>
+                                <button type="submit" class="btn btn-success" name="boutonnouveautitre" value="1" title="'. _('Save the new title') .'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Save') . '</span></button>
+                                <button class="btn btn-link btn-cancel" title="'. _('Cancel the title edit') .'"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">' . _('Cancel') . '</span></button>
                             </span>
                         </div>
                     </div>
@@ -678,7 +716,15 @@ echo '
                     <div class="btn-group pull-right">
                         <button onclick="javascript:print(); return false;" class="btn btn-default"><span class="glyphicon glyphicon-print"></span> ' . _('Print') . '</button>
                         <button onclick="window.location.href=\'' . Utils::get_server_name() . 'exportcsv.php?numsondage=' . $numsondage . '\';return false;" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span> ' . _('Export to CSV') . '</button>
-                        <button type="submit" id="suppressionsondage" name="suppressionsondage" value="" class="btn btn-danger" title="'. _("Remove the poll") .'"><span class="glyphicon glyphicon-trash"></span></button>
+                        <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
+                            <span class="glyphicon glyphicon-trash"></span> <span class="sr-only">' . _("Remove") . '</span> <span class="caret"></span>
+                        </button>
+                        <ul class="dropdown-menu" role="menu">
+                            <li><button class="btn btn-link" type="submit" name="removevotes">' . _('Remove all the votes') . '</button></li>
+                            <li><button class="btn btn-link" type="submit" name="removecomments">' . _('Remove all the comments') . '</button></li>
+                            <li class="divider" role="presentation"></li>
+                            <li><button class="btn btn-link" type="submit" id="suppressionsondage" name="suppressionsondage" value="" >'. _("Remove the poll") .'</button></li>
+                        </ul>
                     </div>
                 </div>
             </div>
@@ -696,8 +742,8 @@ echo '
                                 <div class="input-group">
                                     <input type="text" class="form-control" id="newemail" name="nouvelleadresse" size="40" value="'.$email_admin.'" />
                                     <span class="input-group-btn">
-                                        <button type="submit" name="boutonnouvelleadresse" value="1" class="btn btn-success" title="'. _('Save the adress email') .'"><span class="glyphicon glyphicon-ok"></span></button>
-                                        <button class="btn btn-link btn-cancel" title="'. _('Cancel the adress email edit') .'"><span class="glyphicon glyphicon-remove"></span></button>
+                                        <button type="submit" name="boutonnouvelleadresse" value="1" class="btn btn-success" title="'. _('Save the adress email') .'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Save') . '</span></button>
+                                        <button class="btn btn-link btn-cancel" title="'. _('Cancel the adress email edit') .'"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">' . _('Cancel') . '</span></button>
                                     </span>
                                 </div>
                             </div>
@@ -724,10 +770,31 @@ echo '
                     <input class="form-control" id="admin-link" type="text" readonly="readonly" value="' . Utils::getUrlSondage($numsondageadmin, true) . '" />
                 </div>
                 <div class="form-group col-md-2">
-                    <label>'. _("Expiration's date") .'</label>
+                    <h3 class="control-label">'. _("Expiration's date") .'</h3>
                     <p>'.date("d/m/Y",strtotime($dsondage->date_fin)).'</p>
                 </div>
             </div>
+            <div class="row">
+                <div class="col-md-5 col-md-offset-7" >
+                    <div id="poll-rules-form">
+                        <p class="pull-right">'.$poll_rules_text.'<button class="btn btn-link btn-sm btn-edit" title="'. _('Edit the poll rules') .'"><span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span></button></p>
+                        <div class="hidden js-poll-rules">
+                            <label class="sr-only" for="newrules">'. _("Poll rules") .'</label>
+                            <div class="input-group">
+                                <select class="form-control" id="newrules" name="poll_rules">
+                                    <option value="-" '.$poll_rules_opt1.'>'. _("Votes and comments are locked") .'</option>
+                                    <option value="0" '.$poll_rules_opt2.'>'. _("Votes and comments are open") .'</option>
+                                    <option value="+" '.$poll_rules_opt3.'>'. _("Votes are editable") .'</option>
+                                </select>
+                                <span class="input-group-btn">
+                                    <button type="submit" name="btn_poll_rules" value="1" class="btn btn-success" title="'. _('Save the new rules') .'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Save') . '</span></button>
+                                    <button class="btn btn-link btn-cancel" title="'. _('Cancel the rules edit') .'"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">' . _('Cancel') . '</span></button>
+                                </span>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
         </div>
     </form>'."\n"; // .jumbotron
 
@@ -751,7 +818,7 @@ $td_headers = array(); // for a11y, headers="M1 D4 H5" on each td
 $radio_title = array(); // date for
 
 // Dates poll
-if ($dsondage->format=="D"||$dsondage->format=="D+") {
+if (substr($dsondage->format, 0, 1)=="D") {
 
     $tr_months = '<tr><th role="presentation"></th>';
     $tr_days = '<tr><th role="presentation"></th>';
@@ -797,7 +864,7 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
             $hour = substr($current, strpos($current, '@')-count($current)+2);
 
             if ($hour != "") {
-                $tr_hours .= '<th class="bg-info'.$rbd.'" id="H'.$i.'">'.$hour.'</th>';
+                $tr_hours .= '<th class="bg-info'.$rbd.'" id="H'.$i.'" title="'.$hour.'">'.$hour.'</th>';
                 $radio_title[$i] .= ' - '.$hour;
                 $td_headers[$i] .= ' H'.$i;
             } else {
@@ -808,7 +875,7 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
         }
 
         // Remove col
-        $tr_add_remove_col .= (count($toutsujet) > 2 ) ? '<td headers="'.$td_headers[$i].'"><button type="submit" name="effacecolonne'.$i.'" class="btn btn-link btn-sm" title="' . _('Remove the column') . ' ' .$radio_title[$i]. '"><span class="glyphicon glyphicon-remove text-danger"></span></button></td>' : '<td role="presentation"></td>';
+        $tr_add_remove_col .= (count($toutsujet) > 2 ) ? '<td headers="'.$td_headers[$i].'"><button type="submit" name="effacecolonne'.$i.'" class="btn btn-link btn-sm" title="' . _('Remove the column') . ' ' .$radio_title[$i]. '"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">'. _("Remove") .'</span></button></td>' : '<td role="presentation"></td>';
 
     }
 
@@ -819,7 +886,7 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
     $tr_hours .= '<th></th></tr>';
 
     // Add col
-    $tr_add_remove_col .= '<td><button type="submit" name="ajoutsujet" class="btn btn-link btn-sm" title="'. _('Add a column') . '"><span class="glyphicon glyphicon-plus text-success"></span></button></td></tr>';
+    $tr_add_remove_col .= '<td><button type="submit" name="ajoutsujet" class="btn btn-link btn-sm" title="'. _('Add a column') . '"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add a column") .'</span></button></td></tr>';
 
     $thead = "\n".$tr_add_remove_col."\n".$tr_months."\n".$tr_days."\n".$tr_hours."\n";
 
@@ -834,18 +901,42 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
         $td_headers[$i]='';$radio_title[$i]=''; // init before concatenate
 
         // Subjects
-        $tr_subjects .= '<th class="bg-info" id="S'.preg_replace("/[^a-zA-Z0-9]_+/", "", stripslashes($toutsujet[$i])).'">'.stripslashes($toutsujet[$i]).'</th>';
+        preg_match_all('/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/',$toutsujet[$i],$md_a_img);  // Markdown [![alt](src)](href)
+        preg_match_all('/!\[(.*?)\]\((.*?)\)/',$toutsujet[$i],$md_img);                 // Markdown ![alt](src)
+        preg_match_all('/\[(.*?)\]\((.*?)\)/',$toutsujet[$i],$md_a);                    // Markdown [text](href)
+        if (isset($md_a_img[2][0]) && $md_a_img[2][0]!='' && isset($md_a_img[3][0]) && $md_a_img[3][0]!='') { // [![alt](src)](href)
+
+            $th_subject_text = (isset($md_a_img[1][0]) && $md_a_img[1][0]!='') ? stripslashes($md_a_img[1][0]) : _("Choice") .' '.($i+1);
+            $th_subject_html = '<a href="'.$md_a_img[3][0].'"><img src="'.$md_a_img[2][0].'" class="img-responsive" alt="'.$th_subject_text.'" /></a>';
+
+        } elseif (isset($md_img[2][0]) && $md_img[2][0]!='') { // ![alt](src)
+
+            $th_subject_text = (isset($md_img[1][0]) && $md_img[1][0]!='') ? stripslashes($md_img[1][0]) : _("Choice") .' '.($i+1);
+            $th_subject_html = '<img src="'.$md_img[2][0].'" class="img-responsive" alt="'.$th_subject_text.'" />';
+
+        } elseif (isset($md_a[2][0]) && $md_a[2][0]!='') { // [text](href)
+
+            $th_subject_text = (isset($md_a[1][0]) && $md_a[1][0]!='') ? stripslashes($md_a[1][0]) : _("Choice") .' '.($i+1);
+            $th_subject_html = '<a href="'.$md_a[2][0].'">'.$th_subject_text.'</a>';
+
+        } else { // text only
+
+            $th_subject_text = stripslashes($toutsujet[$i]);
+            $th_subject_html = $th_subject_text;
+
+        }
+        $tr_subjects .= '<th class="bg-info" id="S'.$i.'" title="'.$th_subject_text.'">'.$th_subject_html.'</th>';
 
         $border[$i] = false;
-        $td_headers[$i] .= stripslashes($toutsujet[$i]);
-        $radio_title[$i] .= stripslashes($toutsujet[$i]);
+        $td_headers[$i] .= 'S'.$i;
+        $radio_title[$i] .= $th_subject_text;
 
         // Remove col
-        $tr_add_remove_col .= '<td headers="'.$td_headers[$i].'"><button type="submit" name="effacecolonne'.$i.'" class="btn btn-link btn-sm" title="' . _('Remove the column') . ' '. $radio_title[$i] .'"><span class="glyphicon glyphicon-remove text-danger"></span></button></td>';
+        $tr_add_remove_col .= '<td headers="'.$td_headers[$i].'"><button type="submit" name="effacecolonne'.$i.'" class="btn btn-link btn-sm" title="' . _('Remove the column') . ' '. $radio_title[$i] .'"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') .'</span></button></td>';
     }
 
     // Add col
-    $tr_add_remove_col .= '<td><button type="submit" name="ajoutsujet" class="btn btn-link btn-sm" title="'. _('Add a column') . '"><span class="glyphicon glyphicon-plus text-success"></span></button></td></tr>';
+    $tr_add_remove_col .= '<td><button type="submit" name="ajoutsujet" class="btn btn-link btn-sm" title="'. _('Add a column') . '"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add a column") .'</span></button></td></tr>';
 
     $thead = $tr_add_remove_col.$tr_subjects.'<th></th></tr>';
 }
@@ -859,10 +950,23 @@ echo '
            ' . _(' remove a column or a line with ') . '<span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') . '</span>
            ' . _('and add a new column with '). '<span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _('Add a column') . '</span></p>
         <p>' . _('Finally, you can change the informations of this poll like the title, the comments or your email address.') . '</p>
+        <p><b>' . _('Legend:'). '</b> <span class="glyphicon glyphicon-ok"></span> =' . _('Yes') . ', <b>(<span class="glyphicon glyphicon-ok"></span>)</b> = ' . _('Ifneedbe') . ', <span class="glyphicon glyphicon-ban-circle"></span> = ' . _('No') . '</span></p>
+    </div>
+
+    <div class="hidden row scroll-buttons" aria-hidden="true">
+        <div class="btn-group pull-right">
+            <button class="btn btn-sm btn-link scroll-left" title="' . _('Scroll to the left') . '">
+                <span class="glyphicon glyphicon-chevron-left"></span>
+            </button>
+            <button class="btn  btn-sm btn-link scroll-right" title="' . _('Scroll to the right') . '">
+                <span class="glyphicon glyphicon-chevron-right"></span>
+            </button>
+        </div>
     </div>
+
     <div id="tableContainer" class="tableContainer">
     <table class="results">
-        <caption>'._('Votes of the poll ').$title.'</caption>
+        <caption class="sr-only">'._('Votes of the poll ').$title.'</caption>
         <thead>'. $thead . '</thead>
         <tbody>';
 
@@ -953,8 +1057,15 @@ while ($data = $user_studs->FetchNextObject(false)) {
 
     //a la fin de chaque ligne se trouve les boutons modifier
     if (!$testligneamodifier=="true") {
-        echo '<td><button type="submit" class="btn btn-link btn-sm" name="modifierligne'.$compteur.'" title="'. _('Edit the line:') .' '.stripslashes($nombase).'">
-        <span class="glyphicon glyphicon-pencil"></span></button><button type="submit" name="effaceligne'.$compteur.'" title="'. _('Remove the line:') .' '.stripslashes($nombase).'" class="btn btn-link btn-sm"><span class="glyphicon glyphicon-remove text-danger"></span></button></td>'."\n";
+        echo '
+                <td>
+                    <button type="submit" class="btn btn-link btn-sm" name="modifierligne'.$compteur.'" title="'. _('Edit the line:') .' '.stripslashes($nombase).'">
+                        <span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span>
+                    </button>
+                    <button type="submit" name="effaceligne'.$compteur.'" title="'. _('Remove the line:') .' '.stripslashes($nombase).'" class="btn btn-link btn-sm">
+                        <span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') . '</span>
+                    </button>
+                </td>'."\n";
     }
 
     //demande de confirmation pour modification de ligne
@@ -1015,86 +1126,74 @@ if (!$testligneamodifier=="true") {
 
 // Addition and Best choice
 //affichage de la ligne contenant les sommes de chaque colonne
-$tr_addition = '<tr><td>'. _("Addition") .'</td>';
-$tr_bestchoice = '<tr><td></td>';
-$meilleurecolonne = 0;
-
-for ($i = 0; $i < $nbcolonnes; $i++) {
-    if (isset($somme[$i]) && $somme[$i] > 0 ) {
-        if (isset($somme[$i]) && $somme[$i] > $meilleurecolonne){
-            $meilleurecolonne = $somme[$i];
-        }
-        $tr_addition .= '<td>'.$somme[$i].'</td>';
-    } else {
-        $tr_addition .= '<td></td>';
-    }
-}
-$tr_addition .= '<td></td></tr>';
-
-//recuperation des valeurs des sujets et adaptation pour affichage
-$toutsujet = explode(",", $dsujet->sujet);
-
+$tr_addition = '<tr id="addition"><td>'. _("Addition") .'</td>';
+$meilleurecolonne = max($somme);
 $compteursujet = 0;
 $meilleursujet = '<ul style="list-style:none">';
 for ($i = 0; $i < $nbcolonnes; $i++) {
+    if (isset($somme[$i]) && $somme[$i] > 0 ) {
+        if (in_array($i, array_keys($somme, max($somme)))){
 
-    if (isset($somme[$i]) && $somme[$i] > 0 && $somme[$i] == $meilleurecolonne){
-        $tr_bestchoice .= '<td><span class="glyphicon glyphicon-star text-warning"></span></td>';
+            $tr_addition .= '<td><span class="glyphicon glyphicon-star text-warning"></span><span>'.$somme[$i].'</span></td>';
 
-        if ($dsondage->format == "D" || $dsondage->format == "D+") {
-            $meilleursujetexport = $toutsujet[$i];
+            $meilleursujet.= '<li><b>'.$radio_title[$i].'</b></li>';
+            $compteursujet++;
 
-            if (strpos($toutsujet[$i], '@') !== false) {
-                $toutsujetdate = explode("@", $toutsujet[$i]);
-                $meilleursujet .= '<li><b>'.strftime(_("%A, den %e. %B %Y"),$toutsujetdate[0]). ' - ' . $toutsujetdate[1].'</b></li>';
-            } else {
-                $meilleursujet .= '<li><b>'.strftime(_("%A, den %e. %B %Y"),$toutsujet[$i]).'</b></li>';
-            }
         } else {
-            $meilleursujet.= '<li><b>'.$toutsujet[$i].'</b></li>';
+            $tr_addition .= '<td>'.$somme[$i].'</td>';
         }
-        $compteursujet++;
-
     } else {
-        $tr_bestchoice .= '<td></td>';
+        $tr_addition .= '<td></td>';
     }
 }
-$tr_bestchoice .= '<td></td></tr>';
+$tr_addition .= '<td></td></tr>';
+
+//recuperation des valeurs des sujets et adaptation pour affichage
+$toutsujet = explode(",", $dsujet->sujet);
 
 $meilleursujet = str_replace("°", "'", $meilleursujet).'</ul>';
 $vote_str = ($meilleurecolonne > 1) ? $vote_str = _('votes') : _('vote');
 
 // Print Addition and Best choice
-echo $tr_addition."\n".$tr_bestchoice.'
+echo $tr_addition.'
         </tbody>
     </table>
-        <div class="col-sm-4 col-sm-offset-4"><p>'."\n";
+    </div>
+    <div class="row">'."\n";
 
 if ($compteursujet == 1) {
-    echo '<span class="glyphicon glyphicon-star text-warning"></span> ' . _("The best choice at this time is:") . '</p>' . $meilleursujet . '<p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . ".\n";
+    echo '
+        <div class="col-sm-6 col-sm-offset-3 alert alert-success">
+            <p><span class="glyphicon glyphicon-star text-warning"></span> ' . _("The best choice at this time is:") . '</p>
+            ' . $meilleursujet . '
+            <p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . '.</p>
+        </div>'."\n";
 } elseif ($compteursujet > 1) {
-    echo '<span class="glyphicon glyphicon-star text-warning"></span> ' . _("The bests choices at this time are:") . '</p>' . $meilleursujet . '<p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . ".\n";
+    echo '
+        <div class="col-sm-6 col-sm-offset-3 alert alert-success">
+            <p><span class="glyphicon glyphicon-star text-warning"></span> ' . _("The bests choices at this time are:") . '</p>
+            ' . $meilleursujet . '
+            <p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . '.</p>
+        </div>'."\n";
 }
 
 echo '
-        </p></div>
     </div>
-
     <hr />
-<form name="formulaire4" action="#bas" method="POST">'."\n";
+<form name="formulaire4" action="#" method="POST">'."\n";
 // Commments
 $sql = 'SELECT * FROM comments WHERE id_sondage='.$connect->Param('numsondage').' ORDER BY id_comment';
 $sql = $connect->Prepare($sql);
 $comment_user = $connect->Execute($sql, array($numsondage));
 
 if ($comment_user->RecordCount() != 0) {
-    echo '<div class="row"><h3>' . _("Comments of polled people") . '</h3>'."\n";
+    echo '<div><h3>' . _("Comments of polled people") . '</h3>'."\n";
 
     $i = 0;
     while ( $dcomment=$comment_user->FetchNextObject(false)) {
         echo '
     <div class="comment">
-        <button type="submit" name="suppressioncomment'.$i.'" class="btn btn-link" title="' . _('Remove the comment') . '"><span class="glyphicon glyphicon-remove text-danger"></span></button>
+        <button type="submit" name="suppressioncomment'.$i.'" class="btn btn-link" title="' . _('Remove the comment') . '"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') . '</span></button>
         <b>'.stripslashes($dcomment->usercomment). ' :</b>
         <span class="comment">' . stripslashes(nl2br($dcomment->comment)) . '</span>
     </div>';
@@ -1103,7 +1202,7 @@ if ($comment_user->RecordCount() != 0) {
     echo '</div>';
 }
 echo '
-    <div class="row hidden-print alert alert-info">
+    <div class="hidden-print alert alert-info">
         <div class="col-md-6 col-md-offset-3">
             <fieldset id="add-comment"><legend>' . _("Add a comment in the poll") . '</legend>
                 <div class="form-group">
@@ -1116,9 +1215,8 @@ echo '
                 <p class="text-center"><input type="submit" name="ajoutcomment" value="'. _("Send the comment") .'" class="btn btn-success"></p>
             </fieldset>
         </div>
+        <div class="clearfix"></div>
     </div>
-</form>
-
-<a id="bas"></a>';
+</form>';
 
 bandeau_pied();
diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php
index 3b7ce54428809e8aaa6a2ae9995326c07b2c74c4..99f6d8dfe6ac003b71241704312ea66ccf70ccd3 100644
--- a/app/classes/Framadate/Utils.php
+++ b/app/classes/Framadate/Utils.php
@@ -90,6 +90,7 @@ class Utils
         <link rel="stylesheet" href="' . self::get_server_name() . 'css/bootstrap-accessibility.css">
         <link rel="stylesheet" href="' . self::get_server_name() . 'css/datepicker3.css">
         <link rel="stylesheet" href="' . self::get_server_name() . 'css/style.css">
+        <link rel="stylesheet" href="' . self::get_server_name() . 'css/frama.css">
         <link rel="stylesheet" href="' . self::get_server_name() . 'css/print.css" media="print">
         <script type="text/javascript" src="' . self::get_server_name() . 'js/jquery-1.11.1.min.js"></script>
         <script type="text/javascript" src="' . self::get_server_name() . 'js/bootstrap.min.js"></script>
@@ -104,7 +105,7 @@ class Utils
         echo '
     </head>
     <body>
-    <div class="container">';
+    <div class="container ombre">';
 
     }
 
@@ -161,7 +162,7 @@ class Utils
             $replyTo = $headers;
             $headers = ''; // on reinitialise $headers
         } else {
-            $replyTo = ADRESSEEMAILREPONSEAUTO;
+            $replyTo = ADRESSEMAILREPONSEAUTO;
         }
 
         $from = sprintf( "From: %s%s <%s>\n", $encoded_app, $folding, ADRESSEMAILADMIN);
@@ -176,7 +177,7 @@ class Utils
         $headers .= "Content-Type: text/plain; charset=UTF-8\n";
         $headers .= "Content-Transfer-Encoding: 8bit";
 
-        $body = html_entity_decode($body, ENT_QUOTES, 'UTF-8');
+        $body = html_entity_decode($body, ENT_QUOTES, 'UTF-8')._("\n--\n\n« La route est longue, mais la voie est libre… »\nFramasoft ne vit que par vos dons (déductibles des impôts).\nMerci d'avance pour votre soutien http://soutenir.framasoft.org.");
 
         mail($to, $subject, $body, $headers, $param);
     }
diff --git a/app/inc/i18n.php b/app/inc/i18n.php
index 20290c37c577a407b3df8d48132e98035421e953..f5cff48dd0de111f1a92717dd4f351dfafc323eb 100644
--- a/app/inc/i18n.php
+++ b/app/inc/i18n.php
@@ -23,7 +23,15 @@ if (isset($_POST['lang']) && is_string($_POST['lang']) && in_array($_POST['lang'
 } elseif ( isset($_COOKIE['lang']) && is_string($_COOKIE['lang']) && in_array($_COOKIE['lang'], array_keys($ALLOWED_LANGUAGES)) ) {
     $mlocale = $_COOKIE['lang'] ;
 } else {
-    $mlocale = LANGUE ;
+
+    $mlocale = LANGUE;
+    // Replace config language by browser language if possible
+    foreach ($ALLOWED_LANGUAGES as $k => $v ) {
+        if (substr($k,0,2)==substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)) {
+            $mlocale = $k;
+        }
+    }
+
 }
 
 $locale = $mlocale . '.utf8';
diff --git a/apropos.php b/apropos.php
deleted file mode 100644
index e7fd1d970868ebb34fdff1e0c78eaa9cd9d9b50f..0000000000000000000000000000000000000000
--- a/apropos.php
+++ /dev/null
@@ -1,279 +0,0 @@
-<?php
-/**
- * This software is governed by the CeCILL-B license. If a copy of this license
- * is not distributed with this file, you can obtain one at
- * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
- *
- * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
- * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
- *
- * =============================
- *
- * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
- * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
- * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
- *
- * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
- * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
- */
-namespace Framadate;
-
-session_start();
-
-include_once __DIR__ . '/app/inc/init.php';
-
-if (file_exists('bandeaux_local.php')) {
-  include_once('bandeaux_local.php');
-} else {
-  include_once('bandeaux.php');
-}
-
-//affichage de la page
-Utils::print_header( _("About") );
-bandeau_titre(_("About"));
-
-echo <<<mentions
-<ul>
-  <li><a href="#faq">Questions fréquentes</a></li>
-  <ul>
-    <li><a href="#framadate">Qu'est-ce que Framadate
-?</a></li>
-    <li><a href="#studs">Quelles différences entre
-Framadate et STUdS ?</a></li>
-    <li><a href="#doodle">Quelles différences entre
-Framadate et Doodle ?</a></li>
-    <li><a href="#longevite">Mon sondage
-restera-t-il longtemps en ligne ?</a></li>
-  </ul>
-  <li><a href="#mentions">Mentions légales</a></li>
-  <li><a href="#credits">Crédits</a></li>
-  <li><a href="#licence">Licence</a></li>
-</ul>
-<hr style="width: 100%; height: 2px;">
-<h1><a name="faq"></a>Questions fréquentes</h1>
-<h3><a name="framadate"></a>Qu'est-ce que
-Framadate ?</h3>
-Framadate est un service en ligne permettant de planifier un
-rendez-vous rapidement et simplement. Aucune inscription préalable
-n'est nécessaire.<br />
-Framadate est un service du<a href="http://framasoft.org">
-réseau Framasoft</a>, mis en place par<a
- href="http://fr.wikipedia.org/wiki/Framasoft"> l'association
-Framasoft</a>.<br />
-<h3><a name="studs"></a>Quelles différences
-entre Framadate et STUdS ! ?</h3>
-Framadate est un service basé sur le logiciel libre <a
- href="https://github.com/leblanc-simon/OpenSondage">OpenSondage</a>.
-OpenSondage est lui-même basé sur le logiciel <a
- href="http://studs.u-strasbg.fr">STUdS !</a> développé
-par l'Université de Strasbourg. <br />
-Après avoir testé STUdS, nous avons décidé d'apporter de nombreuses
-modifications, notamment ergonomiques, au code source existant.
-L'ensemble de ces modifications ne pouvaient entrer dans le cadre
-d'utilisation d'un logiciel déjà en production dans une université et
-aurait été (fort logiquement) rejetté de la branche principale de
-développement. C'est pourquoi nous avons préferer "<a
- href="http://fr.wikipedia.org/wiki/Fork_%28d%C3%A9veloppement_logiciel%29">forker</a>"
-STUdS pour créer OpenSondage.<br />
-<h3><a name="doodle"></a>Quelles différences
-entre Framadate et <a href="http://doodle.com">Doodle</a>
-?</h3>
-Aujourd'hui, le danger pour le logiciel libre
-ne provient plus de Microsoft ou d'Adobe et de leurs logiciels qu'on
-installe sans avoir le code source, mais des applications web "dans les
-nuages" proposés comme services par des entreprises.<br />
-<br />
-Cela pour au moins 4 raisons :<br />
-1- <span style="font-weight: bold;">sécurité</span>
-: aucune garantie ne peut vous être apportée quand au fait les données
-soient correctement sauvegardées et protégées, ni que le<br />
-code source "officiel" soit réellement celui que vous utilisez en ligne.<br />
-2- <span style="font-weight: bold;">fiabilité/perennité</span>
-: le service peut tomber en panne, et rien&nbsp;ne garanti que la
-société Doodle sera toujours là demain et maintiendra le site<br />
-3- <span style="font-weight: bold;">propriété des données</span>
-: beaucoup d'entreprises s'autoproclament co-détentrices de vos
-contenus "clouds" (ex: Facebook impose une clause de partage des droits
-sur vos contenus, vos données, vos photos)<br />
-4-<span style="font-weight: bold;"> vie privée</span>
-: une entreprise - comme Doodle - doit gagner de l'argent (et il n'y a
-aucun mal à cela). Mais si elle est en difficulté financière, elle peut
-décider de changer ses conditions d'utilisation et vendre vos données à
-des tiers (alors que Framasoft, asso loi 1901 d'intérêt général, n'aura
-jamais d'intérêt à le faire).<br />
-<br />
-A cela s'ajoute le problème, plus éthique, de la publicité.<br />
-<br />
-Les problèmes 1 et 2 concernent aussi Framadate.org : rien ne garanti
-la sécurité et la fiabilité du service (d'autant plus que les
-administrateurs systèmes de Framasoft sont bénévoles).<br />
-<br />
-Par contre :<br />
-- les problemes 3 et 4 ne sont pas d'actualité avec Framadate, exploité
-par une association loi 1901<br />
-- et surtout, Framadate fait partie d'un projet plus global
-(Framatools) qui vise justement à sensibiliser le grand public à la
-problématique du "cloud". Cela peut sembler paradoxal, mais bien que
-proposant le service Framadate.org, nous allons surtout encourager les
-organisations à installer leur propre instance du logiciel afin de
-maitriser totalement leurs données.<br />
-<br />
-Bref, oui Framadate est inspiré de Doodle.com, et oui Doodle est un
-excellent service. Mais Doodle reste une "boite noire" pour
-l'utilisateur final qui va sur doodle.com. Framadate.org essaie de
-répondre, modestement, à cette problématique en montrant que des
-alternatives libres existent et qu'on peut les installer "chez soi".<br />
-<h3><a name="longevite"></a>Mon sondage
-restera-t-il longtemps en ligne ?</h3>
-Le service Framadate est proposée gratuitement par l'association
-Framasoft.<br />
-Framasoft
-s'engage à maintenir le service "aussi longtemps que possible", mais ne
-peut fournir aucune garantie de date. Si cela ne vous convient pas,
-nous vous
-encourageons sincèrement à installer vous-même Framadate et à maintenir
-vous-même votre propre service.
-<hr style="width: 100%; height: 2px;">
-<h1><a name="mentions"></a>Mentions légales<br />
-</h1>
-<h2>Éditeur et Responsable de la publication</h2>
-<p>Editeur : Association Framasoft (cf "Hébergement")</p>
-<p>Responsable de la publication : Christophe Masutti</p>
-<p>Vous pouvez rentrer en contact avec l'Editeur et le
-Responsable de la publication en passant par la page "<a
- href="http://contact.framasoft.org">contact</a>".</p>
-<p>Les propos tenus sur ce site ne représentent que et uniquement
-l’opinion de leur auteur, et n’engagent pas l'association Framasoft,
-les sociétés, entreprises ou collectifs auxquels il contribue ou dont
-il peut être associé ou employé.</p>
-<h2>Hébergement</h2>
-<p>Ce site est hébergé par Framasoft, 10 bis rue Jangot 69007 Lyon, France.
-Cet hébergeur possède à ce jour les éléments d’identification
-personnelle concernant l'Éditeur (voir <a
- href="http://www.framasoft.net/article4736.html">http://www.framasoft.net/article4736.html</a>).</p>
-<h2>Données personnelles</h2>
-<p>Les données personnelles collectées par Framadate sont
-uniquement destinées à un usage interne. En aucun cas ces données ne
-seront cédées ou vendues à des tiers.
-Conformément à l’article 39 de la loi du 6 janvier 1978 relative à
-l’informatique, aux fichiers et aux libertés, vous avez un droit
-d’accès, de modification et d’opposition sur vos données personnelles
-enregistrées par le blog.
-Dans ce cas, utilisez le formulaire de contact.</p>
-<h2>Conditions de modération/suppression de sondages</h2>
-<p>Les sondages de Framadate bénéficient d'une URL aléatoire,
-mais publique. Si vous souhaitez supprimer un sondage, utilisez
-l'adresse d'aministration fournie à la création. Vous pouvez
-exceptionnellement demander la suppression d'un sondage en utilisant la
-page de contact.</p>
-<h2>Notification des contenus litigieux</h2>
-<p>Conformément à l’article 6 I 5° LCEN, la connaissance des
-contenus litigieux est présumée acquise par L’Éditeur lorsqu’il lui est
-notifié, par lettre recommandée avec accusé de réception adressée au
-siège social de L’Éditeur, la totalité des éléments suivants (i) la
-date de la notification&nbsp;; (ii) si le notifiant est une
-personne physique&nbsp;: ses nom, prénoms, profession, domicile,
-nationalité, date et lieu de naissance&nbsp;; si le notifiant est
-une personne morale&nbsp;: sa forme, sa dénomination, son siège
-social et l’organe qui la représente légalement&nbsp;; (iii) les
-nom et domicile du destinataire ou, s’il s’agit d’une personne morale,
-sa dénomination et son siège social&nbsp;; (iv) la description des
-faits litigieux et leur localisation précise&nbsp;; (v) les motifs
-pour lesquels le contenu doit être retiré, comprenant la mention des
-dispositions légales et des justifications de faits&nbsp;; (vi) la
-copie de la correspondance adressée à l’auteur ou à l’éditeur des
-informations ou activités litigieuses demandant leur interruption, leur
-retrait ou leur modification, ou la justification de ce que l’auteur ou
-l’éditeur n’a pu être contacté.</p>
-<p>A défaut d’envoi de la totalité de ces éléments, la
-notification ne sera pas prise en compte par L’Éditeur et ce dernier ne
-pourra en conséquence être présumé informé d’un contenu litigieux.</p>
-<p>L’Éditeur se réserve le droit d’engager des poursuites à
-l’encontre de toute personne ayant usé abusivement du droit réservé par
-l’article 6 I 4° LCEN. L’Éditeur vous rappelle que toute personne qui
-aurait présenté un contenu ou une activité comme étant illicite dans le
-but d’en obtenir le retrait ou d’en faire cesser la diffusion alors
-qu’elle a connaissance du caractère inexact de cette information, est
-susceptible d’encourir une peine d’un an d’emprisonnement et de 15.000
-€uros d’amende.</p>
-<h2>Licences, droits de reproduction</h2>
-<p>L'application Framadate, basé sur le logiciel OpenSondage,
-lui-même basé sur STUdS, est publiée sous licence libre <a
- href="http://www.cecill.info/licences.fr.html">CeCILL-B</a>.
-Les contenus (sondages) sont publiés sous licence Creative Commons
-BY-SA. Cela signifie que si l'adresse de votre sondage est connue d'un
-individu, vous autorisez cette personne à utiliser, partager, modifier
-votre sondage. Si vous souhaitez des sondages 100% privés et avec votre
-propre licence, installez votre propre logiciel de sondage et
-n'utilisez pas Framadate.org.</p>
-<hr style="width: 100%; height: 2px;">
-<h2><a name="credits"></a>Crédits</h2>
-<b>Application d'origine</b><br />
-<br />
-L'application Framadate est une instance du logiciel <b><a
- href="http://studs.u-strasbg.fr">STUdS !</a></b>
-développé à l'Université de Strasbourg depuis 2008.<br />
-<br />
-Pour les besoins de Framadate, STUdS a fait l'objet d'un fork par
-l'équipe Framasoft. Les sources sont disponibles sur le Github <a
- href="https://github.com/leblanc-simon/OpenSondage">OpenSondage</a>.<br />
-<br />
-<b>Technologies utilisées</b><br />
-<br />
-- <a href="http://www.php.net/">PHP</a><br />
-- <a href="http://www.postgresql.org/">MySQL</a><br />
-- <a href="http://www.apache.org/">Apache</a><br />
-- <a href="http://subversion.tigris.org/">Subversion</a><br />
-- <a href="http://www.kigkonsult.se/iCalcreator/">iCalcreator</a><br />
-- <a href="http://www.fpdf.org/">FPDF</a><br />
-- Icônes : <a href="http://deleket.deviantart.com/">Deleket</a>,
-<a href="http://pixel-mixer.com">PixelMixer</a> et <a
- href="http://dryicons.com">DryIcons</a><br />
-<br />
-<b>Compatibilités des navigateurs</b><br />
-<br />
-- <a href="http://www.mozilla.com/firefox/">Firefox</a><br />
-- <a href="http://www.opera.com/">Opéra</a><br />
-- <a href="http://www.konqueror.org/">Konqueror</a><br />
-- <a href="http://www.jikos.cz/%7Emikulas/links/">Links</a><br />
-- <a href="http://www.apple.com/fr/safari/">Safari</a><br />
-- <a href="http://www.mozilla.com/firefox/">IE</a><br />
-<br />
-<b>Validations des pages</b><br />
-<br />
-- Toutes les pages disposent de la validation HTML 4.01 Strict du W3C. <br />
-- La CSS dispose de la validation CSS 2.1 du W3C.
-<p><img src="http://www.w3.org/Icons/valid-html401-blue"
- alt="Valid HTML 4.01 Strict" height="31" width="88"><img
- style="border: 0pt none ; width: 88px; height: 31px;"
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
- alt="CSS Valide !">
-</p>
-<b>Propositions améliorations de Framadate</b><br />
-<br />
-Si quelque chose venait à vous manquer, vous pouvez nous en faire part
-via le <a href="http://contact.framasoft.org">formulaire en ligne</a>.
-<br />
-Les dernières améliorations de Framadate sont visibles dans le fichier <a
- href="CHANGELOG">CHANGELOG</a>.<br />
-<br />
-<b>Remerciements</b><br />
-<br />
-<b><a href="http://studs.u-strasbg.fr">STUdS !</a></b>&nbsp;:
-Pour leurs contributions techniques ou ergonomiques : Guy, Christophe,
-Julien, Pierre, Romaric, Matthieu, Catherine, Christine, Olivier,
-Emmanuel et Florence <br />
-<a style="font-weight: bold;"
- href="https://github.com/leblanc-simon/OpenSondage">Framadate</a>
-: &nbsp;Simon Leblanc (développement principal), Pierre-Yves Gosset
-(développement, graphisme), la communauté Framasoft.<br />
-<br />
-<h2><b><a name="licence"></a>Licence</b></h2>
-Framadate est placé, comme <b><a
- href="http://studs.u-strasbg.fr">STUdS !</a>,</b>
-sous la licence logicielle libre <a
- href="http://www.cecill.info/licences.fr.html">CeCILL-B</a>.<br />
-<br />
-mentions;
-
-bandeau_pied();
diff --git a/bandeaux.php b/bandeaux.php
index 167e7ae8e1a44d2fb1ff55b1d4015077a9dc56f6..40694ffddbe67362c861b8ffeffb5201d4e731ef 100644
--- a/bandeaux.php
+++ b/bandeaux.php
@@ -26,8 +26,8 @@ function bandeau_titre($titre)
     $img = ( IMAGE_TITRE ) ? '<img src="'. Utils::get_server_name(). IMAGE_TITRE. '" title="'._("Home").' - '.NOMAPPLICATION.'" alt="'.NOMAPPLICATION.'">' : '';
     echo '
     <header role="banner">
-        <form method="post" action="">
-            <div class="input-group input-group-sm pull-right col-md-2">
+        <form method="post" action="#">
+            <div class="input-group input-group-sm pull-right col-md-2 col-xs-4">
                 <select name="lang" class="form-control" title="'. _("Select the language") .'" >' . liste_lang() . '</select>
                 <span class="input-group-btn">
                     <button type="submit" class="btn btn-default btn-sm" title="'. _("Change the language") .'">OK</button>
@@ -36,8 +36,9 @@ function bandeau_titre($titre)
         </form>
         <h1><a href="'.str_replace('/admin','', Utils::get_server_name()).'" title="'._("Home").' - '.NOMAPPLICATION.'">'.$img.'</a></h1>
         <p class="lead"><i>'. $titre .'</i></p>
+        <hr class="trait" />
     </header>
-    <main>';
+    <main role="main">';
 }
 
 function liste_lang()
@@ -61,25 +62,6 @@ function bandeau_pied($admin=false)
 {
     echo '
     </main>
-    <footer>
-        <hr />
-        <ul class="list-inline">';
-    if($admin) {
-        echo '
-            <li><a class="btn btn-default btn-xs" href="'.str_replace('/admin','', Utils::get_server_name()).'">'. _("Home") .'</a></li>';
-        if (is_readable('logs_studs.txt')) {
-            echo '
-            <li><a role="button" class="btn btn-default btn-xs" href="'.str_replace('/admin','', Utils::get_server_name()).'admin/logs_studs.txt">'. _("Logs") .'</a></li>';
-        }
-    } else {
-        echo '
-            <li><a class="btn btn-default btn-xs" href="'. Utils::get_server_name().'">'. _("Home") .'</a></li>
-            <li><a class="btn btn-default btn-xs" href="http://contact.framasoft.org">'. _("Contact") .'</a></li>
-            <li><a class="btn btn-default btn-xs" href="'. Utils::get_server_name().'apropos.php">'. _("About") .'</a></li>';
-    }
-    echo '
-        </ul>
-    </footer>
     </div> <!-- .container -->
 </body>
 </html>'."\n";
diff --git a/choix_autre.php b/choix_autre.php
index f51faf2a0b1bcc14ea7a5262f97837037ff51ae5..66e8498b6a7f0fd2380f188e1dfff3f7a9196590 100644
--- a/choix_autre.php
+++ b/choix_autre.php
@@ -64,8 +64,8 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
             $registredate = explode("/",$_POST["champdatefin"]);
             if (is_array($registredate) == true && count($registredate) == 3) {
                 $time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]);
-                if ($time > time() + 250000) {
-                    $_SESSION["champdatefin"]=mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]);
+                if ($time > time() + (24*60*60)) {
+                    $_SESSION["champdatefin"]=$time;
                 }
             }
         }
@@ -93,12 +93,51 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
         Utils::print_header ( _("Removal date and confirmation (3 on 3)") );
         bandeau_titre(_("Removal date and confirmation (3 on 3)"));
 
+        $removal_date=strftime(_("%A, den %e. %B %Y"), time()+15552000);
+
+        // Sumary
+        $summary = '<ol>';
+        for ($i=0;$i<count($_SESSION['choices']);$i++) {
+
+            preg_match_all('/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/',$_SESSION['choices'][$i],$md_a_img);  // Markdown [![alt](src)](href)
+            preg_match_all('/!\[(.*?)\]\((.*?)\)/',$_SESSION['choices'][$i],$md_img);                 // Markdown ![alt](src)
+            preg_match_all('/\[(.*?)\]\((.*?)\)/',$_SESSION['choices'][$i],$md_a);                    // Markdown [text](href)
+            if (isset($md_a_img[2][0]) && $md_a_img[2][0]!='' && isset($md_a_img[3][0]) && $md_a_img[3][0]!='') { // [![alt](src)](href)
+
+                $li_subject_text = (isset($md_a_img[1][0]) && $md_a_img[1][0]!='') ? stripslashes($md_a_img[1][0]) : _("Choice") .' '.($i+1);
+                $li_subject_html = '<a href="'.$md_a_img[3][0].'"><img src="'.$md_a_img[2][0].'" class="img-responsive" alt="'.$li_subject_text.'" /></a>';
+
+            } elseif (isset($md_img[2][0]) && $md_img[2][0]!='') { // ![alt](src)
+
+                $li_subject_text = (isset($md_img[1][0]) && $md_img[1][0]!='') ? stripslashes($md_img[1][0]) : _("Choice") .' '.($i+1);
+                $li_subject_html = '<img src="'.$md_img[2][0].'" class="img-responsive" alt="'.$li_subject_text.'" />';
+
+            } elseif (isset($md_a[2][0]) && $md_a[2][0]!='') { // [text](href)
+
+                $li_subject_text = (isset($md_a[1][0]) && $md_a[1][0]!='') ? stripslashes($md_a[1][0]) : _("Choice") .' '.($i+1);
+                $li_subject_html = '<a href="'.$md_a[2][0].'">'.$li_subject_text.'</a>';
+
+            } else { // text only
+
+                $li_subject_text = stripslashes($toutsujet[$i]);
+                $li_subject_html = $li_subject_text;
+
+            }
+
+            $summary .= '<li>'.$li_subject_html.'</li>'."\n";
+        }
+        $summary .= '</ol>';
+
         echo '
     <form name="formulaire" action="' . Utils::get_server_name() . 'choix_autre.php" method="POST" class="form-horizontal" role="form">
     <div class="row">
-        <div class="col-md-6 col-md-offset-3">
+        <div class="col-md-8 col-md-offset-2">
+            <div class="well summary">
+                <h3>'. _("List of your choices").'</h3>
+                '. $summary .'
+            </div>
             <div class="alert alert-info">
-                <p>' . _("Your poll will be automatically removed after 6 months.") . '<br />' . _("You can fix another removal date for it.") .'</p>
+                <p>' . _("Your poll will be automatically removed after 6 months:") . ' <strong>'.$removal_date.'</strong>.<br />' . _("You can fix another removal date for it.") .'</p>
                 <div class="form-group">
                     <label for="champdatefin" class="col-sm-5 control-label">'. _("Removal date (optional)") .'</label>
                     <div class="col-sm-6">
@@ -114,7 +153,10 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
                 <p>'. _("Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll."). '</p>
                 <p>' . _("Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.") .'</p>
             </div>
-            <p class="text-right"><button name="confirmecreation" value="confirmecreation" type="submit" class="btn btn-success">'. _('Create the poll') . '</button></p>
+            <p class="text-right">
+                <button class="btn btn-default" onclick="javascript:window.history.back();" title="'. _('Back to step 2') . '">'. _('Back') . '</button>
+                <button name="confirmecreation" value="confirmecreation" type="submit" class="btn btn-success">'. _('Create the poll') . '</button>
+            </p>
         </div>
     </div>
     </form>'."\n";
@@ -129,11 +171,12 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
         echo '
     <form name="formulaire" action="' . Utils::get_server_name() . 'choix_autre.php" method="POST" class="form-horizontal" role="form">
     <div class="row">
-        <div class="col-md-6 col-md-offset-3">';
+        <div class="col-md-8 col-md-offset-2">';
         echo '
             <div class="alert alert-info">
-                <p>'. _("To make a generic poll you need to propose at least two choices between differents subjects.") . '</p>
-                <p>'. _("You can add or remove additional choices with the buttons") .' <span class="glyphicon glyphicon-minus text-info"></span> <span class="glyphicon glyphicon-plus text-success"></span></p>
+                <p>'. _("To make a generic poll you need to propose at least two choices between differents subjects.") .'</p>
+                <p>'. _("You can add or remove additional choices with the buttons") .' <span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span> <span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></p>
+                <p>'. _("It's possible to propose links or images by using "). '<a href="http://'.$lang.'.wikipedia.org/wiki/Markdown">'. _("the Markdown syntax") .'</a>.</p>
             </div>'."\n";
 
         // Fields choices : 5 by default
@@ -143,21 +186,52 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
             echo '
             <div class="form-group choice-field">
                 <label for="choice'.$i.'" class="col-sm-2 control-label">'. _("Choice") .' '.($i+1).'</label>
-                <div class="col-sm-10">
-                    <input type="text" class="form-control" name="choices[]" size="40" maxlength="40" value="'.$choice_value.'" id="choice'.$i.'" />
+                <div class="col-sm-10 input-group">
+                    <input type="text" class="form-control" name="choices[]" size="40" value="'.$choice_value.'" id="choice'.$i.'" />
+                    <span class="input-group-addon btn-link md-a-img" title="'. _("Add a link or an image") .'" ><span class="glyphicon glyphicon-picture"></span> <span class="glyphicon glyphicon-link"></span></span>
                 </div>
             </div>'."\n";
         }
 
         echo '
-            <div class="col-md-6">
+            <div class="col-md-4">
                 <div class="btn-group btn-group">
-                    <button type="button" id="remove-a-choice" class="btn btn-default" title="'. _("Remove a choice") .'"><span class="glyphicon glyphicon-minus text-info"></span></button>
-                    <button type="button" id="add-a-choice" class="btn btn-default" title="'. _("Add a choice") .'"><span class="glyphicon glyphicon-plus text-success"></span></button>
+                    <button type="button" id="remove-a-choice" class="btn btn-default" title="'. _("Remove a choice") .'"><span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span></button>
+                    <button type="button" id="add-a-choice" class="btn btn-default" title="'. _("Add a choice") .'"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></button>
                 </div>
             </div>
-            <div class="col-md-6 text-right">
-                <button name="fin_sondage_autre" value="'._('Next').'" type="submit" class="btn btn-success disabled">'. _('Next') . '</button>
+            <div class="col-md-8 text-right">
+                <a class="btn btn-default" href="'.Utils::get_server_name().'infos_sondage.php?choix_sondage=autre" title="'. _('Back to step 1') . '">'. _('Back') . '</a>
+                <button name="fin_sondage_autre" value="'._('Next').'" type="submit" class="btn btn-success disabled" title="'. _('Go to step 3') . '">'. _('Next') . '</button>
+            </div>
+        </div>
+    </div>
+    <div class="modal fade" id="md-a-imgModal" tabindex="-1" role="dialog" aria-labelledby="md-a-imgModalLabel" aria-hidden="true">
+        <div class="modal-dialog">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">'. _('Close') . '</span></button>
+                    <h4 class="modal-title" id="md-a-imgModalLabel">'. _("Add a link or an image") .'</h4>
+                </div>
+                <div class="modal-body">
+                    <p class="alert alert-info">'. _("These fields are optional. You can add a link, an image or both.") .'</p>
+                    <div class="form-group">
+                        <label for="md-img"><span class="glyphicon glyphicon-picture"></span> '. _('URL of the image') . '</label>
+                        <input id="md-img" type="text" placeholder="http://…" class="form-control" size="40" />
+                    </div>
+                    <div class="form-group">
+                        <label for="md-a"><span class="glyphicon glyphicon-link"></span> '. _('Link') . '</label>
+                        <input id="md-a" type="text" placeholder="http://…" class="form-control" size="40" />
+                    </div>
+                    <div class="form-group">
+                        <label for="md-text">'. _('Alternative text') . '</label>
+                        <input id="md-text" type="text" class="form-control" size="40" />
+                    </div>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">'. _('Cancel') . '</button>
+                    <button type="button" class="btn btn-primary">'. _('Add') . '</button>
+                </div>
             </div>
         </div>
     </div>
diff --git a/choix_date.php b/choix_date.php
index aefafbe89da5dcd22c363ee19f26bb150aca9455..9302de19f2c4e71214aec4a96a532eda38f16c87 100644
--- a/choix_date.php
+++ b/choix_date.php
@@ -75,6 +75,19 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
 
         $_SESSION["toutchoix"]=substr($choixdate,1);
 
+        // Expiration date → 6 months after last day if not filled or in bad format
+        $_SESSION["champdatefin"]=end($temp_results)+15552000;
+
+        if (Utils::issetAndNoEmpty('champdatefin')) {
+            $registredate = explode("/",$_POST["champdatefin"]);
+            if (is_array($registredate) == true && count($registredate) == 3) {
+                $time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]);
+                if ($time > time() + (24*60*60)) {
+                    $_SESSION["champdatefin"]=$time;
+                }
+            }
+        }
+
         ajouter_sondage();
 
     } else {
@@ -111,22 +124,50 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
 
         $temp_array = array_unique($_SESSION["totalchoixjour"]);
         sort($temp_array);
-        $removal_date=strftime(_("%A, den %e. %B %Y"), end($temp_array)+2592000);
+        $removal_date=strftime(_("%A, den %e. %B %Y"), end($temp_array)+15552000);
+
+        // Sumary
+        $summary = '<ul>';
+        for ($i=0;$i<count($_SESSION["totalchoixjour"]);$i++) {
+            $summary .= '<li>'.strftime(_("%A, den %e. %B %Y"), $_SESSION["totalchoixjour"][$i]);
+            for ($j=0;$j<count($_SESSION['horaires'.$i]);$j++) {
+                if (isset($_SESSION['horaires'.$i][$j])) {
+                    $summary .= ($j==0) ? ' : ' : ', ';
+                    $summary .= $_SESSION['horaires'.$i][$j];
+                }
+            }
+            $summary .= '</li>'."\n";
+        }
+        $summary .= '</ul>';
 
         echo '
     <form name="formulaire" action="' . Utils::get_server_name() . 'choix_date.php" method="POST" class="form-horizontal" role="form">
     <div class="row" id="selected-days">
         <div class="col-md-8 col-md-offset-2">
             <h2>'. _("Confirm the creation of your poll") .'</h2>
-            <div class="alert alert-info">
-                <p>'. _("Your poll will expire automatically 2 days after the last date of your poll.") .'</p>
-                <p>'. _("Removal date:") .' <b> '.$removal_date.'</b></p>
+            <div class="well summary">
+                <h3>'. _("List of your choices").'</h3>
+                '. $summary .'
+            </div>
+            <div class="alert alert-info clearfix">
+                <p>' . _("Your poll will be automatically removed 6 months after the last date of your poll:") . ' <strong>'.$removal_date.'</strong>.<br />' . _("You can fix another removal date for it.") .'</p>
+                <div class="form-group">
+                    <label for="champdatefin" class="col-sm-5 control-label">'. _("Removal date (optional)") .'</label>
+                    <div class="col-sm-6">
+                        <div class="input-group date">
+                            <span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
+                            <input type="text" class="form-control" id="champdatefin" data-date-format="'. _("dd/mm/yyyy") .'" aria-describedby="dateformat" name="champdatefin" value="" size="10" maxlength="10" placeholder="'. _("dd/mm/yyyy") .'" />
+                        </div>
+                    </div>
+                    <span id="dateformat" class="sr-only">'. _("(dd/mm/yyyy)") .'</span>
+                </div>
             </div>
             <div class="alert alert-warning">
                 <p>'. _("Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll."). '</p>
                 <p>' . _("Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.") .'</p>
             </div>
             <p class="text-right">
+                <button class="btn btn-default" onclick="javascript:window.history.back();" title="'. _('Back to step 2') . '">'. _('Back') . '</button>
                 <button name="confirmation" value="confirmation" type="submit" class="btn btn-success">'. _('Create the poll') . '</button>
             </p>
         </div>
@@ -143,16 +184,16 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
         echo '
     <form name="formulaire" action="' . Utils::get_server_name() . 'choix_date.php" method="POST" class="form-horizontal" role="form">
     <div class="row" id="selected-days">
-        <div class="col-md-8 col-md-offset-2">
+        <div class="col-md-10 col-md-offset-1">
             <h2>'. _("Choose the dates of your poll") .'</h2>
             <div class="alert alert-info">
                 <p>'. _("To schedule an event you need to propose at least two choices (two hours for one day or two days).").'</p>
-                <p>'. _("You can add or remove additionnal days and hours with the buttons") .' <span class="glyphicon glyphicon-minus text-info"></span> <span class="glyphicon glyphicon-plus text-success"></span></p>
+                <p>'. _("You can add or remove additionnal days and hours with the buttons") .' <span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span> <span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></p>
                 <p>'. _("For each selected day, you can choose, or not, meeting hours (e.g.: \"8h\", \"8:30\", \"8h-10h\", \"evening\", etc.)").'</p>
             </div>';
 
-        // Fields days : 1 by default
-        $nb_days = (isset($_SESSION["totalchoixjour"])) ? count($_SESSION["totalchoixjour"]) : 1;
+        // Fields days : 3 by default
+        $nb_days = (isset($_SESSION["totalchoixjour"])) ? count($_SESSION["totalchoixjour"]) : 3;
         for ($i=0;$i<$nb_days;$i++) {
             $day_value = isset($_SESSION["totalchoixjour"][$i]) ? strftime( "%d/%m/%Y", $_SESSION["totalchoixjour"][$i]) : '';
             echo '
@@ -161,8 +202,9 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
                     <legend>
                         <div class="input-group date col-xs-7">
                             <span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
-                            <input type="text" class="form-control" id="day'.$i.'" title="'. _("Day") .' '. ($i+1) .'" data-date-format="'. _("dd/mm/yyyy") .'" name="days[]" value="'.$day_value.'" size="10" maxlength="10" placeholder="'. _("dd/mm/yyyy") .'" />
+                            <input type="text" class="form-control" id="day'.$i.'" title="'. _("Day") .' '. ($i+1) .'" data-date-format="'. _("dd/mm/yyyy") .'" aria-describedby="dateformat'.$i.'" name="days[]" value="'.$day_value.'" size="10" maxlength="10" placeholder="'. _("dd/mm/yyyy") .'" />
                         </div>
+                        <span id="dateformat'.$i.'" class="sr-only">'. _("(dd/mm/yyyy)") .'</span>
                     </legend>'."\n";
 
             // Fields hours : 3 by default
@@ -171,26 +213,26 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
                 echo '
                     <div class="col-sm-2">
                         <label for="d'.$i.'-h'.$j.'" class="sr-only control-label">'. _("Time") .' '. ($j+1) .'</label>
-                        <input type="text" class="form-control hours" title="'.$day_value.' - '. _("Time") .' '. ($j+1) .'" placeholder="'. _("Time") .' '. ($j+1) .'" maxlength="11" id="d'.$i.'-h'.$j.'" name="horaires'.$i.'[]" value="'.$hour_value.'" />
+                        <input type="text" class="form-control hours" title="'.$day_value.' - '. _("Time") .' '. ($j+1) .'" placeholder="'. _("Time") .' '. ($j+1) .'" id="d'.$i.'-h'.$j.'" name="horaires'.$i.'[]" value="'.$hour_value.'" />
                     </div>'."\n";
             }
             echo '
                     <div class="col-sm-2"><div class="btn-group btn-group-xs" style="margin-top: 5px;">
-                        <button type="button" title="'. _("Remove an hour") .'" class="remove-an-hour btn btn-default"><span class="glyphicon glyphicon-minus text-info"></span></button>
-                        <button type="button" title="'. _("Add an hour") .'" class="add-an-hour btn btn-default"><span class="glyphicon glyphicon-plus text-success"></span></button>
+                        <button type="button" title="'. _("Remove an hour") .'" class="remove-an-hour btn btn-default"><span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span></button>
+                        <button type="button" title="'. _("Add an hour") .'" class="add-an-hour btn btn-default"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></button>
                     </div></div>
                 </div>
             </fieldset>';
             }
         echo '
-            <div class="col-md-6">
-                <button type="button" id="copyhours" class="btn btn-default disabled" title="'. _("Copy hours of the first day") .'"><span class="glyphicon glyphicon-sort-by-attributes-alt text-info"></span></button>
+            <div class="col-md-4">
+                <button type="button" id="copyhours" class="btn btn-default disabled" title="'. _("Copy hours of the first day") .'"><span class="glyphicon glyphicon-sort-by-attributes-alt text-info"></span><span class="sr-only">'. _("Copy hours of the first day") .'</span></button>
                 <div class="btn-group btn-group">
-                    <button type="button" id="remove-a-day" class="btn btn-default disabled" title="'. _("Remove a day") .'"><span class="glyphicon glyphicon-minus text-info"></span></button>
-                    <button type="button" id="add-a-day" class="btn btn-default" title="'. _("Add a day") .'"><span class="glyphicon glyphicon-plus text-success"></span></button>
+                    <button type="button" id="remove-a-day" class="btn btn-default disabled" title="'. _("Remove a day") .'"><span class="glyphicon glyphicon-minus text-info"></span><span class="sr-only">'. _("Remove") .'</span></button>
+                    <button type="button" id="add-a-day" class="btn btn-default" title="'. _("Add a day") .'"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _("Add") .'</span></button>
                 </div>
             </div>
-            <div class="col-md-6 text-right">
+            <div class="col-md-8 text-right">
                 <div class="btn-group">
                     <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                         <span class="glyphicon glyphicon-remove text-danger"></span> '. _("Remove") . ' <span class="caret"></span>
@@ -200,7 +242,8 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
                         <li><a id="resethours" href="javascript:void(0)">'. _("Remove all hours") .'</a></li>
                     </ul>
                 </div>
-                <button name="choixheures" value="'. _("Next") .'" type="submit" class="btn btn-success disabled">'. _('Next') . '</button>
+                <a class="btn btn-default" href="'.Utils::get_server_name().'infos_sondage.php?choix_sondage=date" title="'. _('Back to step 1') . '">'. _('Back') . '</a>
+                <button name="choixheures" value="'. _("Next") .'" type="submit" class="btn btn-success disabled" title="'. _('Go to step 3') . '">'. _("Next") .'</button>
             </div>
         </div>
     </div>
diff --git a/contacts.php b/contacts.php
deleted file mode 100644
index ff219c274f764fc2c79080b2ad74262be487d7eb..0000000000000000000000000000000000000000
--- a/contacts.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-/**
- * This software is governed by the CeCILL-B license. If a copy of this license
- * is not distributed with this file, you can obtain one at
- * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
- *
- * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
- * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
- *
- * =============================
- *
- * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
- * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
- * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
- *
- * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
- * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
- */
-namespace Framadate;
-
-include_once __DIR__ . '/app/inc/init.php';
-
-session_start();
-
-if (file_exists('bandeaux_local.php')) {
-    include_once('bandeaux_local.php');
-} else {
-    include_once('bandeaux.php');
-}
-
-// action du bouton annuler
-if ((isset($_POST['envoiquestion'])) &&
-     isset($_POST['nom']) && !empty($_POST['nom']) &&
-     isset($_POST['adresse_mail']) && !empty($_POST['adresse_mail']) && Utils::isValidEmail($_POST['adresse_mail']) &&
-     isset($_POST['question']) && !empty($_POST['question'])) {
-    $message=str_replace("\\","",$_POST["question"]);
-    $headers = 'Reply-To: '.$_POST['adresse_mail'];
-
-    Utils::sendEmail( ADRESSEMAILADMIN, "" . _("[CONTACT] You have sent a question ") . "".NOMAPPLICATION, "" . _("You have a question from a user ") . " ".NOMAPPLICATION."\n\n" . _("User") . " : ".$_POST["nom"]."\n\n" . _("User's email address") . " : $_POST[adresse_mail]\n\n" . _("Message") . " :".$message,$headers );
-    Utils::sendEmail( "$_POST[adresse_mail]", "" . _("[COPY] Someone has sent a question ") . "".NOMAPPLICATION, "" . _("Here is a copy of your question") . " :\n\n".$message." \n\n" . _("We're going to answer your question shortly.") . "\n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION );
-
-    //affichage de la page de confirmation d'envoi
-    Utils::print_header(_("Make your polls"));
-    bandeau_titre(_("Make your polls"));
-
-    echo '
-    <div class="alert alert-success">
-        <h2>' . _("Your message has been sent!") . '</h2>
-        <p>' . _("Back to the homepage of ") . ' <a href="' . Utils::get_server_name() . '"> ' . NOMAPPLICATION . '</a>.</p>
-    </div>'."\n";
-    bandeau_pied();
-    session_unset();
-
-} else {
-    $post_var = array('question', 'nom', 'adresse_mail', );
-    foreach ($post_var as $var) {
-        if (isset($_POST[$var]) && !empty($_POST[$var])) {
-            $_SESSION[$var] = $_POST[$var];
-        } else {
-            $_SESSION[$var] = null;
-        }
-    }
-
-    /*
-     * Préparation des messages d'erreur
-     */
-
-    $errors = array(
-        'name' => array (
-            'msg' => '',
-            'aria' => '',
-            'class' => ''
-        ),
-        'email' => array (
-            'msg' => '',
-            'aria' => '',
-            'class' => ''
-        ),
-        'question' => array (
-            'msg' => '',
-            'aria' => '',
-            'class' => ''
-        ),
-        'state' => false
-    );
-
-    if (isset($_POST['envoiquestion']) && $_SESSION["nom"]=="") {
-        $errors['name']['aria'] = 'aria-describeby="#poll_name_error" '; $errors['name']['class'] = ' has-error';
-        $errors['name']['msg'] = '<div class="alert alert-danger" ><p id="contact_name_error">'. _("Enter a name") .'</p></div>';
-        $errors['state'] = true;
-    }
-
-    if (isset($_POST['envoiquestion']) && ($_SESSION["adresse_mail"] =="" || !Utils::isValidEmail($_SESSION["adresse_mail"]))) {
-        $errors['email']['aria'] = 'aria-describeby="#poll_email_error" '; $errors['email']['class'] = ' has-error';
-        $errors['email']['msg'] = '<div class="alert alert-danger" ><p id="contact_email_error">'. _("The address is not correct!") .'</p></div>';
-        $errors['state'] = true;
-    }
-    if (isset($_POST['envoiquestion']) && $_SESSION["question"]=="") {
-        $errors['question']['aria'] = 'aria-describeby="#poll_question_error" '; $errors['question']['class'] = ' has-error';
-        $errors['question']['msg'] = '<div class="alert alert-danger" ><p id="contact_question_error">'. _("You must ask a question!") .'</p></div>';
-        $errors['state'] = true;
-    }
-
-    //affichage de la page
-    if($errors['state']) {
-        Utils::print_header( _("Error!").' - '._("Contact us") );
-    } else {
-        Utils::print_header( _("Contact us") );
-    }
-        bandeau_titre(_("Contact us"));
-
-    echo '
-    <div class="row">
-        <div class="col-md-6 col-md-offset-3">
-            <form name=formulaire action="' . Utils::get_server_name() . 'contacts.php" method="POST" class="form-horizontal" role="form">
-                <p>' . _("If you have questions, you can send a message here.") . '</p>
-                <div class="form-group'.$errors['name']['class'].'">
-                    <label for="name" class="col-sm-5 control-label">' . _("Your name") .'</label>
-                    <div class="col-sm-7">
-                        <input type="text" maxlength="64" id="name" name="nom" class="form-control" '.$errors['name']['aria'].' value="'.$_SESSION["nom"].'" />
-                    </div>
-                </div>
-                    '.$errors['name']['msg'].'
-                <div class="form-group'.$errors['email']['class'].'">
-                    <label for="email" class="col-sm-5 control-label">' . _("Your email address") . '</label>
-                    <div class="col-sm-7">
-                        <input type="text" maxlength="64" id="email" name="adresse_mail" class="form-control" '.$errors['email']['aria'].' value="'.$_SESSION["adresse_mail"].'" />
-                    </div>
-                </div>
-                    '.$errors['email']['msg'].'
-                <div class="form-group'.$errors['question']['class'].'">
-                    <label for="question" class="col-sm-5 control-label">' . _("Question") . '</label>
-                    <div class="col-sm-7">
-                        <textarea name="question" id="question" rows="7" class="form-control" '.$errors['question']['aria'].'>'.$_SESSION["question"].'</textarea>
-                    </div>
-                </div>
-                    '.$errors['question']['msg'].'
-                <p class="text-right"><button type="submit" name="envoiquestion" value="'._("Send your question").'" class="btn btn-success">'._("Send your question").'</button></p>
-            </form>
-        </div>
-    </div>'."\n";
-
-    bandeau_pied();
-}
diff --git a/creation_sondage.php b/creation_sondage.php
index a45ed8dd5c1d0ce792e6f1b345d6e93ca4b83b21..f036f889ac4f14209434e0dce6a5acf2dee7c399 100644
--- a/creation_sondage.php
+++ b/creation_sondage.php
@@ -45,27 +45,7 @@ function ajouter_sondage()
     $sondage=random(16);
     $sondage_admin=$sondage.random(8);
 
-    if ($_SESSION["formatsondage"]=="A"||$_SESSION["formatsondage"]=="A+") {
-        //extraction de la date de fin choisie
-        if ($_SESSION["champdatefin"]) {
-            if ($_SESSION["champdatefin"]>time()+250000) {
-                $date_fin=$_SESSION["champdatefin"];
-            }
-        } else {
-            $date_fin=time()+15552000;
-        }
-    }
-
-    if ($_SESSION["formatsondage"]=="D"||$_SESSION["formatsondage"]=="D+") {
-        //Calcul de la date de fin du sondage
-        $temp_array = array_unique($_SESSION["totalchoixjour"]);
-        sort($temp_array);
-        $date_fin= end($temp_array)+2592000;
-    }
-
-    if (is_numeric($date_fin) === false) {
-        $date_fin = time()+15552000;
-    }
+    $date_fin = ($_SESSION["champdatefin"]) ? $_SESSION["champdatefin"] : $date_fin=time()+15552000;
 
     $sql = 'INSERT INTO sondage
           (id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde)
@@ -90,10 +70,10 @@ function ajouter_sondage()
     $message = _("This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.");
     $message .= "\n\n";
     $message .= stripslashes(html_entity_decode($_SESSION["nom"],ENT_QUOTES,"UTF-8"))." " . _("hast just created a poll called") . " : \"".stripslashes(htmlspecialchars_decode($_SESSION["titre"],ENT_QUOTES))."\".\n";
-    $message .= _("Thanks for filling the poll at the link above") . " :\n\n%s\n\n" . _("Thanks for your confidence.") . ",\n".NOMAPPLICATION;
+    $message .= _("Thanks for filling the poll at the link above") . " :\n\n%s\n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION;
 
     $message_admin = _("This message should NOT be sended to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above");
-    $message_admin .= " :\n\n"."%s \n\n" . _("Thanks for your confidence.") . ",\n".NOMAPPLICATION;
+    $message_admin .= " :\n\n"."%s \n\n" . _("Thanks for your confidence.") . "\n".NOMAPPLICATION;
 
     $message = sprintf($message, Utils::getUrlSondage($sondage));
     $message_admin = sprintf($message_admin, Utils::getUrlSondage($sondage_admin, true));
diff --git a/css/bootstrap-accessibility.css b/css/bootstrap-accessibility.css
deleted file mode 100644
index 7f0409254eb69dc1ebdcb6647b45185670dec9fa..0000000000000000000000000000000000000000
--- a/css/bootstrap-accessibility.css
+++ /dev/null
@@ -1,64 +0,0 @@
-.btn:focus {
-  outline: dotted 2px black;
-}
-
-div.active:focus {
-  outline: dotted 1px black;
-}
-
-a:focus {
-  outline: dotted 1px black;
-}
-
-.close:hover, .close:focus {
-  outline: dotted 1px black;
-}
-
-.nav > li > a:hover, .nav > li > a:focus {
-  outline: dotted 1px black;
-}
-
-.carousel-inner > .item {
-  position: absolute;
-  top: -999999em;
-  display: block;
-  -webkit-transition: 0.6s ease-in-out left;
-  -moz-transition: 0.6s ease-in-out left;
-  -o-transition: 0.6s ease-in-out left;
-  transition: 0.6s ease-in-out left;
-}
-.carousel-inner > .active {
-  top: 0;
-}
-.carousel-inner > .active,
-.carousel-inner > .next,
-.carousel-inner > .prev {
-  position: relative;
-}
-.carousel-inner > .next,
-.carousel-inner > .prev {
-  position: absolute;
-  top: 0;
-  width: 100%;
-}
-
-.alert-success {
-  color: #2d4821;
-}
-
-.alert-info {
-  color: #214c62;
-}
-
-.alert-warning {
-  color: #6c4a00;
-  background-color: #f9f1c6;
-}
-
-.alert-danger {
-  color: #d2322d;
-}
-
-.alert-danger:hover {
-  color: #a82824;
-}
diff --git a/css/datepicker3.css b/css/datepicker3.css
index aa78b1d4b5b0afee39918b10eead660b9212485a..81ddb0793511a472bf15232cdad830839a7717d2 100644
--- a/css/datepicker3.css
+++ b/css/datepicker3.css
@@ -12,8 +12,8 @@
   border-radius: 4px;
   direction: ltr;
   /*.dow {
-		border-top: 1px solid #ddd !important;
-	}*/
+        border-top: 1px solid #ddd !important;
+    }*/
 }
 .datepicker-inline {
   width: 220px;
@@ -127,9 +127,10 @@
 .datepicker table tr td.today:hover,
 .datepicker table tr td.today.disabled,
 .datepicker table tr td.today.disabled:hover {
-  color: #000000;
-  background-color: #ffdb99;
-  border-color: #ffb733;
+  font-weight:bold;
+  /*color: #000000;
+  /*background-color: #ffdb99;
+  border-color: #ffb733;*/*/
 }
 .datepicker table tr td.today:hover,
 .datepicker table tr td.today:hover:hover,
@@ -151,9 +152,9 @@
 .open .dropdown-toggle.datepicker table tr td.today:hover,
 .open .dropdown-toggle.datepicker table tr td.today.disabled,
 .open .dropdown-toggle.datepicker table tr td.today.disabled:hover {
-  color: #000000;
+  /*color: #000000;
   background-color: #ffcd70;
-  border-color: #f59e00;
+  border-color: #f59e00;*/
 }
 .datepicker table tr td.today:active,
 .datepicker table tr td.today:hover:active,
@@ -229,8 +230,8 @@ fieldset[disabled] .datepicker table tr td.today.active,
 fieldset[disabled] .datepicker table tr td.today:hover.active,
 fieldset[disabled] .datepicker table tr td.today.disabled.active,
 fieldset[disabled] .datepicker table tr td.today.disabled:hover.active {
-  background-color: #ffdb99;
-  border-color: #ffb733;
+  /*background-color: #ffdb99;
+  border-color: #ffb733;*/
 }
 .datepicker table tr td.today:hover:hover {
   color: #000;
@@ -250,8 +251,8 @@ fieldset[disabled] .datepicker table tr td.today.disabled:hover.active {
 .datepicker table tr td.range.today.disabled,
 .datepicker table tr td.range.today.disabled:hover {
   color: #000000;
-  background-color: #f7ca77;
-  border-color: #f1a417;
+  /*background-color: #f7ca77;
+  border-color: #f1a417;*/
   border-radius: 0;
 }
 .datepicker table tr td.range.today:hover,
@@ -274,9 +275,9 @@ fieldset[disabled] .datepicker table tr td.today.disabled:hover.active {
 .open .dropdown-toggle.datepicker table tr td.range.today:hover,
 .open .dropdown-toggle.datepicker table tr td.range.today.disabled,
 .open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover {
-  color: #000000;
+  /*color: #000000;
   background-color: #f4bb51;
-  border-color: #bf800c;
+  border-color: #bf800c;*/
 }
 .datepicker table tr td.range.today:active,
 .datepicker table tr td.range.today:hover:active,
@@ -352,16 +353,16 @@ fieldset[disabled] .datepicker table tr td.range.today.active,
 fieldset[disabled] .datepicker table tr td.range.today:hover.active,
 fieldset[disabled] .datepicker table tr td.range.today.disabled.active,
 fieldset[disabled] .datepicker table tr td.range.today.disabled:hover.active {
-  background-color: #f7ca77;
-  border-color: #f1a417;
+  /*background-color: #f7ca77;
+  border-color: #f1a417;*/
 }
 .datepicker table tr td.selected,
 .datepicker table tr td.selected:hover,
 .datepicker table tr td.selected.disabled,
 .datepicker table tr td.selected.disabled:hover {
   color: #ffffff;
-  background-color: #999999;
-  border-color: #555555;
+  background-color: #9D74B5;
+  border-color: #8E65A6;
   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
 }
 .datepicker table tr td.selected:hover,
@@ -385,8 +386,8 @@ fieldset[disabled] .datepicker table tr td.range.today.disabled:hover.active {
 .open .dropdown-toggle.datepicker table tr td.selected.disabled,
 .open .dropdown-toggle.datepicker table tr td.selected.disabled:hover {
   color: #ffffff;
-  background-color: #858585;
-  border-color: #373737;
+  background-color: #9D74B5;
+  border-color: #8E65A6;
 }
 .datepicker table tr td.selected:active,
 .datepicker table tr td.selected:hover:active,
@@ -462,16 +463,16 @@ fieldset[disabled] .datepicker table tr td.selected.active,
 fieldset[disabled] .datepicker table tr td.selected:hover.active,
 fieldset[disabled] .datepicker table tr td.selected.disabled.active,
 fieldset[disabled] .datepicker table tr td.selected.disabled:hover.active {
-  background-color: #999999;
-  border-color: #555555;
+  background-color: #9D74B5;
+  border-color: #8E65A6;
 }
 .datepicker table tr td.active,
 .datepicker table tr td.active:hover,
 .datepicker table tr td.active.disabled,
 .datepicker table tr td.active.disabled:hover {
   color: #ffffff;
-  background-color: #428bca;
-  border-color: #357ebd;
+  background-color: #6A5687;
+  border-color: #5C4978;
   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
 }
 .datepicker table tr td.active:hover,
@@ -495,8 +496,8 @@ fieldset[disabled] .datepicker table tr td.selected.disabled:hover.active {
 .open .dropdown-toggle.datepicker table tr td.active.disabled,
 .open .dropdown-toggle.datepicker table tr td.active.disabled:hover {
   color: #ffffff;
-  background-color: #3276b1;
-  border-color: #285e8e;
+  background-color: #6A5687;
+  border-color: #5C4978;
 }
 .datepicker table tr td.active:active,
 .datepicker table tr td.active:hover:active,
@@ -572,8 +573,8 @@ fieldset[disabled] .datepicker table tr td.active.active,
 fieldset[disabled] .datepicker table tr td.active:hover.active,
 fieldset[disabled] .datepicker table tr td.active.disabled.active,
 fieldset[disabled] .datepicker table tr td.active.disabled:hover.active {
-  background-color: #428bca;
-  border-color: #357ebd;
+  background-color: #6A5687;
+  border-color: #5C4978;
 }
 .datepicker table tr td span {
   display: block;
@@ -599,8 +600,8 @@ fieldset[disabled] .datepicker table tr td.active.disabled:hover.active {
 .datepicker table tr td span.active.disabled,
 .datepicker table tr td span.active.disabled:hover {
   color: #ffffff;
-  background-color: #428bca;
-  border-color: #357ebd;
+  background-color: #6A5687;
+  border-color: #5C4978;
   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
 }
 .datepicker table tr td span.active:hover,
@@ -624,8 +625,8 @@ fieldset[disabled] .datepicker table tr td.active.disabled:hover.active {
 .open .dropdown-toggle.datepicker table tr td span.active.disabled,
 .open .dropdown-toggle.datepicker table tr td span.active.disabled:hover {
   color: #ffffff;
-  background-color: #3276b1;
-  border-color: #285e8e;
+  background-color: #6A5687;
+  border-color: #5C4978;
 }
 .datepicker table tr td span.active:active,
 .datepicker table tr td span.active:hover:active,
@@ -701,8 +702,8 @@ fieldset[disabled] .datepicker table tr td span.active.active,
 fieldset[disabled] .datepicker table tr td span.active:hover.active,
 fieldset[disabled] .datepicker table tr td span.active.disabled.active,
 fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active {
-  background-color: #428bca;
-  border-color: #357ebd;
+  background-color: #6A5687;
+  border-color: #5C4978;
 }
 .datepicker table tr td span.old,
 .datepicker table tr td span.new {
diff --git a/css/frama.css b/css/frama.css
new file mode 100644
index 0000000000000000000000000000000000000000..4c43753d34bf469ee6044de2359f1719f41baff7
--- /dev/null
+++ b/css/frama.css
@@ -0,0 +1,450 @@
+/* Text */
+.text-muted,
+.text-muted a,
+a.text-muted {
+  color: #767676;
+  border-color: #767676;
+}
+
+.text-muted a:hover,
+.text-muted a:focus,
+a.text-muted:hover,
+a.text-muted:focus {
+  color: #5e5e5e;
+  border-color:#5e5e5e;
+  border-bottom-style:solid;
+}
+.text-primary,
+.text-primary a,
+a.text-primary {
+  color: #6A5687;
+  border-color: #6A5687;
+}
+.text-primary a:hover,
+.text-primary a:focus,
+a.text-primary:hover,
+a.text-primary:focus {
+  color: #583C66;
+  border-color: #583C66;
+  border-bottom-style:solid;
+}
+.text-success,
+.text-success a,
+a.text-success {
+  color: #606E38;
+  border-color: #606E38;
+}
+.text-success a:hover,
+.text-success a:focus,
+a.text-success:hover,
+a.text-success:focus {
+  color: #67753C;
+  border-color: #67753C;
+  border-bottom-style:solid;
+}
+.text-info,
+.text-info a,
+a.text-info {
+  color: #31748F;
+  border-color: #31748F;
+}
+.text-info a:hover,
+.text-info a:focus,
+a.text-info:hover,
+a.text-info:focus {
+  color: #245569;
+  border-color: #31748F;
+  border-bottom-style:solid;
+}
+.text-warning,
+.text-warning a,
+a.text-warning {
+  color: #8A6E3B;
+  border-color: #8A6E3B;
+}
+.text-warning a:hover,
+.text-warning a:focus,
+a.text-warning:hover,
+a.text-warning:focus {
+  color: #66522C;
+  border-color: #66522C;
+  border-bottom-style:solid;
+}
+.text-danger,
+.text-danger a,
+a.text-danger {
+  color: #A94E42;
+  border-color: #A94E42;
+}
+.text-danger a:hover,
+.text-danger a:focus,
+a.text-danger:hover,
+a.text-danger:focus {
+  color: #843D34;
+  border-color: #843D34;
+  border-bottom-style:solid;
+}
+
+/* Background */
+.bg-primary,
+.bg-primary a,
+a.bg-primary:focus,
+a.bg-primary:hover {
+  color: #fff;
+  background-color: #6A5687;
+  border-color:#fff;
+}
+.bg-success, a.bg-success:hover {
+  background-color: #EAF0D8;
+}
+.bg-info, a.bg-info:hover {
+  background-color: #D9EFF7;
+}
+.bg-warning, a.bg-warning:hover {
+  background-color: #FCF3E3;
+}
+.bg-danger,a.bg-danger:hover {
+  background-color: #F2E7E5;
+}
+
+/* Alerts */
+.alert-success a:not(.btn), .alert-info a:not(.btn),
+.alert-warning a:not(.btn), .alert-danger a:not(.btn) {
+    text-decoration:none;
+    border-bottom-width: 1px;
+    border-bottom-style: dotted;
+}
+.alert-success a:not(.btn):hover, .alert-info a:not(.btn):hover,
+.alert-warning a:not(.btn):hover, .alert-danger a:not(.btn):hover {
+    text-decoration:none;
+    border-bottom-style: solid;
+}
+.alert-success a:not(.btn),
+.alert-success a:not(.btn):hover,
+.alert-success {
+    color: #4A542C;
+    background:#EAF0D8;
+    border-color: #4A542C;
+}
+.alert-info a:not(.btn),
+.alert-info a:not(.btn):hover,
+.alert-info {
+    color: #245569;
+    background-color: #D9EFF7;
+    border-color: #245569;
+}
+.alert-warning a:not(.btn),
+.alert-warning a:not(.btn):hover,
+.alert-warning {
+    color: #66522C;
+    background-color: #FCF3E3;
+    border-color: #66522C;
+}
+.alert-danger a:not(.btn),
+.alert-danger a:not(.btn):hover,
+.alert-danger {
+    color: #843D34;
+    background-color: #F2E7E5;
+    border-color: #843D34;
+}
+
+/* Buttons */
+.btn-default {
+    color: #333;
+    background-color: #fff;
+    border-color: #ccc;
+}
+.btn-default:hover,
+.btn-default:focus,
+.btn-default:active,
+.btn-default.active,
+.open > .dropdown-toggle.btn-default {
+    color: #333;
+    background-color: #e6e6e6;
+    border-color: #adadad;
+}
+
+.btn-default.disabled,
+.btn-default[disabled],
+fieldset[disabled] .btn-default,
+.btn-default.disabled:hover,
+.btn-default[disabled]:hover,
+fieldset[disabled] .btn-default:hover,
+.btn-default.disabled:focus,
+.btn-default[disabled]:focus,
+fieldset[disabled] .btn-default:focus,
+.btn-default.disabled:active,
+.btn-default[disabled]:active,
+fieldset[disabled] .btn-default:active,
+.btn-default.disabled.active,
+.btn-default[disabled].active,
+fieldset[disabled] .btn-default.active {
+    background-color: #fff;
+    border-color: #ccc;
+}
+
+.btn-default .badge {
+    color: #fff;
+    background-color: #767676;
+}
+
+.btn-primary {
+    color: #fff;
+    background-color: #6A5687;
+    border-color: #5C4978;
+}
+.btn-primary:hover,
+.btn-primary:focus,
+.btn-primary:active,
+.btn-primary.active,
+.open > .dropdown-toggle.btn-primary {
+    color: #fff;
+    background-color: #5E4A7A;
+    border-color: #513F69;
+}
+.btn-primary.disabled,
+.btn-primary[disabled],
+fieldset[disabled] .btn-primary,
+.btn-primary.disabled:hover,
+.btn-primary[disabled]:hover,
+fieldset[disabled] .btn-primary:hover,
+.btn-primary.disabled:focus,
+.btn-primary[disabled]:focus,
+fieldset[disabled] .btn-primary:focus,
+.btn-primary.disabled:active,
+.btn-primary[disabled]:active,
+fieldset[disabled] .btn-primary:active,
+.btn-primary.disabled.active,
+.btn-primary[disabled].active,
+fieldset[disabled] .btn-primary.active {
+    background-color: #6A5687;
+    border-color: #5C4978;
+}
+.btn-primary .badge {
+    color: #6A5687;
+    background-color: #fff;
+}
+
+.btn-success {
+    color: #fff;
+    background-color: #849551;
+    border-color: #748544;
+}
+.btn-success:hover,
+.btn-success:focus,
+.btn-success:active,
+.btn-success.active,
+.open > .dropdown-toggle.btn-success {
+    color: #fff;
+    background-color: #768745;
+    border-color: #67753C;
+}
+.btn-success.disabled,
+.btn-success[disabled],
+fieldset[disabled] .btn-success,
+.btn-success.disabled:hover,
+.btn-success[disabled]:hover,
+fieldset[disabled] .btn-success:hover,
+.btn-success.disabled:focus,
+.btn-success[disabled]:focus,
+fieldset[disabled] .btn-success:focus,
+.btn-success.disabled:active,
+.btn-success[disabled]:active,
+fieldset[disabled] .btn-success:active,
+.btn-success.disabled.active,
+.btn-success[disabled].active,
+fieldset[disabled] .btn-success.active {
+    background-color: #849551;
+    border-color: #748544;
+}
+.btn-success .badge {
+    color: #849551;
+    background-color: #fff;
+}
+
+.btn-info {
+    color: #fff;
+    background-color: #366F86;
+    border-color: #2C6278;
+}
+.btn-info:hover,
+.btn-info:focus,
+.btn-info:active,
+.btn-info.active,
+.open > .dropdown-toggle.btn-info {
+    color: #fff;
+    background-color: #2D647A;
+    border-color: #275669;
+}
+.btn-info.disabled,
+.btn-info[disabled],
+fieldset[disabled] .btn-info,
+.btn-info.disabled:hover,
+.btn-info[disabled]:hover,
+fieldset[disabled] .btn-info:hover,
+.btn-info.disabled:focus,
+.btn-info[disabled]:focus,
+fieldset[disabled] .btn-info:focus,
+.btn-info.disabled:active,
+.btn-info[disabled]:active,
+fieldset[disabled] .btn-info:active,
+.btn-info.disabled.active,
+.btn-info[disabled].active,
+fieldset[disabled] .btn-info.active {
+    background-color: #366F86;
+    border-color: #2C6278;
+}
+.btn-info .badge {
+    color: #366F86;
+    background-color: #fff;
+}
+
+.btn-warning {
+    color: #fff;
+    background-color: #DBA306;
+    border-color: #CC9600;
+}
+.btn-warning:hover,
+.btn-warning:focus,
+.btn-warning:active,
+.btn-warning.active,
+.open > .dropdown-toggle.btn-warning {
+    color: #fff;
+    background-color: #CF9800;
+    border-color: #BD8A00;
+}
+.btn-warning.disabled,
+.btn-warning[disabled],
+fieldset[disabled] .btn-warning,
+.btn-warning.disabled:hover,
+.btn-warning[disabled]:hover,
+fieldset[disabled] .btn-warning:hover,
+.btn-warning.disabled:focus,
+.btn-warning[disabled]:focus,
+fieldset[disabled] .btn-warning:focus,
+.btn-warning.disabled:active,
+.btn-warning[disabled]:active,
+fieldset[disabled] .btn-warning:active,
+.btn-warning.disabled.active,
+.btn-warning[disabled].active,
+fieldset[disabled] .btn-warning.active {
+    background-color: #DBA306;
+    border-color: #CC9600;
+}
+.btn-warning .badge {
+    color: #DBA306;
+    background-color: #fff;
+}
+
+.btn-danger {
+    color: #fff;
+    background-color: #CC2D18;
+    border-color: #BD2511;
+}
+.btn-danger:hover,
+.btn-danger:focus,
+.btn-danger:active,
+.btn-danger.active,
+.open > .dropdown-toggle.btn-danger {
+    color: #fff;
+    background-color: #BF2511;
+    border-color: #AD220F;
+}
+.btn-danger.disabled,
+.btn-danger[disabled],
+fieldset[disabled] .btn-danger,
+.btn-danger.disabled:hover,
+.btn-danger[disabled]:hover,
+fieldset[disabled] .btn-danger:hover,
+.btn-danger.disabled:focus,
+.btn-danger[disabled]:focus,
+fieldset[disabled] .btn-danger:focus,
+.btn-danger.disabled:active,
+.btn-danger[disabled]:active,
+fieldset[disabled] .btn-danger:active,
+.btn-danger.disabled.active,
+.btn-danger[disabled].active,
+fieldset[disabled] .btn-danger.active {
+    background-color: #CC2D18;
+    border-color: #BD2511;
+}
+.btn-danger .badge {
+    color: #CC2D18;
+    background-color: #fff;
+}
+
+.btn-orange {
+    color: #fff;
+    background-color: #D2703A;
+    border-color: #C26430;
+}
+.btn-orange:hover,
+.btn-orange:focus,
+.btn-orange:active,
+.btn-orange.active,
+.open > .dropdown-toggle.btn-orange {
+    color: #fff;
+    background-color: #C46531;
+    border-color: #B35C2D;
+}
+.btn-orange.disabled,
+.btn-orange[disabled],
+fieldset[disabled] .btn-orange,
+.btn-orange.disabled:hover,
+.btn-orange[disabled]:hover,
+fieldset[disabled] .btn-orange:hover,
+.btn-orange.disabled:focus,
+.btn-orange[disabled]:focus,
+fieldset[disabled] .btn-orange:focus,
+.btn-orange.disabled:active,
+.btn-orange[disabled]:active,
+fieldset[disabled] .btn-orange:active,
+.btn-orange.disabled.active,
+.btn-orange[disabled].active,
+fieldset[disabled] .btn-orange.active {
+    background-color: #D2703A;
+    border-color: #C26430;
+}
+.btn-orange .badge {
+    color: #D2703A;
+    background-color: #fff;
+}
+
+.btn-link {
+    font-weight: normal;
+    color: #366F86;
+    cursor: pointer;
+    border-radius: 0;
+}
+.btn-link,
+.btn-link:active,
+.btn-link[disabled],
+fieldset[disabled] .btn-link {
+    background-color: transparent;
+    -webkit-box-shadow: none;
+    box-shadow: none;
+}
+.btn-link,
+.btn-link:hover,
+.btn-link:focus,
+.btn-link:active {
+    border-color: transparent;
+}
+.btn-link:hover,
+.btn-link:focus {
+    color: #134C63;
+    text-decoration: underline;
+    background-color: transparent;
+}
+.btn-link[disabled]:hover,
+fieldset[disabled] .btn-link:hover,
+.btn-link[disabled]:focus,
+fieldset[disabled] .btn-link:focus {
+    color: #767676;
+    text-decoration: none;
+}
+.btn-link .badge {
+    color: #fff;
+    background-color: #767676;
+}
+
diff --git a/css/style.css b/css/style.css
index 7ab6f7443c4e157997310e3974b3b7731bffb539..8ff42240b81f1e4274264a5f29dc001b6369ce06 100644
--- a/css/style.css
+++ b/css/style.css
@@ -15,76 +15,24 @@
  * Auteurs d'OpenSondage : Framasoft (https://github.com/framasoft)
  */
 
-/* Calendrier dans choix_date.php */
-div.calendrier table {
-    border:2px solid #ccf;
-    background-color: #CCF;
-    margin-left: auto;
-    margin-right: auto;
+body {
+  font-family: "DejaVu Sans", Verdana, Geneva, sans-serif;
+  color:#333;
+  background:#eee;
 }
 
-div.calendrier td {
-    height: 40px;
-}
-
-div.calendrier td.libre:hover,
-div.calendrier td.choisi:hover {
-    opacity: 0.8;
-}
-
-/*entête calendrier */
-.choix_date_mois {
-    font-weight: bold;
-    font-size: larger;
-}
-
-/*jour de la semaine dans calendrier*/
-div.calendrier td.joursemaine {
-    width:14%;
-    text-align: center;
-    border: 2px;
-    background-color: white;
-    height: 40px;
-}
-/*jour avant le premier jour du mois dans calendrier*/
-div.calendrier td.avant {
-    text-align: center;
-    border: 2px;
-    font-family:arial;
-    font-size:13px;
-    background-color: #EEEEEE;
-}
-/*jour libre dans calendrier*/
-div.calendrier td.libre {
-    text-align: center;
-    border: 2px;
-    background-color: #66FF99;
-}
-/*jour deja selectionné dans calendrier*/
-div.calendrier td.choisi {
-    text-align: center;
-    border: 2px;
-    background-color: #54ADF7;
-}
-
-.bouton {
-    border:0px;
-    padding: 12px 30px 6px;
-    margin:0px;
-    cursor:pointer;
-    font-family:arial;
-    font-size:13px;
-}
-/*les boutons pour choisir un jour non selectionné*/
-.ON {
-    background-color: #66FF99;
+.trait { /* hr */
+    background-color: #EEE;
+    height: 11px;
+    margin:15px 0px;
+    border:none;
 }
 
-/*les boutons pour deselectionner un jour deja choisi*/
-.OFF {
-    background-color: #54ADF7;
+.ombre {
+    background-color: #FFF;
+    box-shadow: -4px 6px 9px rgba(50, 50, 50, 0.5);
+    margin:30px auto;
 }
-/* </calendrier> */
 
 /* Commentaires */
 div.comment{
@@ -108,12 +56,24 @@ main, header, footer, .container .jumbotron {
     padding:24px 30px;
 }
 
+.summary h3 {
+    margin-top:0;
+}
+
+.summary {
+    font-weight:bold;
+}
+
+.summary img {
+    max-width:100px;
+}
+
 /* Effet sur les images en page d'accueil */
-.opacity {
-    opacity: 0.6;
+.opacity img {
+    opacity: 0.8;
 }
 
-.opacity:hover {
+.opacity:hover img {
     opacity: 1;
 }
 
@@ -146,6 +106,7 @@ h3.control-label {
     font-weight: 700;
     font-size: 14px;
     line-height: 1.42857;
+    margin-top:0;
 }
 
 caption {
@@ -156,7 +117,8 @@ caption {
     /* adminstuds.php */
 #title-form h2 .btn-edit,
 #email-form .btn-edit,
-#description-form .btn-edit {
+#description-form .btn-edit,
+#poll-rules-form .btn-edit {
     position:absolute;
     left:-2000px;
 }
@@ -166,7 +128,9 @@ caption {
 #email-form .btn-edit:focus,
 #email-form:hover .btn-edit,
 #description-form .btn-edit:focus,
-#description-form:hover .btn-edit {
+#description-form:hover .btn-edit,
+#poll-rules-form .btn-edit:focus,
+#poll-rules-form:hover .btn-edit {
     position:relative !important;
     left:0;
     padding: 0px 10px;
@@ -180,10 +144,18 @@ caption {
     margin-bottom:0;
 }
 
+#poll-rules-form p,
+.jumbotron p.well {
+    font-size:16px;
+}
+.jumbotron p {
+    font-weight: normal;
+}
+
 /* Tableau du sondage */
 #tableContainer {
     overflow-x:auto;
-    margin:0 auto;
+    margin:20px auto;
 }
 
 table.results {
@@ -210,8 +182,12 @@ table.results tbody td {
 table.results thead th {
     text-align:center;
     border:2px solid white;
-    padding:1px 5px;
+    padding:5px;
     min-width:40px;
+    font-size:12px;
+    max-width:100px;
+    overflow:hidden;
+    text-overflow:ellipsis;
 }
 
 table.results thead .btn {
@@ -308,23 +284,23 @@ table.results .btn-link.btn-sm {
 }
 
 .yes input[type="radio"]:checked + label { /* =.btn-success.active */
-    color: #FFF;
-    background-color: #449D44;
-    border-color: #398439;
+    color: #fff;
+    background-color: #768745;
+    border-color: #67753C;
     box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.125) inset;
 }
 
 .ifneedbe input[type="radio"]:checked + label { /* =.btn-warning.active */
-    color: #FFF;
-    background-color: #EC971F;
-    border-color: #D58512;
+    color: #fff;
+    background-color: #CF9800;
+    border-color: #BD8A00;
     box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.125) inset;
 }
 
 .no input[type="radio"]:checked + label { /* =.btn-danger.active */
-    color: #FFF;
-    background-color: #C9302C;
-    border-color: #AC2925;
+    color: #fff;
+    background-color: #BF2511;
+    border-color: #AD220F;
     box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.125) inset;
 }
 
@@ -354,4 +330,11 @@ table.results .btn-link.btn-sm {
     border:none;
     background:transparent;
 }
+/* choix_autre.php */
+.md-a-img {
+    text-decoration:none !important;
+}
 
+#md-a-imgModal .form-group {
+    margin:10px 0px;
+}
diff --git a/exportcsv.php b/exportcsv.php
index a99b703c30f88c5dea840e8d688d2b8bd8a6eefb..fd868bffa796416400782413f86b3998175ddadd 100644
--- a/exportcsv.php
+++ b/exportcsv.php
@@ -34,44 +34,57 @@ $nbcolonnes=substr_count($dsondage->sujet,',')+1;
 $toutsujet=explode(",",$dsondage->sujet);
 
 //affichage des sujets du sondage
-$input =";";
+$input =",";
 foreach ($toutsujet as $value) {
     if ($dsondage->format=="D"||$dsondage->format=="D+") {
-	    if (strpos($dsondage->sujet,'@') !== false) {
-		    $days=explode("@",$value);
-		    $input.= date("j/n/Y",$days[0]).';';
-	    } else {
-		    $input.= date("j/n/Y",$values).';';
-	    }
+        if (strpos($dsondage->sujet,'@') !== false) {
+            $days=explode("@",$value);
+            $input.= '"'.date("j/n/Y",$days[0]).'",';
+        } else {
+            $input.= '"'.date("j/n/Y",$values).'",';
+        }
     } else {
-        $input.= $value.';';
+
+        preg_match_all('/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/',$value,$md_a_img);  // Markdown [![alt](src)](href)
+        preg_match_all('/!\[(.*?)\]\((.*?)\)/',$value,$md_img);                 // Markdown ![alt](src)
+        preg_match_all('/\[(.*?)\]\((.*?)\)/',$value,$md_a);                    // Markdown [text](href)
+        if (isset($md_a_img[2][0]) && $md_a_img[2][0]!='' && isset($md_a_img[3][0]) && $md_a_img[3][0]!='') { // [![alt](src)](href)
+            $subject_text = (isset($md_a_img[1][0]) && $md_a_img[1][0]!='') ? stripslashes($md_a_img[1][0]) : _("Choice") .' '.($i+1);
+        } elseif (isset($md_img[2][0]) && $md_img[2][0]!='') { // ![alt](src)
+            $subject_text = (isset($md_img[1][0]) && $md_img[1][0]!='') ? stripslashes($md_img[1][0]) : _("Choice") .' '.($i+1);
+        } elseif (isset($md_a[2][0]) && $md_a[2][0]!='') { // [text](href)
+            $subject_text = (isset($md_a[1][0]) && $md_a[1][0]!='') ? stripslashes($md_a[1][0]) : _("Choice") .' '.($i+1);
+        } else { // text only
+            $subject_text = stripslashes($value);
+        }
+        $input.= '"'.html_entity_decode($subject_text).'",';
     }
 }
 
 $input.="\r\n";
 
 if (strpos($dsondage->sujet,'@') !== false) {
-    $input.=";";
+    $input.=",";
     foreach ($toutsujet as $value) {
         $heures=explode("@",$value);
-        $input.= $heures[1].';';
+        $input.= '"'.$heures[1].'",';
     }
 
     $input.="\r\n";
 }
 
-while (	$data=$user_studs->FetchNextObject(false)) {
+while ( $data=$user_studs->FetchNextObject(false)) {
     // Le nom de l'utilisateur
     $nombase=html_entity_decode(str_replace("°","'",$data->nom));
-    $input.=$nombase.';';
+    $input.= '"'.$nombase.'",';
     //affichage des resultats
     $ensemblereponses=$data->reponses;
     for ($k=0;$k<$nbcolonnes;$k++) {
         $car=substr($ensemblereponses,$k,1);
         switch ($car) {
-            case "1": $input .= _('Yes').';'; $somme[$k]++; break;
-            case "2": $input .= _('Ifneedbe').';'; break;
-            default: $input .= _('No').';'; break;
+            case "1": $input .= '"'._('Yes').'",'; $somme[$k]++; break;
+            case "2": $input .= '"'._('Ifneedbe').'",'; break;
+            default: $input .= '"'._('No').'",'; break;
         }
     }
 
@@ -86,6 +99,6 @@ header( 'Content-Length: '.$filesize );
 header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
 header( 'Cache-Control: max-age=10' );
 
-echo $input;
+echo str_replace('&quot;','""',$input);
 
 die();
diff --git a/images/classic.png b/images/classic.png
index ea40b3ad2d437931252c6e229e72ef5c18b854e0..b9f7bbb90874e637b8b932558ef1558b33f4ebe9 100644
Binary files a/images/classic.png and b/images/classic.png differ
diff --git a/images/date.png b/images/date.png
index 0217b9dc04dfae25e499e02dedb3ed963d5ab322..089e0534f39937e4d5e779dd8850f50dda3fcd70 100644
Binary files a/images/date.png and b/images/date.png differ
diff --git a/images/logo-framadate.png b/images/logo-framadate.png
index 84094c0cd5bc0fb071036bc51d578d09e7ca9b7d..367b15007abe07dafb0d22631b91a46f9c51ed1d 100644
Binary files a/images/logo-framadate.png and b/images/logo-framadate.png differ
diff --git a/index.php b/index.php
index a778d3567471808a65e1442f2046423952dc08f6..301b52e7a498b53c48c980dfe7c32ef95797b3cf 100644
--- a/index.php
+++ b/index.php
@@ -32,26 +32,61 @@ session_start();
 
 // affichage de la page
 Utils::print_header( _("Home") );
-bandeau_titre(_("Organiser des rendez-vous simplement, librement."));
+bandeau_titre(_("Make your polls"));
 echo '
-        <div class="row text-center">
-            <div class="col-md-6">
-                <p><a href="'.Utils::get_server_name().'infos_sondage.php?choix_sondage=date" role="button">
-                    <img class="opacity" src="'.Utils::get_server_name().'images/date.png" alt="" />
-                    <br /><span class="btn btn-warning btn-lg"><span class="glyphicon glyphicon-calendar"></span>
+        <div class="row">
+            <div class="col-md-6 text-center">
+                <p><a href="'.Utils::get_server_name().'infos_sondage.php?choix_sondage=date" class="opacity" role="button">
+                    <img class="img-responsive center-block" src="'.Utils::get_server_name().'images/date.png" alt="" />
+                    <br /><span class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-calendar"></span>
                     '. _('Schedule an event') . '</span>
                 </a></p>
             </div>
-            <div class="col-md-6">
-                <p><a href="'.Utils::get_server_name().'infos_sondage.php?choix_sondage=autre" role="button">
-                    <img alt="" class="opacity" src="'.Utils::get_server_name().'images/classic.png" />
-                    <br /><span class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-stats"></span>
-                    '. _('Make a poll') . '</span>
+            <div class="col-md-6 text-center">
+                <p><a href="'.Utils::get_server_name().'infos_sondage.php?choix_sondage=autre" class="opacity" role="button">
+                    <img alt="" class="img-responsive center-block" src="'.Utils::get_server_name().'images/classic.png" />
+                    <br /><span class="btn btn-info btn-lg"><span class="glyphicon glyphicon-stats"></span>
+                    '. _('Make a classic poll') . '</span>
                 </a></p>
             </div>
         </div>
-        <div class="row text-center">
-                <p>'. _("or") .' <a href="' . Utils::getUrlSondage('aqg259dth55iuhwm').'">'. _("view an example") .'</a></p>
+        <hr />
+        <div class="row">
+            <div class="col-md-4">
+                <h2>'. _('What is that?') . '</h2>
+                <p class="text-center"><span class="glyphicon glyphicon-question-sign" style="font-size:50px"></span></p>
+                <p>'. _('Framadate is an online service for planning an appointment or make a decision quickly and easily. No registration is required.') .'</p>
+                <p>'. _('Here is how it works:') . '</p>
+                <ol>
+                    <li>'. _('Make a poll') . '</li>
+                    <li>'. _('Define dates or subjects to choose') . '</li>
+                    <li>'. _('Send the poll link to your friends or colleagues') . '</li>
+                    <li>'. _('Discuss and make a decision') . '</li>
+                </ol>
+                <p>'. _('Do you want to ') . '<a href="' . Utils::getUrlSondage('aqg259dth55iuhwm').'">'. _("view an example?") .'</a></p>
+            </div>
+            <div class="col-md-4">
+                <h2>'. _('The software') .'</h2>
+                <p class="text-center"><span class="glyphicon glyphicon-cloud" style="font-size:50px"></span></p>
+                <p>'. _('Framadate was initially based on '). '<a href="https://sourcesup.cru.fr/projects/studs/">Studs</a>'. _(' a software developed by the University of Strasbourg. Today, it is devevoped by the association Framasoft') .'.</p>
+                <p>'. _('This software needs javascript and cookies enabled. It is compatible with the following web browsers:') .'</p>
+                <ul>
+                    <li>Microsoft Internet Explorer 9+</li>
+                    <li>Google Chrome 19+</li>
+                    <li>Firefox 12+</li>
+                    <li>Safari 5+</li>
+                    <li>Opera 11+</li>
+                </ul>
+                <p>'. _('It is governed by the ').'<a href="http://www.cecill.info">'. _('CeCILL-B license').'</a>.</p>
+            </div>
+            <div class="col-md-4">
+                <h2>'. _('Cultivate your garden') .'</h2>
+                <p class="text-center"><span class="glyphicon glyphicon-tree-deciduous" style="font-size:50px"></span></p>
+                <p>'. _('To participate in the software development, suggest improvements or simply download it, please visit ') .'<a href="https://git.framasoft.org/framasoft/framadate">'._('the development site').'</a>.</p>
+                <br />
+                <p>'. _('If you want to install the software for your own use and thus increase your independence, we help you on:') .'</p>
+                <p class="text-center"><a href="http://framacloud.org/cultiver-son-jardin/installation-de-framadate/" class="btn btn-success"><span class="glyphicon glyphicon-tree-deciduous"></span> framacloud.org</a></p>
+            </div>
         </div>'."\n";
 
 bandeau_pied();
diff --git a/infos_sondage.php b/infos_sondage.php
index b430f4944c95faa1bf68855948be61eaf60c009e..d1ddbf089cf6c5ffe1b0e49f8a2d3018867d1f90 100644
--- a/infos_sondage.php
+++ b/infos_sondage.php
@@ -154,31 +154,31 @@ $errors = array(
 );
 
 if (!$_SESSION["titre"] && Utils::issetAndNoEmpty("poursuivre") ) {
-    $errors['title']['aria'] = 'aria-describeby="#poll_title_error" '; $errors['title']['class'] = ' has-error';
+    $errors['title']['aria'] = 'aria-describeby="poll_title_error" '; $errors['title']['class'] = ' has-error';
     $errors['title']['msg'] = '<div class="alert alert-danger" ><p id="poll_title_error">' . _("Enter a title") . '</p></div>';
 } elseif ($erreur_injection_titre) {
-    $errors['title']['aria'] = 'aria-describeby="#poll_title_error" '; $errors['title']['class'] = ' has-error';
+    $errors['title']['aria'] = 'aria-describeby="poll_title_error" '; $errors['title']['class'] = ' has-error';
     $errors['title']['inject'] = '<div class="alert alert-danger"><p id="poll_title_error">' . _("Characters < > and \" are not permitted") . '</p></div>';
 }
 
 if ($erreur_injection_commentaires) {
-    $errors['description']['aria'] = 'aria-describeby="#poll_comment_error" '; $errors['description']['class'] = ' has-error';
+    $errors['description']['aria'] = 'aria-describeby="poll_comment_error" '; $errors['description']['class'] = ' has-error';
     $errors['description']['msg'] = '<div class="alert alert-danger"><p id="poll_comment_error">' . _("Characters < > and \" are not permitted") . '</p></div>';
 }
 
 if (!$_SESSION["nom"] && Utils::issetAndNoEmpty("poursuivre")) {
-    $errors['name']['aria'] = 'aria-describeby="#poll_name_error" '; $errors['name']['class'] = ' has-error';
+    $errors['name']['aria'] = 'aria-describeby="poll_name_error" '; $errors['name']['class'] = ' has-error';
     $errors['name']['msg'] = '<div class="alert alert-danger"><p id="poll_name_error">' . _("Enter a name") . '</p></div>';
 } elseif ($erreur_injection_nom) {
-    $errors['name']['aria'] = 'aria-describeby="#poll_name_error" '; $errors['name']['class'] = ' has-error';
+    $errors['name']['aria'] = 'aria-describeby="poll_name_error" '; $errors['name']['class'] = ' has-error';
     $errors['name']['msg'] = '<div class="alert alert-danger"><p id="poll_name_error">' . _("Characters < > and \" are not permitted") . '</p></div>';
 }
 
 if (!$_SESSION["adresse"] && Utils::issetAndNoEmpty("poursuivre")) {
-    $errors['email']['aria'] = 'aria-describeby="#poll_name_error" '; $errors['email']['class'] = ' has-error';
+    $errors['email']['aria'] = 'aria-describeby="poll_name_error" '; $errors['email']['class'] = ' has-error';
     $errors['email']['msg'] = '<div class="alert alert-danger"><p id="poll_email_error">' . _("Enter an email address") . '</p></div>';
 } elseif ($erreur_adresse && Utils::issetAndNoEmpty("poursuivre")) {
-    $errors['email']['aria'] = 'aria-describeby="#poll_email_error" '; $errors['email']['class'] = ' has-error';
+    $errors['email']['aria'] = 'aria-describeby="poll_email_error" '; $errors['email']['class'] = ' has-error';
     $errors['email']['msg'] = '<div class="alert alert-danger"><p id="poll_email_error">' . _("The address is not correct! (You should enter a valid email address in order to receive the link to your poll)") . '</p></div>';
 }
 
@@ -272,7 +272,7 @@ echo '
 
         <p class="text-right">
             <input type="hidden" name="choix_sondage" value="'. $choix_sondage .'"/>
-            <button name="poursuivre" value="'. $choix_sondage .'" type="submit" class="btn btn-success">'. _('Next') . '</button>
+            <button name="poursuivre" value="'. $choix_sondage .'" type="submit" class="btn btn-success" title="'. _('Go to step 2') . '">'. _('Next') . '</button>
         </p>
 
         <script type="text/javascript"> document.formulaire.titre.focus(); </script>
diff --git a/js/bootstrap-accessibility.js b/js/bootstrap-accessibility.js
deleted file mode 100644
index 50728f58734df73fa227710018388f0b14e8d504..0000000000000000000000000000000000000000
--- a/js/bootstrap-accessibility.js
+++ /dev/null
@@ -1,406 +0,0 @@
-/* ========================================================================
-* Extends Bootstrap v3.1.1
-
-* Copyright (c) <2014> eBay Software Foundation
-
-* All rights reserved.
-
-* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-* Neither the name of eBay or any of its subsidiaries or affiliates nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-* ======================================================================== */
-
-(function($) {
-  "use strict";
-
-  var uniqueId = function(prefix) {
-      return (prefix || 'ui-id') + '-' + Math.floor((Math.random()*1000)+1)
-  }
-
-  // Alert Extension
-  // ===============================
-
-    $('.alert').attr('role', 'alert')
-    $('.close').removeAttr('aria-hidden').wrapInner('<span aria-hidden="true"></span>').append('<span class="sr-only">Close</span>')
-
-  // TOOLTIP Extension
-  // ===============================
-
-    var showTooltip =    $.fn.tooltip.Constructor.prototype.show
-        , hideTooltip =    $.fn.tooltip.Constructor.prototype.hide
-
-    $.fn.tooltip.Constructor.prototype.show = function () {
-        showTooltip.apply(this, arguments)
-        var $tip = this.tip()
-            , tooltipID = $tip.attr('id') || uniqueId('ui-tooltip')
-        $tip.attr({'role':'tooltip','id' : tooltipID})
-        this.$element.attr('aria-describedby', tooltipID)
-    }
-
-    $.fn.tooltip.Constructor.prototype.hide = function () {
-        hideTooltip.apply(this, arguments)
-        removeMultiValAttributes(this.$element, 'aria-describedby', this.tip().attr('id'))
-        return this
-    }
-
-  // Popover Extension
-  // ===============================
-    var showPopover =   $.fn.popover.Constructor.prototype.setContent
-      , hideTPopover =   $.fn.popover.Constructor.prototype.hide
-
-    $.fn.popover.Constructor.prototype.setContent = function(){
-      showPopover.apply(this, arguments)
-      var $tip = this.tip()
-        , tooltipID = $tip.attr('id') || uniqueId('ui-tooltip')
-      $tip.attr({'role':'alert','id' : tooltipID})
-      this.$element.attr('aria-describedby', tooltipID)
-      this.$element.focus()
-    }
-    $.fn.popover.Constructor.prototype.hide =  function(){
-        hideTooltip.apply(this, arguments)
-        removeMultiValAttributes(this.$element, 'aria-describedby', this.tip().attr('id'))
-    }
-
-  //Modal Extension
-    $('.modal-dialog').attr( {'role' : 'document'})
-    var modalhide =   $.fn.modal.Constructor.prototype.hide
-    $.fn.modal.Constructor.prototype.hide = function(){
-       var modalOpener = this.$element.parent().find('[data-target="#' + this.$element.attr('id') + '"]')
-       modalhide.apply(this, arguments)
-       modalOpener.focus()
-    }
-
-  // DROPDOWN Extension
-  // ===============================
-
-    var toggle   = '[data-toggle=dropdown]'
-      , $par
-      , firstItem
-      , focusDelay = 200
-      , menus = $(toggle).parent().find('ul').attr('role','menu')
-      , lis = menus.find('li').attr('role','presentation')
-
-    lis.find('a').attr({'role':'menuitem', 'tabIndex':'-1'})
-    $(toggle).attr({ 'aria-haspopup':'true', 'aria-expanded': 'false'})
-
-    $(toggle).parent().on('shown.bs.dropdown',function(e){
-      $par = $(this)
-      var $toggle = $par.find(toggle)
-      $toggle.attr('aria-expanded','true')
-
-      setTimeout(function(){
-            firstItem = $('.dropdown-menu [role=menuitem]:visible', $par)[0]
-            try{ firstItem.focus()} catch(ex) {}
-      }, focusDelay)
-    })
-
-    $(toggle).parent().on('hidden.bs.dropdown',function(e){
-      $par = $(this)
-      var $toggle = $par.find(toggle)
-      $toggle.attr('aria-expanded','false')
-    })
-
-    //Adding Space Key Behaviour, opens on spacebar
-    $.fn.dropdown.Constructor.prototype.keydown = function (e) {
-      var  $par
-        , firstItem
-      if (!/(32)/.test(e.keyCode)) return
-        $par = $(this).parent()
-        $(this).trigger ("click")
-        e.preventDefault() && e.stopPropagation()
-    }
-
-    $(document)
-      .on('focusout.dropdown.data-api', '.dropdown-menu', function(e){
-        var $this = $(this)
-                    , that = this
-        setTimeout(function() {
-         if(!$.contains(that, document.activeElement)){
-          $this.parent().removeClass('open')
-          $this.parent().find('[data-toggle=dropdown]').attr('aria-expanded','false')
-         }
-        }, 150)
-       })
-      .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , $.fn.dropdown.Constructor.prototype.keydown)
-
-
-  // Tab Extension
-  // ===============================
-
-    var $tablist = $('.nav-tabs')
-        , $lis = $tablist.children('li')
-        , $tabs = $tablist.find('[data-toggle="tab"], [data-toggle="pill"]')
-
-    $tablist.attr('role', 'tablist')
-    $lis.attr('role', 'presentation')
-    $tabs.attr('role', 'tab')
-
-    $tabs.each(function( index ) {
-      var tabpanel = $($(this).attr('href'))
-        , tab = $(this)
-        , tabid = tab.attr('id') || uniqueId('ui-tab')
-
-        tab.attr('id', tabid)
-
-      if(tab.parent().hasClass('active')){
-        tab.attr( { 'tabIndex' : '0', 'aria-selected' : 'true', 'aria-controls': tab.attr('href').substr(1) } )
-        tabpanel.attr({ 'role' : 'tabpanel', 'tabIndex' : '0', 'aria-hidden' : 'false', 'aria-labelledby':tabid })
-      }else{
-        tab.attr( { 'tabIndex' : '-1', 'aria-selected' : 'false', 'aria-controls': tab.attr('href').substr(1) } )
-        tabpanel.attr( { 'role' : 'tabpanel', 'tabIndex' : '-1', 'aria-hidden' : 'true', 'aria-labelledby':tabid } )
-      }
-    })
-
-    $.fn.tab.Constructor.prototype.keydown = function (e) {
-      var $this = $(this)
-      , $items
-      , $ul = $this.closest('ul[role=tablist] ')
-      , index
-      , k = e.which || e.keyCode
-
-      $this = $(this)
-      if (!/(37|38|39|40)/.test(k)) return
-
-      $items = $ul.find('[role=tab]:visible')
-      index = $items.index($items.filter(':focus'))
-
-      if (k == 38 || k == 37) index--                         // up & left
-      if (k == 39 || k == 40) index++                        // down & right
-
-
-      if(index < 0) index = $items.length -1
-      if(index == $items.length) index = 0
-
-      var nextTab = $items.eq(index)
-      if(nextTab.attr('role') ==='tab'){
-
-        nextTab.tab('show')      //Comment this line for dynamically loaded tabPabels, to save Ajax requests on arrow key navigation
-        .focus()
-      }
-      // nextTab.focus()
-
-      e.preventDefault()
-      e.stopPropagation()
-    }
-
-    $(document).on('keydown.tab.data-api','[data-toggle="tab"], [data-toggle="pill"]' , $.fn.tab.Constructor.prototype.keydown)
-
-   var tabactivate =    $.fn.tab.Constructor.prototype.activate;
-   $.fn.tab.Constructor.prototype.activate = function (element, container, callback) {
-      var $active = container.find('> .active')
-      $active.find('[data-toggle=tab]').attr({ 'tabIndex' : '-1','aria-selected' : false })
-      $active.filter('.tab-pane').attr({ 'aria-hidden' : true,'tabIndex' : '-1' })
-
-      tabactivate.apply(this, arguments)
-
-      element.addClass('active')
-      element.find('[data-toggle=tab]').attr({ 'tabIndex' : '0','aria-selected' : true })
-      element.filter('.tab-pane').attr({ 'aria-hidden' : false,'tabIndex' : '0' })
-   }
-
-
-  // Collapse Extension
-  // ===============================
-
-      var $colltabs =  $('[data-toggle="collapse"]')
-      $colltabs.attr({ 'role':'tab', 'aria-selected':'false', 'aria-expanded':'false' })
-      $colltabs.each(function( index ) {
-        var colltab = $(this)
-        , collpanel = (colltab.attr('data-target')) ? $(colltab.attr('data-target')) : $(colltab.attr('href'))
-        , parent  = colltab.attr('data-parent')
-        , collparent = parent && $(parent)
-        , collid = colltab.attr('id') || uniqueId('ui-collapse')
-
-        $(collparent).find('div:not(.collapse,.panel-body), h4').attr('role','presentation')
-
-          colltab.attr('id', collid)
-          if(collparent){
-            collparent.attr({ 'role' : 'tablist', 'aria-multiselectable' : 'true' })
-            if(collpanel.hasClass('in')){
-              colltab.attr({ 'aria-controls': colltab.attr('href').substr(1), 'aria-selected':'true', 'aria-expanded':'true', 'tabindex':'0' })
-              collpanel.attr({ 'role':'tabpanel', 'tabindex':'0', 'aria-labelledby':collid, 'aria-hidden':'false' })
-            }else{
-              colltab.attr({'aria-controls' : colltab.attr('href').substr(1), 'tabindex':'-1' })
-              collpanel.attr({ 'role':'tabpanel', 'tabindex':'-1', 'aria-labelledby':collid, 'aria-hidden':'true' })
-            }
-          }
-      })
-
-    var collToggle = $.fn.collapse.Constructor.prototype.toggle
-    $.fn.collapse.Constructor.prototype.toggle = function(){
-        var prevTab = this.$parent && this.$parent.find('[aria-expanded="true"]') , href
-
-        if(prevTab){
-          var prevPanel = prevTab.attr('data-target') || (href = prevTab.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')
-          , $prevPanel = $(prevPanel)
-          , $curPanel = this.$element
-          , par = this.$parent
-          , curTab
-
-        if (this.$parent) curTab = this.$parent.find('[data-toggle=collapse][href="#' + this.$element.attr('id') + '"]')
-
-        collToggle.apply(this, arguments)
-
-        if ($.support.transition) {
-          this.$element.one($.support.transition.end, function(){
-
-              prevTab.attr({ 'aria-selected':'false','aria-expanded':'false', 'tabIndex':'-1' })
-              $prevPanel.attr({ 'aria-hidden' : 'true','tabIndex' : '-1'})
-
-              curTab.attr({ 'aria-selected':'true','aria-expanded':'true', 'tabIndex':'0' })
-
-              if($curPanel.hasClass('in')){
-                $curPanel.attr({ 'aria-hidden' : 'false','tabIndex' : '0' })
-              }else{
-                curTab.attr({ 'aria-selected':'false','aria-expanded':'false'})
-                $curPanel.attr({ 'aria-hidden' : 'true','tabIndex' : '-1' })
-              }
-          })
-        }
-      }else{
-        collToggle.apply(this, arguments)
-      }
-    }
-
-    $.fn.collapse.Constructor.prototype.keydown = function (e) {
-      var $this = $(this)
-      , $items
-      , $tablist = $this.closest('div[role=tablist] ')
-      , index
-      , k = e.which || e.keyCode
-
-      $this = $(this)
-      if (!/(32|37|38|39|40)/.test(k)) return
-      if(k==32) $this.click()
-
-      $items = $tablist.find('[role=tab]')
-      index = $items.index($items.filter(':focus'))
-
-      if (k == 38 || k == 37) index--                                        // up & left
-      if (k == 39 || k == 40) index++                        // down & right
-      if(index < 0) index = $items.length -1
-      if(index == $items.length) index = 0
-
-      $items.eq(index).focus()
-
-      e.preventDefault()
-      e.stopPropagation()
-
-    }
-
-    $(document).on('keydown.collapse.data-api','[data-toggle="collapse"]' ,  $.fn.collapse.Constructor.prototype.keydown)
-
-  // Carousel Extension
-  // ===============================
-
-      $('.carousel').each(function (index) {
-        var $this = $(this)
-          , prev = $this.find('[data-slide="prev"]')
-          , next = $this.find('[data-slide="next"]')
-          , $options = $this.find('.item')
-          , $listbox = $options.parent()
-
-        $this.attr( { 'data-interval' : 'false', 'data-wrap' : 'false' } )
-        $listbox.attr('role', 'listbox')
-        $options.attr('role', 'option')
-
-        var spanPrev = document.createElement('span')
-        spanPrev.setAttribute('class', 'sr-only')
-        spanPrev.innerHTML='Previous'
-
-        var spanNext = document.createElement('span')
-        spanNext.setAttribute('class', 'sr-only')
-        spanNext.innerHTML='Next'
-
-        prev.attr('role', 'button')
-        next.attr('role', 'button')
-
-        prev.append(spanPrev)
-        next.append(spanNext)
-
-        $options.each(function () {
-          var item = $(this)
-          if(item.hasClass('active')){
-            item.attr({ 'aria-selected': 'true', 'tabindex' : '0' })
-          }else{
-            item.attr({ 'aria-selected': 'false', 'tabindex' : '-1' })
-          }
-        })
-      })
-
-      var slideCarousel = $.fn.carousel.Constructor.prototype.slide
-      $.fn.carousel.Constructor.prototype.slide = function (type, next) {
-        var $active = this.$element.find('.item.active')
-          , $next = next || $active[type]()
-
-        slideCarousel.apply(this, arguments)
-
-      $active
-        .one($.support.transition.end, function () {
-        $active.attr({'aria-selected':false, 'tabIndex': '-1'})
-        $next.attr({'aria-selected':true, 'tabIndex': '0'})
-        //.focus()
-       })
-      }
-
-    $.fn.carousel.Constructor.prototype.keydown = function (e) {
-     var $this = $(this)
-      , $ul = $this.closest('div[role=listbox]')
-      , $items = $ul.find('[role=option]')
-      , $parent = $ul.parent()
-      , k = e.which || e.keyCode
-      , index
-      , i
-
-      if (!/(37|38|39|40)/.test(k)) return
-
-      index = $items.index($items.filter('.active'))
-      if (k == 37 || k == 38) {                           //  Up
-        $parent.carousel('prev')
-        index--
-        if(index < 0) index = $items.length -1
-        else  $this.prev().focus()
-
-      }
-      if (k == 39 || k == 40) {                          // Down
-        $parent.carousel('next')
-        index++
-        if(index == $items.length) index = 0
-        else  {
-          $this.one($.support.transition.end, function () {
-            $this.next().focus()
-          })
-        }
-
-      }
-
-      e.preventDefault()
-      e.stopPropagation()
-    }
-    $(document).on('keydown.carousel.data-api', 'div[role=option]', $.fn.carousel.Constructor.prototype.keydown)
-
-  // GENERAL UTILITY FUNCTIONS
-  // ===============================
-
-    var removeMultiValAttributes = function (el, attr, val) {
-     var describedby = (el.attr( attr ) || "").split( /\s+/ )
-        , index = $.inArray(val, describedby)
-     if ( index !== -1 ) {
-       describedby.splice( index, 1 )
-     }
-     describedby = $.trim( describedby.join( " " ) )
-     if (describedby ) {
-       el.attr( attr, describedby )
-     } else {
-      el.removeAttr( attr )
-     }
-    }
-
-
-})(jQuery);
diff --git a/js/bootstrap-accessibility.min.js b/js/bootstrap-accessibility.min.js
deleted file mode 100644
index efedae78c329f0fdb652b70e692906357cebee69..0000000000000000000000000000000000000000
--- a/js/bootstrap-accessibility.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! bootstrap-accessibility-plugin - v1.0.2 - 2014-05-21
-* https://github.com/paypal/bootstrap-accessibility-plugin
-* Copyright (c) 2014 PayPal Accessibility Team; Licensed BSD */
-!function($){"use strict";var uniqueId=function(prefix){return(prefix||"ui-id")+"-"+Math.floor(1e3*Math.random()+1)};$(".alert").attr("role","alert"),$(".close").removeAttr("aria-hidden").wrapInner('<span aria-hidden="true"></span>').append('<span class="sr-only">Fermer</span>');var showTooltip=$.fn.tooltip.Constructor.prototype.show,hideTooltip=$.fn.tooltip.Constructor.prototype.hide;$.fn.tooltip.Constructor.prototype.show=function(){showTooltip.apply(this,arguments);var $tip=this.tip(),tooltipID=$tip.attr("id")||uniqueId("ui-tooltip");$tip.attr({role:"tooltip",id:tooltipID}),this.$element.attr("aria-describedby",tooltipID)},$.fn.tooltip.Constructor.prototype.hide=function(){return hideTooltip.apply(this,arguments),removeMultiValAttributes(this.$element,"aria-describedby",this.tip().attr("id")),this};{var showPopover=$.fn.popover.Constructor.prototype.setContent;$.fn.popover.Constructor.prototype.hide}$.fn.popover.Constructor.prototype.setContent=function(){showPopover.apply(this,arguments);var $tip=this.tip(),tooltipID=$tip.attr("id")||uniqueId("ui-tooltip");$tip.attr({role:"alert",id:tooltipID}),this.$element.attr("aria-describedby",tooltipID),this.$element.focus()},$.fn.popover.Constructor.prototype.hide=function(){hideTooltip.apply(this,arguments),removeMultiValAttributes(this.$element,"aria-describedby",this.tip().attr("id"))},$(".modal-dialog").attr({role:"document"});var modalhide=$.fn.modal.Constructor.prototype.hide;$.fn.modal.Constructor.prototype.hide=function(){var modalOpener=this.$element.parent().find('[data-target="#'+this.$element.attr("id")+'"]');modalhide.apply(this,arguments),modalOpener.focus()};var $par,firstItem,toggle="[data-toggle=dropdown]",focusDelay=200,menus=$(toggle).parent().find("ul").attr("role","menu"),lis=menus.find("li").attr("role","presentation");lis.find("a").attr({role:"menuitem",tabIndex:"-1"}),$(toggle).attr({"aria-haspopup":"true","aria-expanded":"false"}),$(toggle).parent().on("shown.bs.dropdown",function(){$par=$(this);var $toggle=$par.find(toggle);$toggle.attr("aria-expanded","true"),setTimeout(function(){firstItem=$(".dropdown-menu [role=menuitem]:visible",$par)[0];try{firstItem.focus()}catch(ex){}},focusDelay)}),$(toggle).parent().on("hidden.bs.dropdown",function(){$par=$(this);var $toggle=$par.find(toggle);$toggle.attr("aria-expanded","false")}),$.fn.dropdown.Constructor.prototype.keydown=function(e){var $par;/(32)/.test(e.keyCode)&&($par=$(this).parent(),$(this).trigger("click"),e.preventDefault()&&e.stopPropagation())},$(document).on("focusout.dropdown.data-api",".dropdown-menu",function(){var $this=$(this),that=this;setTimeout(function(){$.contains(that,document.activeElement)||($this.parent().removeClass("open"),$this.parent().find("[data-toggle=dropdown]").attr("aria-expanded","false"))},150)}).on("keydown.bs.dropdown.data-api",toggle+", [role=menu]",$.fn.dropdown.Constructor.prototype.keydown);var $tablist=$(".nav-tabs"),$lis=$tablist.children("li"),$tabs=$tablist.find('[data-toggle="tab"], [data-toggle="pill"]');$tablist.attr("role","tablist"),$lis.attr("role","presentation"),$tabs.attr("role","tab"),$tabs.each(function(){var tabpanel=$($(this).attr("href")),tab=$(this),tabid=tab.attr("id")||uniqueId("ui-tab");tab.attr("id",tabid),tab.parent().hasClass("active")?(tab.attr({tabIndex:"0","aria-selected":"true","aria-controls":tab.attr("href").substr(1)}),tabpanel.attr({role:"tabpanel",tabIndex:"0","aria-hidden":"false","aria-labelledby":tabid})):(tab.attr({tabIndex:"-1","aria-selected":"false","aria-controls":tab.attr("href").substr(1)}),tabpanel.attr({role:"tabpanel",tabIndex:"-1","aria-hidden":"true","aria-labelledby":tabid}))}),$.fn.tab.Constructor.prototype.keydown=function(e){var $items,index,$this=$(this),$ul=$this.closest("ul[role=tablist] "),k=e.which||e.keyCode;if($this=$(this),/(37|38|39|40)/.test(k)){$items=$ul.find("[role=tab]:visible"),index=$items.index($items.filter(":focus")),(38==k||37==k)&&index--,(39==k||40==k)&&index++,0>index&&(index=$items.length-1),index==$items.length&&(index=0);var nextTab=$items.eq(index);"tab"===nextTab.attr("role")&&nextTab.tab("show").focus(),e.preventDefault(),e.stopPropagation()}},$(document).on("keydown.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',$.fn.tab.Constructor.prototype.keydown);var tabactivate=$.fn.tab.Constructor.prototype.activate;$.fn.tab.Constructor.prototype.activate=function(element,container){var $active=container.find("> .active");$active.find("[data-toggle=tab]").attr({tabIndex:"-1","aria-selected":!1}),$active.filter(".tab-pane").attr({"aria-hidden":!0,tabIndex:"-1"}),tabactivate.apply(this,arguments),element.addClass("active"),element.find("[data-toggle=tab]").attr({tabIndex:"0","aria-selected":!0}),element.filter(".tab-pane").attr({"aria-hidden":!1,tabIndex:"0"})};var $colltabs=$('[data-toggle="collapse"]');$colltabs.attr({role:"tab","aria-selected":"false","aria-expanded":"false"}),$colltabs.each(function(){var colltab=$(this),collpanel=$(colltab.attr("data-target")?colltab.attr("data-target"):colltab.attr("href")),parent=colltab.attr("data-parent"),collparent=parent&&$(parent),collid=colltab.attr("id")||uniqueId("ui-collapse");$(collparent).find("div:not(.collapse,.panel-body), h4").attr("role","presentation"),colltab.attr("id",collid),collparent&&(collparent.attr({role:"tablist","aria-multiselectable":"true"}),collpanel.hasClass("in")?(colltab.attr({"aria-controls":colltab.attr("href").substr(1),"aria-selected":"true","aria-expanded":"true",tabindex:"0"}),collpanel.attr({role:"tabpanel",tabindex:"0","aria-labelledby":collid,"aria-hidden":"false"})):(colltab.attr({"aria-controls":colltab.attr("href").substr(1),tabindex:"-1"}),collpanel.attr({role:"tabpanel",tabindex:"-1","aria-labelledby":collid,"aria-hidden":"true"})))});var collToggle=$.fn.collapse.Constructor.prototype.toggle;$.fn.collapse.Constructor.prototype.toggle=function(){var href,prevTab=this.$parent&&this.$parent.find('[aria-expanded="true"]');if(prevTab){{var curTab,prevPanel=prevTab.attr("data-target")||(href=prevTab.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,""),$prevPanel=$(prevPanel),$curPanel=this.$element;this.$parent}this.$parent&&(curTab=this.$parent.find('[data-toggle=collapse][href="#'+this.$element.attr("id")+'"]')),collToggle.apply(this,arguments),$.support.transition&&this.$element.one($.support.transition.end,function(){prevTab.attr({"aria-selected":"false","aria-expanded":"false",tabIndex:"-1"}),$prevPanel.attr({"aria-hidden":"true",tabIndex:"-1"}),curTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:"0"}),$curPanel.hasClass("in")?$curPanel.attr({"aria-hidden":"false",tabIndex:"0"}):(curTab.attr({"aria-selected":"false","aria-expanded":"false"}),$curPanel.attr({"aria-hidden":"true",tabIndex:"-1"}))})}else collToggle.apply(this,arguments)},$.fn.collapse.Constructor.prototype.keydown=function(e){var $items,index,$this=$(this),$tablist=$this.closest("div[role=tablist] "),k=e.which||e.keyCode;$this=$(this),/(32|37|38|39|40)/.test(k)&&(32==k&&$this.click(),$items=$tablist.find("[role=tab]"),index=$items.index($items.filter(":focus")),(38==k||37==k)&&index--,(39==k||40==k)&&index++,0>index&&(index=$items.length-1),index==$items.length&&(index=0),$items.eq(index).focus(),e.preventDefault(),e.stopPropagation())},$(document).on("keydown.collapse.data-api",'[data-toggle="collapse"]',$.fn.collapse.Constructor.prototype.keydown),$(".carousel").each(function(){var $this=$(this),prev=$this.find('[data-slide="prev"]'),next=$this.find('[data-slide="next"]'),$options=$this.find(".item"),$listbox=$options.parent();$this.attr({"data-interval":"false","data-wrap":"false"}),$listbox.attr("role","listbox"),$options.attr("role","option");var spanPrev=document.createElement("span");spanPrev.setAttribute("class","sr-only"),spanPrev.innerHTML="Previous";var spanNext=document.createElement("span");spanNext.setAttribute("class","sr-only"),spanNext.innerHTML="Next",prev.attr("role","button"),next.attr("role","button"),prev.append(spanPrev),next.append(spanNext),$options.each(function(){var item=$(this);item.attr(item.hasClass("active")?{"aria-selected":"true",tabindex:"0"}:{"aria-selected":"false",tabindex:"-1"})})});var slideCarousel=$.fn.carousel.Constructor.prototype.slide;$.fn.carousel.Constructor.prototype.slide=function(type,next){var $active=this.$element.find(".item.active"),$next=next||$active[type]();slideCarousel.apply(this,arguments),$active.one($.support.transition.end,function(){$active.attr({"aria-selected":!1,tabIndex:"-1"}),$next.attr({"aria-selected":!0,tabIndex:"0"})})},$.fn.carousel.Constructor.prototype.keydown=function(e){var index,$this=$(this),$ul=$this.closest("div[role=listbox]"),$items=$ul.find("[role=option]"),$parent=$ul.parent(),k=e.which||e.keyCode;/(37|38|39|40)/.test(k)&&(index=$items.index($items.filter(".active")),(37==k||38==k)&&($parent.carousel("prev"),index--,0>index?index=$items.length-1:$this.prev().focus()),(39==k||40==k)&&($parent.carousel("next"),index++,index==$items.length?index=0:$this.one($.support.transition.end,function(){$this.next().focus()})),e.preventDefault(),e.stopPropagation())},$(document).on("keydown.carousel.data-api","div[role=option]",$.fn.carousel.Constructor.prototype.keydown);var removeMultiValAttributes=function(el,attr,val){var describedby=(el.attr(attr)||"").split(/\s+/),index=$.inArray(val,describedby);-1!==index&&describedby.splice(index,1),describedby=$.trim(describedby.join(" ")),describedby?el.attr(attr,describedby):el.removeAttr(attr)}}(jQuery);
diff --git a/js/bootstrap-datepicker.js b/js/bootstrap-datepicker.js
index 8267df96396493990b876f853dec4e1e5268e9b7..123937735fd0b89e6ff0e5ff623fc0165131d907 100644
--- a/js/bootstrap-datepicker.js
+++ b/js/bootstrap-datepicker.js
@@ -22,1650 +22,1652 @@
 
 (function($, undefined){
 
-	var $window = $(window);
-
-	function UTCDate(){
-		return new Date(Date.UTC.apply(Date, arguments));
-	}
-	function UTCToday(){
-		var today = new Date();
-		return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
-	}
-	function alias(method){
-		return function(){
-			return this[method].apply(this, arguments);
-		};
-	}
-
-	var DateArray = (function(){
-		var extras = {
-			get: function(i){
-				return this.slice(i)[0];
-			},
-			contains: function(d){
-				// Array.indexOf is not cross-browser;
-				// $.inArray doesn't work with Dates
-				var val = d && d.valueOf();
-				for (var i=0, l=this.length; i < l; i++)
-					if (this[i].valueOf() === val)
-						return i;
-				return -1;
-			},
-			remove: function(i){
-				this.splice(i,1);
-			},
-			replace: function(new_array){
-				if (!new_array)
-					return;
-				if (!$.isArray(new_array))
-					new_array = [new_array];
-				this.clear();
-				this.push.apply(this, new_array);
-			},
-			clear: function(){
-				this.splice(0);
-			},
-			copy: function(){
-				var a = new DateArray();
-				a.replace(this);
-				return a;
-			}
-		};
-
-		return function(){
-			var a = [];
-			a.push.apply(a, arguments);
-			$.extend(a, extras);
-			return a;
-		};
-	})();
-
-
-	// Picker object
-
-	var Datepicker = function(element, options){
-		this.dates = new DateArray();
-		this.viewDate = UTCToday();
-		this.focusDate = null;
-
-		this._process_options(options);
-
-		this.element = $(element);
-		this.isInline = false;
-		this.isInput = this.element.is('input');
-		this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
-		this.hasInput = this.component && this.element.find('input').length;
-		if (this.component && this.component.length === 0)
-			this.component = false;
-
-		this.picker = $(DPGlobal.template);
-		this._buildEvents();
-		this._attachEvents();
-
-		if (this.isInline){
-			this.picker.addClass('datepicker-inline').appendTo(this.element);
-		}
-		else {
-			this.picker.addClass('datepicker-dropdown dropdown-menu');
-		}
-
-		if (this.o.rtl){
-			this.picker.addClass('datepicker-rtl');
-		}
-
-		this.viewMode = this.o.startView;
-
-		if (this.o.calendarWeeks)
-			this.picker.find('tfoot th.today')
-						.attr('colspan', function(i, val){
-							return parseInt(val) + 1;
-						});
-
-		this._allow_update = false;
-
-		this.setStartDate(this._o.startDate);
-		this.setEndDate(this._o.endDate);
-		this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
-
-		this.fillDow();
-		this.fillMonths();
-
-		this._allow_update = true;
-
-		this.update();
-		this.showMode();
-
-		if (this.isInline){
-			this.show();
-		}
-	};
-
-	Datepicker.prototype = {
-		constructor: Datepicker,
-
-		_process_options: function(opts){
-			// Store raw options for reference
-			this._o = $.extend({}, this._o, opts);
-			// Processed options
-			var o = this.o = $.extend({}, this._o);
-
-			// Check if "de-DE" style date is available, if not language should
-			// fallback to 2 letter code eg "de"
-			var lang = o.language;
-			if (!dates[lang]){
-				lang = lang.split('-')[0];
-				if (!dates[lang])
-					lang = defaults.language;
-			}
-			o.language = lang;
-
-			switch (o.startView){
-				case 2:
-				case 'decade':
-					o.startView = 2;
-					break;
-				case 1:
-				case 'year':
-					o.startView = 1;
-					break;
-				default:
-					o.startView = 0;
-			}
-
-			switch (o.minViewMode){
-				case 1:
-				case 'months':
-					o.minViewMode = 1;
-					break;
-				case 2:
-				case 'years':
-					o.minViewMode = 2;
-					break;
-				default:
-					o.minViewMode = 0;
-			}
-
-			o.startView = Math.max(o.startView, o.minViewMode);
-
-			// true, false, or Number > 0
-			if (o.multidate !== true){
-				o.multidate = Number(o.multidate) || false;
-				if (o.multidate !== false)
-					o.multidate = Math.max(0, o.multidate);
-				else
-					o.multidate = 1;
-			}
-			o.multidateSeparator = String(o.multidateSeparator);
-
-			o.weekStart %= 7;
-			o.weekEnd = ((o.weekStart + 6) % 7);
-
-			var format = DPGlobal.parseFormat(o.format);
-			if (o.startDate !== -Infinity){
-				if (!!o.startDate){
-					if (o.startDate instanceof Date)
-						o.startDate = this._local_to_utc(this._zero_time(o.startDate));
-					else
-						o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
-				}
-				else {
-					o.startDate = -Infinity;
-				}
-			}
-			if (o.endDate !== Infinity){
-				if (!!o.endDate){
-					if (o.endDate instanceof Date)
-						o.endDate = this._local_to_utc(this._zero_time(o.endDate));
-					else
-						o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
-				}
-				else {
-					o.endDate = Infinity;
-				}
-			}
-
-			o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
-			if (!$.isArray(o.daysOfWeekDisabled))
-				o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
-			o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
-				return parseInt(d, 10);
-			});
-
-			var plc = String(o.orientation).toLowerCase().split(/\s+/g),
-				_plc = o.orientation.toLowerCase();
-			plc = $.grep(plc, function(word){
-				return (/^auto|left|right|top|bottom$/).test(word);
-			});
-			o.orientation = {x: 'auto', y: 'auto'};
-			if (!_plc || _plc === 'auto')
-				; // no action
-			else if (plc.length === 1){
-				switch (plc[0]){
-					case 'top':
-					case 'bottom':
-						o.orientation.y = plc[0];
-						break;
-					case 'left':
-					case 'right':
-						o.orientation.x = plc[0];
-						break;
-				}
-			}
-			else {
-				_plc = $.grep(plc, function(word){
-					return (/^left|right$/).test(word);
-				});
-				o.orientation.x = _plc[0] || 'auto';
-
-				_plc = $.grep(plc, function(word){
-					return (/^top|bottom$/).test(word);
-				});
-				o.orientation.y = _plc[0] || 'auto';
-			}
-		},
-		_events: [],
-		_secondaryEvents: [],
-		_applyEvents: function(evs){
-			for (var i=0, el, ch, ev; i < evs.length; i++){
-				el = evs[i][0];
-				if (evs[i].length === 2){
-					ch = undefined;
-					ev = evs[i][1];
-				}
-				else if (evs[i].length === 3){
-					ch = evs[i][1];
-					ev = evs[i][2];
-				}
-				el.on(ev, ch);
-			}
-		},
-		_unapplyEvents: function(evs){
-			for (var i=0, el, ev, ch; i < evs.length; i++){
-				el = evs[i][0];
-				if (evs[i].length === 2){
-					ch = undefined;
-					ev = evs[i][1];
-				}
-				else if (evs[i].length === 3){
-					ch = evs[i][1];
-					ev = evs[i][2];
-				}
-				el.off(ev, ch);
-			}
-		},
-		_buildEvents: function(){
-			if (this.isInput){ // single input
-				this._events = [
-					[this.element, {
-						focus: $.proxy(this.show, this),
-						keyup: $.proxy(function(e){
-							if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
-								this.update();
-						}, this),
-						keydown: $.proxy(this.keydown, this)
-					}]
-				];
-			}
-			else if (this.component && this.hasInput){ // component: input + button
-				this._events = [
-					// For components that are not readonly, allow keyboard nav
-					[this.element.find('input'), {
-						//focus: $.proxy(this.show, this),
-						keyup: $.proxy(function(e){
-							if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
-								this.update();
-						}, this),
-						keydown: $.proxy(this.keydown, this)
-					}],
-					[this.component, {
-						click: $.proxy(this.show, this)
-					}]
-				];
-			}
-			else if (this.element.is('div')){  // inline datepicker
-				this.isInline = true;
-			}
-			else {
-				this._events = [
-					[this.element, {
-						click: $.proxy(this.show, this)
-					}]
-				];
-			}
-			this._events.push(
-				// Component: listen for blur on element descendants
-				[this.element, '*', {
-					blur: $.proxy(function(e){
-						this._focused_from = e.target;
-					}, this)
-				}],
-				// Input: listen for blur on element
-				[this.element, {
-					blur: $.proxy(function(e){
-						this._focused_from = e.target;
-					}, this)
-				}]
-			);
-
-			this._secondaryEvents = [
-				[this.picker, {
-					click: $.proxy(this.click, this)
-				}],
-				[$(window), {
-					resize: $.proxy(this.place, this)
-				}],
-				[$(document), {
-					'mousedown touchstart': $.proxy(function(e){
-						// Clicked outside the datepicker, hide it
-						if (!(
-							this.element.is(e.target) ||
-							this.element.find(e.target).length ||
-							this.picker.is(e.target) ||
-							this.picker.find(e.target).length
-						)){
-							this.hide();
-						}
-					}, this)
-				}]
-			];
-		},
-		_attachEvents: function(){
-			this._detachEvents();
-			this._applyEvents(this._events);
-		},
-		_detachEvents: function(){
-			this._unapplyEvents(this._events);
-		},
-		_attachSecondaryEvents: function(){
-			this._detachSecondaryEvents();
-			this._applyEvents(this._secondaryEvents);
-		},
-		_detachSecondaryEvents: function(){
-			this._unapplyEvents(this._secondaryEvents);
-		},
-		_trigger: function(event, altdate){
-			var date = altdate || this.dates.get(-1),
-				local_date = this._utc_to_local(date);
-
-			this.element.trigger({
-				type: event,
-				date: local_date,
-				dates: $.map(this.dates, this._utc_to_local),
-				format: $.proxy(function(ix, format){
-					if (arguments.length === 0){
-						ix = this.dates.length - 1;
-						format = this.o.format;
-					}
-					else if (typeof ix === 'string'){
-						format = ix;
-						ix = this.dates.length - 1;
-					}
-					format = format || this.o.format;
-					var date = this.dates.get(ix);
-					return DPGlobal.formatDate(date, format, this.o.language);
-				}, this)
-			});
-		},
-
-		show: function(){
-			if (!this.isInline)
-				this.picker.appendTo('body');
-			this.picker.show();
-			this.place();
-			this._attachSecondaryEvents();
-			this._trigger('show');
-		},
-
-		hide: function(){
-			if (this.isInline)
-				return;
-			if (!this.picker.is(':visible'))
-				return;
-			this.focusDate = null;
-			this.picker.hide().detach();
-			this._detachSecondaryEvents();
-			this.viewMode = this.o.startView;
-			this.showMode();
-
-			if (
-				this.o.forceParse &&
-				(
-					this.isInput && this.element.val() ||
-					this.hasInput && this.element.find('input').val()
-				)
-			)
-				this.setValue();
-			this._trigger('hide');
-		},
-
-		remove: function(){
-			this.hide();
-			this._detachEvents();
-			this._detachSecondaryEvents();
-			this.picker.remove();
-			delete this.element.data().datepicker;
-			if (!this.isInput){
-				delete this.element.data().date;
-			}
-		},
-
-		_utc_to_local: function(utc){
-			return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
-		},
-		_local_to_utc: function(local){
-			return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
-		},
-		_zero_time: function(local){
-			return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
-		},
-		_zero_utc_time: function(utc){
-			return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
-		},
-
-		getDates: function(){
-			return $.map(this.dates, this._utc_to_local);
-		},
-
-		getUTCDates: function(){
-			return $.map(this.dates, function(d){
-				return new Date(d);
-			});
-		},
-
-		getDate: function(){
-			return this._utc_to_local(this.getUTCDate());
-		},
-
-		getUTCDate: function(){
-			return new Date(this.dates.get(-1));
-		},
-
-		setDates: function(){
-			var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
-			this.update.apply(this, args);
-			this._trigger('changeDate');
-			this.setValue();
-		},
-
-		setUTCDates: function(){
-			var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
-			this.update.apply(this, $.map(args, this._utc_to_local));
-			this._trigger('changeDate');
-			this.setValue();
-		},
-
-		setDate: alias('setDates'),
-		setUTCDate: alias('setUTCDates'),
-
-		setValue: function(){
-			var formatted = this.getFormattedDate();
-			if (!this.isInput){
-				if (this.component){
-					this.element.find('input').val(formatted).change();
-				}
-			}
-			else {
-				this.element.val(formatted).change();
-			}
-		},
-
-		getFormattedDate: function(format){
-			if (format === undefined)
-				format = this.o.format;
-
-			var lang = this.o.language;
-			return $.map(this.dates, function(d){
-				return DPGlobal.formatDate(d, format, lang);
-			}).join(this.o.multidateSeparator);
-		},
-
-		setStartDate: function(startDate){
-			this._process_options({startDate: startDate});
-			this.update();
-			this.updateNavArrows();
-		},
-
-		setEndDate: function(endDate){
-			this._process_options({endDate: endDate});
-			this.update();
-			this.updateNavArrows();
-		},
-
-		setDaysOfWeekDisabled: function(daysOfWeekDisabled){
-			this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
-			this.update();
-			this.updateNavArrows();
-		},
-
-		place: function(){
-			if (this.isInline)
-				return;
-			var calendarWidth = this.picker.outerWidth(),
-				calendarHeight = this.picker.outerHeight(),
-				visualPadding = 10,
-				windowWidth = $window.width(),
-				windowHeight = $window.height(),
-				scrollTop = $window.scrollTop();
-
-			var zIndex = parseInt(this.element.parents().filter(function(){
-					return $(this).css('z-index') !== 'auto';
-				}).first().css('z-index'))+10;
-			var offset = this.component ? this.component.parent().offset() : this.element.offset();
-			var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
-			var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
-			var left = offset.left,
-				top = offset.top;
-
-			this.picker.removeClass(
-				'datepicker-orient-top datepicker-orient-bottom '+
-				'datepicker-orient-right datepicker-orient-left'
-			);
-
-			if (this.o.orientation.x !== 'auto'){
-				this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
-				if (this.o.orientation.x === 'right')
-					left -= calendarWidth - width;
-			}
-			// auto x orientation is best-placement: if it crosses a window
-			// edge, fudge it sideways
-			else {
-				// Default to left
-				this.picker.addClass('datepicker-orient-left');
-				if (offset.left < 0)
-					left -= offset.left - visualPadding;
-				else if (offset.left + calendarWidth > windowWidth)
-					left = windowWidth - calendarWidth - visualPadding;
-			}
-
-			// auto y orientation is best-situation: top or bottom, no fudging,
-			// decision based on which shows more of the calendar
-			var yorient = this.o.orientation.y,
-				top_overflow, bottom_overflow;
-			if (yorient === 'auto'){
-				top_overflow = -scrollTop + offset.top - calendarHeight;
-				bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
-				if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
-					yorient = 'top';
-				else
-					yorient = 'bottom';
-			}
-			this.picker.addClass('datepicker-orient-' + yorient);
-			if (yorient === 'top')
-				top += height;
-			else
-				top -= calendarHeight + parseInt(this.picker.css('padding-top'));
-
-			this.picker.css({
-				top: top,
-				left: left,
-				zIndex: zIndex
-			});
-		},
-
-		_allow_update: true,
-		update: function(){
-			if (!this._allow_update)
-				return;
-
-			var oldDates = this.dates.copy(),
-				dates = [],
-				fromArgs = false;
-			if (arguments.length){
-				$.each(arguments, $.proxy(function(i, date){
-					if (date instanceof Date)
-						date = this._local_to_utc(date);
-					dates.push(date);
-				}, this));
-				fromArgs = true;
-			}
-			else {
-				dates = this.isInput
-						? this.element.val()
-						: this.element.data('date') || this.element.find('input').val();
-				if (dates && this.o.multidate)
-					dates = dates.split(this.o.multidateSeparator);
-				else
-					dates = [dates];
-				delete this.element.data().date;
-			}
-
-			dates = $.map(dates, $.proxy(function(date){
-				return DPGlobal.parseDate(date, this.o.format, this.o.language);
-			}, this));
-			dates = $.grep(dates, $.proxy(function(date){
-				return (
-					date < this.o.startDate ||
-					date > this.o.endDate ||
-					!date
-				);
-			}, this), true);
-			this.dates.replace(dates);
-
-			if (this.dates.length)
-				this.viewDate = new Date(this.dates.get(-1));
-			else if (this.viewDate < this.o.startDate)
-				this.viewDate = new Date(this.o.startDate);
-			else if (this.viewDate > this.o.endDate)
-				this.viewDate = new Date(this.o.endDate);
-
-			if (fromArgs){
-				// setting date by clicking
-				this.setValue();
-			}
-			else if (dates.length){
-				// setting date by typing
-				if (String(oldDates) !== String(this.dates))
-					this._trigger('changeDate');
-			}
-			if (!this.dates.length && oldDates.length)
-				this._trigger('clearDate');
-
-			this.fill();
-		},
-
-		fillDow: function(){
-			var dowCnt = this.o.weekStart,
-				html = '<tr>';
-			if (this.o.calendarWeeks){
-				var cell = '<th class="cw">&nbsp;</th>';
-				html += cell;
-				this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
-			}
-			while (dowCnt < this.o.weekStart + 7){
-				html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
-			}
-			html += '</tr>';
-			this.picker.find('.datepicker-days thead').append(html);
-		},
-
-		fillMonths: function(){
-			var html = '',
-			i = 0;
-			while (i < 12){
-				html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
-			}
-			this.picker.find('.datepicker-months td').html(html);
-		},
-
-		setRange: function(range){
-			if (!range || !range.length)
-				delete this.range;
-			else
-				this.range = $.map(range, function(d){
-					return d.valueOf();
-				});
-			this.fill();
-		},
-
-		getClassNames: function(date){
-			var cls = [],
-				year = this.viewDate.getUTCFullYear(),
-				month = this.viewDate.getUTCMonth(),
-				today = new Date();
-			if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
-				cls.push('old');
-			}
-			else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
-				cls.push('new');
-			}
-			if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
-				cls.push('focused');
-			// Compare internal UTC date with local today, not UTC today
-			if (this.o.todayHighlight &&
-				date.getUTCFullYear() === today.getFullYear() &&
-				date.getUTCMonth() === today.getMonth() &&
-				date.getUTCDate() === today.getDate()){
-				cls.push('today');
-			}
-			if (this.dates.contains(date) !== -1)
-				cls.push('active');
-			if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
-				$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
-				cls.push('disabled');
-			}
-			if (this.range){
-				if (date > this.range[0] && date < this.range[this.range.length-1]){
-					cls.push('range');
-				}
-				if ($.inArray(date.valueOf(), this.range) !== -1){
-					cls.push('selected');
-				}
-			}
-			return cls;
-		},
-
-		fill: function(){
-			var d = new Date(this.viewDate),
-				year = d.getUTCFullYear(),
-				month = d.getUTCMonth(),
-				startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
-				startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
-				endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
-				endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
-				todaytxt = dates[this.o.language].today || dates['en'].today || '',
-				cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
-				tooltip;
-			this.picker.find('.datepicker-days thead th.datepicker-switch')
-						.text(dates[this.o.language].months[month]+' '+year);
-			this.picker.find('tfoot th.today')
-						.text(todaytxt)
-						.toggle(this.o.todayBtn !== false);
-			this.picker.find('tfoot th.clear')
-						.text(cleartxt)
-						.toggle(this.o.clearBtn !== false);
-			this.updateNavArrows();
-			this.fillMonths();
-			var prevMonth = UTCDate(year, month-1, 28),
-				day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
-			prevMonth.setUTCDate(day);
-			prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
-			var nextMonth = new Date(prevMonth);
-			nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
-			nextMonth = nextMonth.valueOf();
-			var html = [];
-			var clsName;
-			while (prevMonth.valueOf() < nextMonth){
-				if (prevMonth.getUTCDay() === this.o.weekStart){
-					html.push('<tr>');
-					if (this.o.calendarWeeks){
-						// ISO 8601: First week contains first thursday.
-						// ISO also states week starts on Monday, but we can be more abstract here.
-						var
-							// Start of current week: based on weekstart/current date
-							ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
-							// Thursday of this week
-							th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
-							// First Thursday of year, year from thursday
-							yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
-							// Calendar week: ms between thursdays, div ms per day, div 7 days
-							calWeek =  (th - yth) / 864e5 / 7 + 1;
-						html.push('<td class="cw">'+ calWeek +'</td>');
-
-					}
-				}
-				clsName = this.getClassNames(prevMonth);
-				clsName.push('day');
-
-				if (this.o.beforeShowDay !== $.noop){
-					var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
-					if (before === undefined)
-						before = {};
-					else if (typeof(before) === 'boolean')
-						before = {enabled: before};
-					else if (typeof(before) === 'string')
-						before = {classes: before};
-					if (before.enabled === false)
-						clsName.push('disabled');
-					if (before.classes)
-						clsName = clsName.concat(before.classes.split(/\s+/));
-					if (before.tooltip)
-						tooltip = before.tooltip;
-				}
-
-				clsName = $.unique(clsName);
-				html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
-				if (prevMonth.getUTCDay() === this.o.weekEnd){
-					html.push('</tr>');
-				}
-				prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
-			}
-			this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
-
-			var months = this.picker.find('.datepicker-months')
-						.find('th:eq(1)')
-							.text(year)
-							.end()
-						.find('span').removeClass('active');
-
-			$.each(this.dates, function(i, d){
-				if (d.getUTCFullYear() === year)
-					months.eq(d.getUTCMonth()).addClass('active');
-			});
-
-			if (year < startYear || year > endYear){
-				months.addClass('disabled');
-			}
-			if (year === startYear){
-				months.slice(0, startMonth).addClass('disabled');
-			}
-			if (year === endYear){
-				months.slice(endMonth+1).addClass('disabled');
-			}
-
-			html = '';
-			year = parseInt(year/10, 10) * 10;
-			var yearCont = this.picker.find('.datepicker-years')
-								.find('th:eq(1)')
-									.text(year + '-' + (year + 9))
-									.end()
-								.find('td');
-			year -= 1;
-			var years = $.map(this.dates, function(d){
-					return d.getUTCFullYear();
-				}),
-				classes;
-			for (var i = -1; i < 11; i++){
-				classes = ['year'];
-				if (i === -1)
-					classes.push('old');
-				else if (i === 10)
-					classes.push('new');
-				if ($.inArray(year, years) !== -1)
-					classes.push('active');
-				if (year < startYear || year > endYear)
-					classes.push('disabled');
-				html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
-				year += 1;
-			}
-			yearCont.html(html);
-		},
-
-		updateNavArrows: function(){
-			if (!this._allow_update)
-				return;
-
-			var d = new Date(this.viewDate),
-				year = d.getUTCFullYear(),
-				month = d.getUTCMonth();
-			switch (this.viewMode){
-				case 0:
-					if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
-						this.picker.find('.prev').css({visibility: 'hidden'});
-					}
-					else {
-						this.picker.find('.prev').css({visibility: 'visible'});
-					}
-					if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
-						this.picker.find('.next').css({visibility: 'hidden'});
-					}
-					else {
-						this.picker.find('.next').css({visibility: 'visible'});
-					}
-					break;
-				case 1:
-				case 2:
-					if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
-						this.picker.find('.prev').css({visibility: 'hidden'});
-					}
-					else {
-						this.picker.find('.prev').css({visibility: 'visible'});
-					}
-					if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
-						this.picker.find('.next').css({visibility: 'hidden'});
-					}
-					else {
-						this.picker.find('.next').css({visibility: 'visible'});
-					}
-					break;
-			}
-		},
-
-		click: function(e){
-			e.preventDefault();
-			var target = $(e.target).closest('span, td, th'),
-				year, month, day;
-			if (target.length === 1){
-				switch (target[0].nodeName.toLowerCase()){
-					case 'th':
-						switch (target[0].className){
-							case 'datepicker-switch':
-								this.showMode(1);
-								break;
-							case 'prev':
-							case 'next':
-								var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
-								switch (this.viewMode){
-									case 0:
-										this.viewDate = this.moveMonth(this.viewDate, dir);
-										this._trigger('changeMonth', this.viewDate);
-										break;
-									case 1:
-									case 2:
-										this.viewDate = this.moveYear(this.viewDate, dir);
-										if (this.viewMode === 1)
-											this._trigger('changeYear', this.viewDate);
-										break;
-								}
-								this.fill();
-								break;
-							case 'today':
-								var date = new Date();
-								date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
-
-								this.showMode(-2);
-								var which = this.o.todayBtn === 'linked' ? null : 'view';
-								this._setDate(date, which);
-								break;
-							case 'clear':
-								var element;
-								if (this.isInput)
-									element = this.element;
-								else if (this.component)
-									element = this.element.find('input');
-								if (element)
-									element.val("").change();
-								this.update();
-								this._trigger('changeDate');
-								if (this.o.autoclose)
-									this.hide();
-								break;
-						}
-						break;
-					case 'span':
-						if (!target.is('.disabled')){
-							this.viewDate.setUTCDate(1);
-							if (target.is('.month')){
-								day = 1;
-								month = target.parent().find('span').index(target);
-								year = this.viewDate.getUTCFullYear();
-								this.viewDate.setUTCMonth(month);
-								this._trigger('changeMonth', this.viewDate);
-								if (this.o.minViewMode === 1){
-									this._setDate(UTCDate(year, month, day));
-								}
-							}
-							else {
-								day = 1;
-								month = 0;
-								year = parseInt(target.text(), 10)||0;
-								this.viewDate.setUTCFullYear(year);
-								this._trigger('changeYear', this.viewDate);
-								if (this.o.minViewMode === 2){
-									this._setDate(UTCDate(year, month, day));
-								}
-							}
-							this.showMode(-1);
-							this.fill();
-						}
-						break;
-					case 'td':
-						if (target.is('.day') && !target.is('.disabled')){
-							day = parseInt(target.text(), 10)||1;
-							year = this.viewDate.getUTCFullYear();
-							month = this.viewDate.getUTCMonth();
-							if (target.is('.old')){
-								if (month === 0){
-									month = 11;
-									year -= 1;
-								}
-								else {
-									month -= 1;
-								}
-							}
-							else if (target.is('.new')){
-								if (month === 11){
-									month = 0;
-									year += 1;
-								}
-								else {
-									month += 1;
-								}
-							}
-							this._setDate(UTCDate(year, month, day));
-						}
-						break;
-				}
-			}
-			if (this.picker.is(':visible') && this._focused_from){
-				$(this._focused_from).focus();
-			}
-			delete this._focused_from;
-		},
-
-		_toggle_multidate: function(date){
-			var ix = this.dates.contains(date);
-			if (!date){
-				this.dates.clear();
-			}
-			else if (ix !== -1){
-				this.dates.remove(ix);
-			}
-			else {
-				this.dates.push(date);
-			}
-			if (typeof this.o.multidate === 'number')
-				while (this.dates.length > this.o.multidate)
-					this.dates.remove(0);
-		},
-
-		_setDate: function(date, which){
-			if (!which || which === 'date')
-				this._toggle_multidate(date && new Date(date));
-			if (!which || which  === 'view')
-				this.viewDate = date && new Date(date);
-
-			this.fill();
-			this.setValue();
-			this._trigger('changeDate');
-			var element;
-			if (this.isInput){
-				element = this.element;
-			}
-			else if (this.component){
-				element = this.element.find('input');
-			}
-			if (element){
-				element.change();
-			}
-			if (this.o.autoclose && (!which || which === 'date')){
-				this.hide();
-			}
-		},
-
-		moveMonth: function(date, dir){
-			if (!date)
-				return undefined;
-			if (!dir)
-				return date;
-			var new_date = new Date(date.valueOf()),
-				day = new_date.getUTCDate(),
-				month = new_date.getUTCMonth(),
-				mag = Math.abs(dir),
-				new_month, test;
-			dir = dir > 0 ? 1 : -1;
-			if (mag === 1){
-				test = dir === -1
-					// If going back one month, make sure month is not current month
-					// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
-					? function(){
-						return new_date.getUTCMonth() === month;
-					}
-					// If going forward one month, make sure month is as expected
-					// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
-					: function(){
-						return new_date.getUTCMonth() !== new_month;
-					};
-				new_month = month + dir;
-				new_date.setUTCMonth(new_month);
-				// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
-				if (new_month < 0 || new_month > 11)
-					new_month = (new_month + 12) % 12;
-			}
-			else {
-				// For magnitudes >1, move one month at a time...
-				for (var i=0; i < mag; i++)
-					// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
-					new_date = this.moveMonth(new_date, dir);
-				// ...then reset the day, keeping it in the new month
-				new_month = new_date.getUTCMonth();
-				new_date.setUTCDate(day);
-				test = function(){
-					return new_month !== new_date.getUTCMonth();
-				};
-			}
-			// Common date-resetting loop -- if date is beyond end of month, make it
-			// end of month
-			while (test()){
-				new_date.setUTCDate(--day);
-				new_date.setUTCMonth(new_month);
-			}
-			return new_date;
-		},
-
-		moveYear: function(date, dir){
-			return this.moveMonth(date, dir*12);
-		},
-
-		dateWithinRange: function(date){
-			return date >= this.o.startDate && date <= this.o.endDate;
-		},
-
-		keydown: function(e){
-			if (this.picker.is(':not(:visible)')){
-				if (e.keyCode === 27) // allow escape to hide and re-show picker
-					this.show();
-				return;
-			}
-			var dateChanged = false,
-				dir, newDate, newViewDate,
-				focusDate = this.focusDate || this.viewDate;
-			switch (e.keyCode){
-				case 27: // escape
-					if (this.focusDate){
-						this.focusDate = null;
-						this.viewDate = this.dates.get(-1) || this.viewDate;
-						this.fill();
-					}
-					else
-						this.hide();
-					e.preventDefault();
-					break;
-				case 37: // left
-				case 39: // right
-					if (!this.o.keyboardNavigation)
-						break;
-					dir = e.keyCode === 37 ? -1 : 1;
-					if (e.ctrlKey){
-						newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
-						newViewDate = this.moveYear(focusDate, dir);
-						this._trigger('changeYear', this.viewDate);
-					}
-					else if (e.shiftKey){
-						newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
-						newViewDate = this.moveMonth(focusDate, dir);
-						this._trigger('changeMonth', this.viewDate);
-					}
-					else {
-						newDate = new Date(this.dates.get(-1) || UTCToday());
-						newDate.setUTCDate(newDate.getUTCDate() + dir);
-						newViewDate = new Date(focusDate);
-						newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
-					}
-					if (this.dateWithinRange(newDate)){
-						this.focusDate = this.viewDate = newViewDate;
-						this.setValue();
-						this.fill();
-						e.preventDefault();
-					}
-					break;
-				case 38: // up
-				case 40: // down
-					if (!this.o.keyboardNavigation)
-						break;
-					dir = e.keyCode === 38 ? -1 : 1;
-					if (e.ctrlKey){
-						newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
-						newViewDate = this.moveYear(focusDate, dir);
-						this._trigger('changeYear', this.viewDate);
-					}
-					else if (e.shiftKey){
-						newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
-						newViewDate = this.moveMonth(focusDate, dir);
-						this._trigger('changeMonth', this.viewDate);
-					}
-					else {
-						newDate = new Date(this.dates.get(-1) || UTCToday());
-						newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
-						newViewDate = new Date(focusDate);
-						newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
-					}
-					if (this.dateWithinRange(newDate)){
-						this.focusDate = this.viewDate = newViewDate;
-						this.setValue();
-						this.fill();
-						e.preventDefault();
-					}
-					break;
-				case 32: // spacebar
-					// Spacebar is used in manually typing dates in some formats.
-					// As such, its behavior should not be hijacked.
-					break;
-				case 13: // enter
-					focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
-					this._toggle_multidate(focusDate);
-					dateChanged = true;
-					this.focusDate = null;
-					this.viewDate = this.dates.get(-1) || this.viewDate;
-					this.setValue();
-					this.fill();
-					if (this.picker.is(':visible')){
-						e.preventDefault();
-						if (this.o.autoclose)
-							this.hide();
-					}
-					break;
-				case 9: // tab
-					this.focusDate = null;
-					this.viewDate = this.dates.get(-1) || this.viewDate;
-					this.fill();
-					this.hide();
-					break;
-			}
-			if (dateChanged){
-				if (this.dates.length)
-					this._trigger('changeDate');
-				else
-					this._trigger('clearDate');
-				var element;
-				if (this.isInput){
-					element = this.element;
-				}
-				else if (this.component){
-					element = this.element.find('input');
-				}
-				if (element){
-					element.change();
-				}
-			}
-		},
-
-		showMode: function(dir){
-			if (dir){
-				this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
-			}
-			this.picker
-				.find('>div')
-				.hide()
-				.filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
-					.css('display', 'block');
-			this.updateNavArrows();
-		}
-	};
-
-	var DateRangePicker = function(element, options){
-		this.element = $(element);
-		this.inputs = $.map(options.inputs, function(i){
-			return i.jquery ? i[0] : i;
-		});
-		delete options.inputs;
-
-		$(this.inputs)
-			.datepicker(options)
-			.bind('changeDate', $.proxy(this.dateUpdated, this));
-
-		this.pickers = $.map(this.inputs, function(i){
-			return $(i).data('datepicker');
-		});
-		this.updateDates();
-	};
-	DateRangePicker.prototype = {
-		updateDates: function(){
-			this.dates = $.map(this.pickers, function(i){
-				return i.getUTCDate();
-			});
-			this.updateRanges();
-		},
-		updateRanges: function(){
-			var range = $.map(this.dates, function(d){
-				return d.valueOf();
-			});
-			$.each(this.pickers, function(i, p){
-				p.setRange(range);
-			});
-		},
-		dateUpdated: function(e){
-			// `this.updating` is a workaround for preventing infinite recursion
-			// between `changeDate` triggering and `setUTCDate` calling.  Until
-			// there is a better mechanism.
-			if (this.updating)
-				return;
-			this.updating = true;
-
-			var dp = $(e.target).data('datepicker'),
-				new_date = dp.getUTCDate(),
-				i = $.inArray(e.target, this.inputs),
-				l = this.inputs.length;
-			if (i === -1)
-				return;
-
-			$.each(this.pickers, function(i, p){
-				if (!p.getUTCDate())
-					p.setUTCDate(new_date);
-			});
-
-			if (new_date < this.dates[i]){
-				// Date being moved earlier/left
-				while (i >= 0 && new_date < this.dates[i]){
-					this.pickers[i--].setUTCDate(new_date);
-				}
-			}
-			else if (new_date > this.dates[i]){
-				// Date being moved later/right
-				while (i < l && new_date > this.dates[i]){
-					this.pickers[i++].setUTCDate(new_date);
-				}
-			}
-			this.updateDates();
-
-			delete this.updating;
-		},
-		remove: function(){
-			$.map(this.pickers, function(p){ p.remove(); });
-			delete this.element.data().datepicker;
-		}
-	};
-
-	function opts_from_el(el, prefix){
-		// Derive options from element data-attrs
-		var data = $(el).data(),
-			out = {}, inkey,
-			replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
-		prefix = new RegExp('^' + prefix.toLowerCase());
-		function re_lower(_,a){
-			return a.toLowerCase();
-		}
-		for (var key in data)
-			if (prefix.test(key)){
-				inkey = key.replace(replace, re_lower);
-				out[inkey] = data[key];
-			}
-		return out;
-	}
-
-	function opts_from_locale(lang){
-		// Derive options from locale plugins
-		var out = {};
-		// Check if "de-DE" style date is available, if not language should
-		// fallback to 2 letter code eg "de"
-		if (!dates[lang]){
-			lang = lang.split('-')[0];
-			if (!dates[lang])
-				return;
-		}
-		var d = dates[lang];
-		$.each(locale_opts, function(i,k){
-			if (k in d)
-				out[k] = d[k];
-		});
-		return out;
-	}
-
-	var old = $.fn.datepicker;
-	$.fn.datepicker = function(option){
-		var args = Array.apply(null, arguments);
-		args.shift();
-		var internal_return;
-		this.each(function(){
-			var $this = $(this),
-				data = $this.data('datepicker'),
-				options = typeof option === 'object' && option;
-			if (!data){
-				var elopts = opts_from_el(this, 'date'),
-					// Preliminary otions
-					xopts = $.extend({}, defaults, elopts, options),
-					locopts = opts_from_locale(xopts.language),
-					// Options priority: js args, data-attrs, locales, defaults
-					opts = $.extend({}, defaults, locopts, elopts, options);
-				if ($this.is('.input-daterange') || opts.inputs){
-					var ropts = {
-						inputs: opts.inputs || $this.find('input').toArray()
-					};
-					$this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
-				}
-				else {
-					$this.data('datepicker', (data = new Datepicker(this, opts)));
-				}
-			}
-			if (typeof option === 'string' && typeof data[option] === 'function'){
-				internal_return = data[option].apply(data, args);
-				if (internal_return !== undefined)
-					return false;
-			}
-		});
-		if (internal_return !== undefined)
-			return internal_return;
-		else
-			return this;
-	};
-
-	var defaults = $.fn.datepicker.defaults = {
-		autoclose: false,
-		beforeShowDay: $.noop,
-		calendarWeeks: false,
-		clearBtn: false,
-		daysOfWeekDisabled: [],
-		endDate: Infinity,
-		forceParse: true,
-		format: 'mm/dd/yyyy',
-		keyboardNavigation: true,
-		language: 'en',
-		minViewMode: 0,
-		multidate: false,
-		multidateSeparator: ',',
-		orientation: "auto",
-		rtl: false,
-		startDate: -Infinity,
-		startView: 0,
-		todayBtn: false,
-		todayHighlight: false,
-		weekStart: 0
-	};
-	var locale_opts = $.fn.datepicker.locale_opts = [
-		'format',
-		'rtl',
-		'weekStart'
-	];
-	$.fn.datepicker.Constructor = Datepicker;
-	var dates = $.fn.datepicker.dates = {
-		en: {
-			days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
-			daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
-			daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
-			months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
-			monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
-			today: "Today",
-			clear: "Clear"
-		}
-	};
-
-	var DPGlobal = {
-		modes: [
-			{
-				clsName: 'days',
-				navFnc: 'Month',
-				navStep: 1
-			},
-			{
-				clsName: 'months',
-				navFnc: 'FullYear',
-				navStep: 1
-			},
-			{
-				clsName: 'years',
-				navFnc: 'FullYear',
-				navStep: 10
-		}],
-		isLeapYear: function(year){
-			return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
-		},
-		getDaysInMonth: function(year, month){
-			return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
-		},
-		validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
-		nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
-		parseFormat: function(format){
-			// IE treats \0 as a string end in inputs (truncating the value),
-			// so it's a bad format delimiter, anyway
-			var separators = format.replace(this.validParts, '\0').split('\0'),
-				parts = format.match(this.validParts);
-			if (!separators || !separators.length || !parts || parts.length === 0){
-				throw new Error("Invalid date format.");
-			}
-			return {separators: separators, parts: parts};
-		},
-		parseDate: function(date, format, language){
-			if (!date)
-				return undefined;
-			if (date instanceof Date)
-				return date;
-			if (typeof format === 'string')
-				format = DPGlobal.parseFormat(format);
-			var part_re = /([\-+]\d+)([dmwy])/,
-				parts = date.match(/([\-+]\d+)([dmwy])/g),
-				part, dir, i;
-			if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
-				date = new Date();
-				for (i=0; i < parts.length; i++){
-					part = part_re.exec(parts[i]);
-					dir = parseInt(part[1]);
-					switch (part[2]){
-						case 'd':
-							date.setUTCDate(date.getUTCDate() + dir);
-							break;
-						case 'm':
-							date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
-							break;
-						case 'w':
-							date.setUTCDate(date.getUTCDate() + dir * 7);
-							break;
-						case 'y':
-							date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
-							break;
-					}
-				}
-				return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
-			}
-			parts = date && date.match(this.nonpunctuation) || [];
-			date = new Date();
-			var parsed = {},
-				setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
-				setters_map = {
-					yyyy: function(d,v){
-						return d.setUTCFullYear(v);
-					},
-					yy: function(d,v){
-						return d.setUTCFullYear(2000+v);
-					},
-					m: function(d,v){
-						if (isNaN(d))
-							return d;
-						v -= 1;
-						while (v < 0) v += 12;
-						v %= 12;
-						d.setUTCMonth(v);
-						while (d.getUTCMonth() !== v)
-							d.setUTCDate(d.getUTCDate()-1);
-						return d;
-					},
-					d: function(d,v){
-						return d.setUTCDate(v);
-					}
-				},
-				val, filtered;
-			setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
-			setters_map['dd'] = setters_map['d'];
-			date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
-			var fparts = format.parts.slice();
-			// Remove noop parts
-			if (parts.length !== fparts.length){
-				fparts = $(fparts).filter(function(i,p){
-					return $.inArray(p, setters_order) !== -1;
-				}).toArray();
-			}
-			// Process remainder
-			function match_part(){
-				var m = this.slice(0, parts[i].length),
-					p = parts[i].slice(0, m.length);
-				return m === p;
-			}
-			if (parts.length === fparts.length){
-				var cnt;
-				for (i=0, cnt = fparts.length; i < cnt; i++){
-					val = parseInt(parts[i], 10);
-					part = fparts[i];
-					if (isNaN(val)){
-						switch (part){
-							case 'MM':
-								filtered = $(dates[language].months).filter(match_part);
-								val = $.inArray(filtered[0], dates[language].months) + 1;
-								break;
-							case 'M':
-								filtered = $(dates[language].monthsShort).filter(match_part);
-								val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
-								break;
-						}
-					}
-					parsed[part] = val;
-				}
-				var _date, s;
-				for (i=0; i < setters_order.length; i++){
-					s = setters_order[i];
-					if (s in parsed && !isNaN(parsed[s])){
-						_date = new Date(date);
-						setters_map[s](_date, parsed[s]);
-						if (!isNaN(_date))
-							date = _date;
-					}
-				}
-			}
-			return date;
-		},
-		formatDate: function(date, format, language){
-			if (!date)
-				return '';
-			if (typeof format === 'string')
-				format = DPGlobal.parseFormat(format);
-			var val = {
-				d: date.getUTCDate(),
-				D: dates[language].daysShort[date.getUTCDay()],
-				DD: dates[language].days[date.getUTCDay()],
-				m: date.getUTCMonth() + 1,
-				M: dates[language].monthsShort[date.getUTCMonth()],
-				MM: dates[language].months[date.getUTCMonth()],
-				yy: date.getUTCFullYear().toString().substring(2),
-				yyyy: date.getUTCFullYear()
-			};
-			val.dd = (val.d < 10 ? '0' : '') + val.d;
-			val.mm = (val.m < 10 ? '0' : '') + val.m;
-			date = [];
-			var seps = $.extend([], format.separators);
-			for (var i=0, cnt = format.parts.length; i <= cnt; i++){
-				if (seps.length)
-					date.push(seps.shift());
-				date.push(val[format.parts[i]]);
-			}
-			return date.join('');
-		},
-		headTemplate: '<thead>'+
-							'<tr>'+
-								'<th class="prev">&laquo;</th>'+
-								'<th colspan="5" class="datepicker-switch"></th>'+
-								'<th class="next">&raquo;</th>'+
-							'</tr>'+
-						'</thead>',
-		contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
-		footTemplate: '<tfoot>'+
-							'<tr>'+
-								'<th colspan="7" class="today"></th>'+
-							'</tr>'+
-							'<tr>'+
-								'<th colspan="7" class="clear"></th>'+
-							'</tr>'+
-						'</tfoot>'
-	};
-	DPGlobal.template = '<div class="datepicker">'+
-							'<div class="datepicker-days">'+
-								'<table class=" table-condensed">'+
-									DPGlobal.headTemplate+
-									'<tbody></tbody>'+
-									DPGlobal.footTemplate+
-								'</table>'+
-							'</div>'+
-							'<div class="datepicker-months">'+
-								'<table class="table-condensed">'+
-									DPGlobal.headTemplate+
-									DPGlobal.contTemplate+
-									DPGlobal.footTemplate+
-								'</table>'+
-							'</div>'+
-							'<div class="datepicker-years">'+
-								'<table class="table-condensed">'+
-									DPGlobal.headTemplate+
-									DPGlobal.contTemplate+
-									DPGlobal.footTemplate+
-								'</table>'+
-							'</div>'+
-						'</div>';
-
-	$.fn.datepicker.DPGlobal = DPGlobal;
-
-
-	/* DATEPICKER NO CONFLICT
-	* =================== */
-
-	$.fn.datepicker.noConflict = function(){
-		$.fn.datepicker = old;
-		return this;
-	};
-
-
-	/* DATEPICKER DATA-API
-	* ================== */
-
-	$(document).on(
-		'focus.datepicker.data-api click.datepicker.data-api',
-		'[data-provide="datepicker"]',
-		function(e){
-			var $this = $(this);
-			if ($this.data('datepicker'))
-				return;
-			e.preventDefault();
-			// component click requires us to explicitly show it
-			$this.datepicker('show');
-		}
-	);
-	$(function(){
-		$('[data-provide="datepicker-inline"]').datepicker();
-	});
+    var $window = $(window);
+
+    function UTCDate(){
+        return new Date(Date.UTC.apply(Date, arguments));
+    }
+    function UTCToday(){
+        var today = new Date();
+        return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
+    }
+    function alias(method){
+        return function(){
+            return this[method].apply(this, arguments);
+        };
+    }
+
+    var DateArray = (function(){
+        var extras = {
+            get: function(i){
+                return this.slice(i)[0];
+            },
+            contains: function(d){
+                // Array.indexOf is not cross-browser;
+                // $.inArray doesn't work with Dates
+                var val = d && d.valueOf();
+                for (var i=0, l=this.length; i < l; i++)
+                    if (this[i].valueOf() === val)
+                        return i;
+                return -1;
+            },
+            remove: function(i){
+                this.splice(i,1);
+            },
+            replace: function(new_array){
+                if (!new_array)
+                    return;
+                if (!$.isArray(new_array))
+                    new_array = [new_array];
+                this.clear();
+                this.push.apply(this, new_array);
+            },
+            clear: function(){
+                this.splice(0);
+            },
+            copy: function(){
+                var a = new DateArray();
+                a.replace(this);
+                return a;
+            }
+        };
+
+        return function(){
+            var a = [];
+            a.push.apply(a, arguments);
+            $.extend(a, extras);
+            return a;
+        };
+    })();
+
+
+    // Picker object
+
+    var Datepicker = function(element, options){
+        this.dates = new DateArray();
+        this.viewDate = UTCToday();
+        this.focusDate = null;
+
+        this._process_options(options);
+
+        this.element = $(element);
+        this.isInline = false;
+        this.isInput = this.element.is('input');
+        this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
+        this.hasInput = this.component && this.element.find('input').length;
+        if (this.component && this.component.length === 0)
+            this.component = false;
+
+        this.picker = $(DPGlobal.template);
+        this._buildEvents();
+        this._attachEvents();
+
+        if (this.isInline){
+            this.picker.addClass('datepicker-inline').appendTo(this.element);
+        }
+        else {
+            this.picker.addClass('datepicker-dropdown dropdown-menu');
+        }
+
+        if (this.o.rtl){
+            this.picker.addClass('datepicker-rtl');
+        }
+
+        this.viewMode = this.o.startView;
+
+        if (this.o.calendarWeeks)
+            this.picker.find('tfoot th.today')
+                        .attr('colspan', function(i, val){
+                            return parseInt(val) + 1;
+                        });
+
+        this._allow_update = false;
+
+        this.setStartDate(this._o.startDate);
+        this.setEndDate(this._o.endDate);
+        this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
+
+        this.fillDow();
+        this.fillMonths();
+
+        this._allow_update = true;
+
+        this.update();
+        this.showMode();
+
+        if (this.isInline){
+            this.show();
+        }
+    };
+
+    Datepicker.prototype = {
+        constructor: Datepicker,
+
+        _process_options: function(opts){
+            // Store raw options for reference
+            this._o = $.extend({}, this._o, opts);
+            // Processed options
+            var o = this.o = $.extend({}, this._o);
+
+            // Check if "de-DE" style date is available, if not language should
+            // fallback to 2 letter code eg "de"
+            var lang = o.language;
+            if (!dates[lang]){
+                lang = lang.split('-')[0];
+                if (!dates[lang])
+                    lang = defaults.language;
+            }
+            o.language = lang;
+
+            switch (o.startView){
+                case 2:
+                case 'decade':
+                    o.startView = 2;
+                    break;
+                case 1:
+                case 'year':
+                    o.startView = 1;
+                    break;
+                default:
+                    o.startView = 0;
+            }
+
+            switch (o.minViewMode){
+                case 1:
+                case 'months':
+                    o.minViewMode = 1;
+                    break;
+                case 2:
+                case 'years':
+                    o.minViewMode = 2;
+                    break;
+                default:
+                    o.minViewMode = 0;
+            }
+
+            o.startView = Math.max(o.startView, o.minViewMode);
+
+            // true, false, or Number > 0
+            if (o.multidate !== true){
+                o.multidate = Number(o.multidate) || false;
+                if (o.multidate !== false)
+                    o.multidate = Math.max(0, o.multidate);
+                else
+                    o.multidate = 1;
+            }
+            o.multidateSeparator = String(o.multidateSeparator);
+
+            o.weekStart %= 7;
+            o.weekEnd = ((o.weekStart + 6) % 7);
+
+            var format = DPGlobal.parseFormat(o.format);
+            if (o.startDate !== -Infinity){
+                if (!!o.startDate){
+                    if (o.startDate instanceof Date)
+                        o.startDate = this._local_to_utc(this._zero_time(o.startDate));
+                    else
+                        o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
+                }
+                else {
+                    o.startDate = -Infinity;
+                }
+            }
+            if (o.endDate !== Infinity){
+                if (!!o.endDate){
+                    if (o.endDate instanceof Date)
+                        o.endDate = this._local_to_utc(this._zero_time(o.endDate));
+                    else
+                        o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
+                }
+                else {
+                    o.endDate = Infinity;
+                }
+            }
+
+            o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
+            if (!$.isArray(o.daysOfWeekDisabled))
+                o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
+            o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
+                return parseInt(d, 10);
+            });
+
+            var plc = String(o.orientation).toLowerCase().split(/\s+/g),
+                _plc = o.orientation.toLowerCase();
+            plc = $.grep(plc, function(word){
+                return (/^auto|left|right|top|bottom$/).test(word);
+            });
+            o.orientation = {x: 'auto', y: 'auto'};
+            if (!_plc || _plc === 'auto')
+                ; // no action
+            else if (plc.length === 1){
+                switch (plc[0]){
+                    case 'top':
+                    case 'bottom':
+                        o.orientation.y = plc[0];
+                        break;
+                    case 'left':
+                    case 'right':
+                        o.orientation.x = plc[0];
+                        break;
+                }
+            }
+            else {
+                _plc = $.grep(plc, function(word){
+                    return (/^left|right$/).test(word);
+                });
+                o.orientation.x = _plc[0] || 'auto';
+
+                _plc = $.grep(plc, function(word){
+                    return (/^top|bottom$/).test(word);
+                });
+                o.orientation.y = _plc[0] || 'auto';
+            }
+        },
+        _events: [],
+        _secondaryEvents: [],
+        _applyEvents: function(evs){
+            for (var i=0, el, ch, ev; i < evs.length; i++){
+                el = evs[i][0];
+                if (evs[i].length === 2){
+                    ch = undefined;
+                    ev = evs[i][1];
+                }
+                else if (evs[i].length === 3){
+                    ch = evs[i][1];
+                    ev = evs[i][2];
+                }
+                el.on(ev, ch);
+            }
+        },
+        _unapplyEvents: function(evs){
+            for (var i=0, el, ev, ch; i < evs.length; i++){
+                el = evs[i][0];
+                if (evs[i].length === 2){
+                    ch = undefined;
+                    ev = evs[i][1];
+                }
+                else if (evs[i].length === 3){
+                    ch = evs[i][1];
+                    ev = evs[i][2];
+                }
+                el.off(ev, ch);
+            }
+        },
+        _buildEvents: function(){
+            if (this.isInput){ // single input
+                this._events = [
+                    [this.element, {
+                        focus: $.proxy(this.show, this),
+                        keyup: $.proxy(function(e){
+                            if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
+                                this.update();
+                        }, this),
+                        keydown: $.proxy(this.keydown, this)
+                    }]
+                ];
+            }
+            else if (this.component && this.hasInput){ // component: input + button
+                this._events = [
+                    // For components that are not readonly, allow keyboard nav
+                    [this.element.find('input'), {
+                        // <framadate>
+                        //focus: $.proxy(this.show, this),
+                        // </framadate>
+                        keyup: $.proxy(function(e){
+                            if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
+                                this.update();
+                        }, this),
+                        keydown: $.proxy(this.keydown, this)
+                    }],
+                    [this.component, {
+                        click: $.proxy(this.show, this)
+                    }]
+                ];
+            }
+            else if (this.element.is('div')){  // inline datepicker
+                this.isInline = true;
+            }
+            else {
+                this._events = [
+                    [this.element, {
+                        click: $.proxy(this.show, this)
+                    }]
+                ];
+            }
+            this._events.push(
+                // Component: listen for blur on element descendants
+                [this.element, '*', {
+                    blur: $.proxy(function(e){
+                        this._focused_from = e.target;
+                    }, this)
+                }],
+                // Input: listen for blur on element
+                [this.element, {
+                    blur: $.proxy(function(e){
+                        this._focused_from = e.target;
+                    }, this)
+                }]
+            );
+
+            this._secondaryEvents = [
+                [this.picker, {
+                    click: $.proxy(this.click, this)
+                }],
+                [$(window), {
+                    resize: $.proxy(this.place, this)
+                }],
+                [$(document), {
+                    'mousedown touchstart': $.proxy(function(e){
+                        // Clicked outside the datepicker, hide it
+                        if (!(
+                            this.element.is(e.target) ||
+                            this.element.find(e.target).length ||
+                            this.picker.is(e.target) ||
+                            this.picker.find(e.target).length
+                        )){
+                            this.hide();
+                        }
+                    }, this)
+                }]
+            ];
+        },
+        _attachEvents: function(){
+            this._detachEvents();
+            this._applyEvents(this._events);
+        },
+        _detachEvents: function(){
+            this._unapplyEvents(this._events);
+        },
+        _attachSecondaryEvents: function(){
+            this._detachSecondaryEvents();
+            this._applyEvents(this._secondaryEvents);
+        },
+        _detachSecondaryEvents: function(){
+            this._unapplyEvents(this._secondaryEvents);
+        },
+        _trigger: function(event, altdate){
+            var date = altdate || this.dates.get(-1),
+                local_date = this._utc_to_local(date);
+
+            this.element.trigger({
+                type: event,
+                date: local_date,
+                dates: $.map(this.dates, this._utc_to_local),
+                format: $.proxy(function(ix, format){
+                    if (arguments.length === 0){
+                        ix = this.dates.length - 1;
+                        format = this.o.format;
+                    }
+                    else if (typeof ix === 'string'){
+                        format = ix;
+                        ix = this.dates.length - 1;
+                    }
+                    format = format || this.o.format;
+                    var date = this.dates.get(ix);
+                    return DPGlobal.formatDate(date, format, this.o.language);
+                }, this)
+            });
+        },
+
+        show: function(){
+            if (!this.isInline)
+                this.picker.appendTo('body');
+            this.picker.show();
+            this.place();
+            this._attachSecondaryEvents();
+            this._trigger('show');
+        },
+
+        hide: function(){
+            if (this.isInline)
+                return;
+            if (!this.picker.is(':visible'))
+                return;
+            this.focusDate = null;
+            this.picker.hide().detach();
+            this._detachSecondaryEvents();
+            this.viewMode = this.o.startView;
+            this.showMode();
+
+            if (
+                this.o.forceParse &&
+                (
+                    this.isInput && this.element.val() ||
+                    this.hasInput && this.element.find('input').val()
+                )
+            )
+                this.setValue();
+            this._trigger('hide');
+        },
+
+        remove: function(){
+            this.hide();
+            this._detachEvents();
+            this._detachSecondaryEvents();
+            this.picker.remove();
+            delete this.element.data().datepicker;
+            if (!this.isInput){
+                delete this.element.data().date;
+            }
+        },
+
+        _utc_to_local: function(utc){
+            return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
+        },
+        _local_to_utc: function(local){
+            return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
+        },
+        _zero_time: function(local){
+            return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
+        },
+        _zero_utc_time: function(utc){
+            return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
+        },
+
+        getDates: function(){
+            return $.map(this.dates, this._utc_to_local);
+        },
+
+        getUTCDates: function(){
+            return $.map(this.dates, function(d){
+                return new Date(d);
+            });
+        },
+
+        getDate: function(){
+            return this._utc_to_local(this.getUTCDate());
+        },
+
+        getUTCDate: function(){
+            return new Date(this.dates.get(-1));
+        },
+
+        setDates: function(){
+            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
+            this.update.apply(this, args);
+            this._trigger('changeDate');
+            this.setValue();
+        },
+
+        setUTCDates: function(){
+            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
+            this.update.apply(this, $.map(args, this._utc_to_local));
+            this._trigger('changeDate');
+            this.setValue();
+        },
+
+        setDate: alias('setDates'),
+        setUTCDate: alias('setUTCDates'),
+
+        setValue: function(){
+            var formatted = this.getFormattedDate();
+            if (!this.isInput){
+                if (this.component){
+                    this.element.find('input').val(formatted).change();
+                }
+            }
+            else {
+                this.element.val(formatted).change();
+            }
+        },
+
+        getFormattedDate: function(format){
+            if (format === undefined)
+                format = this.o.format;
+
+            var lang = this.o.language;
+            return $.map(this.dates, function(d){
+                return DPGlobal.formatDate(d, format, lang);
+            }).join(this.o.multidateSeparator);
+        },
+
+        setStartDate: function(startDate){
+            this._process_options({startDate: startDate});
+            this.update();
+            this.updateNavArrows();
+        },
+
+        setEndDate: function(endDate){
+            this._process_options({endDate: endDate});
+            this.update();
+            this.updateNavArrows();
+        },
+
+        setDaysOfWeekDisabled: function(daysOfWeekDisabled){
+            this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
+            this.update();
+            this.updateNavArrows();
+        },
+
+        place: function(){
+            if (this.isInline)
+                return;
+            var calendarWidth = this.picker.outerWidth(),
+                calendarHeight = this.picker.outerHeight(),
+                visualPadding = 10,
+                windowWidth = $window.width(),
+                windowHeight = $window.height(),
+                scrollTop = $window.scrollTop();
+
+            var zIndex = parseInt(this.element.parents().filter(function(){
+                    return $(this).css('z-index') !== 'auto';
+                }).first().css('z-index'))+10;
+            var offset = this.component ? this.component.parent().offset() : this.element.offset();
+            var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
+            var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
+            var left = offset.left,
+                top = offset.top;
+
+            this.picker.removeClass(
+                'datepicker-orient-top datepicker-orient-bottom '+
+                'datepicker-orient-right datepicker-orient-left'
+            );
+
+            if (this.o.orientation.x !== 'auto'){
+                this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
+                if (this.o.orientation.x === 'right')
+                    left -= calendarWidth - width;
+            }
+            // auto x orientation is best-placement: if it crosses a window
+            // edge, fudge it sideways
+            else {
+                // Default to left
+                this.picker.addClass('datepicker-orient-left');
+                if (offset.left < 0)
+                    left -= offset.left - visualPadding;
+                else if (offset.left + calendarWidth > windowWidth)
+                    left = windowWidth - calendarWidth - visualPadding;
+            }
+
+            // auto y orientation is best-situation: top or bottom, no fudging,
+            // decision based on which shows more of the calendar
+            var yorient = this.o.orientation.y,
+                top_overflow, bottom_overflow;
+            if (yorient === 'auto'){
+                top_overflow = -scrollTop + offset.top - calendarHeight;
+                bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
+                if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
+                    yorient = 'top';
+                else
+                    yorient = 'bottom';
+            }
+            this.picker.addClass('datepicker-orient-' + yorient);
+            if (yorient === 'top')
+                top += height;
+            else
+                top -= calendarHeight + parseInt(this.picker.css('padding-top'));
+
+            this.picker.css({
+                top: top,
+                left: left,
+                zIndex: zIndex
+            });
+        },
+
+        _allow_update: true,
+        update: function(){
+            if (!this._allow_update)
+                return;
+
+            var oldDates = this.dates.copy(),
+                dates = [],
+                fromArgs = false;
+            if (arguments.length){
+                $.each(arguments, $.proxy(function(i, date){
+                    if (date instanceof Date)
+                        date = this._local_to_utc(date);
+                    dates.push(date);
+                }, this));
+                fromArgs = true;
+            }
+            else {
+                dates = this.isInput
+                        ? this.element.val()
+                        : this.element.data('date') || this.element.find('input').val();
+                if (dates && this.o.multidate)
+                    dates = dates.split(this.o.multidateSeparator);
+                else
+                    dates = [dates];
+                delete this.element.data().date;
+            }
+
+            dates = $.map(dates, $.proxy(function(date){
+                return DPGlobal.parseDate(date, this.o.format, this.o.language);
+            }, this));
+            dates = $.grep(dates, $.proxy(function(date){
+                return (
+                    date < this.o.startDate ||
+                    date > this.o.endDate ||
+                    !date
+                );
+            }, this), true);
+            this.dates.replace(dates);
+
+            if (this.dates.length)
+                this.viewDate = new Date(this.dates.get(-1));
+            else if (this.viewDate < this.o.startDate)
+                this.viewDate = new Date(this.o.startDate);
+            else if (this.viewDate > this.o.endDate)
+                this.viewDate = new Date(this.o.endDate);
+
+            if (fromArgs){
+                // setting date by clicking
+                this.setValue();
+            }
+            else if (dates.length){
+                // setting date by typing
+                if (String(oldDates) !== String(this.dates))
+                    this._trigger('changeDate');
+            }
+            if (!this.dates.length && oldDates.length)
+                this._trigger('clearDate');
+
+            this.fill();
+        },
+
+        fillDow: function(){
+            var dowCnt = this.o.weekStart,
+                html = '<tr>';
+            if (this.o.calendarWeeks){
+                var cell = '<th class="cw">&nbsp;</th>';
+                html += cell;
+                this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
+            }
+            while (dowCnt < this.o.weekStart + 7){
+                html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
+            }
+            html += '</tr>';
+            this.picker.find('.datepicker-days thead').append(html);
+        },
+
+        fillMonths: function(){
+            var html = '',
+            i = 0;
+            while (i < 12){
+                html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
+            }
+            this.picker.find('.datepicker-months td').html(html);
+        },
+
+        setRange: function(range){
+            if (!range || !range.length)
+                delete this.range;
+            else
+                this.range = $.map(range, function(d){
+                    return d.valueOf();
+                });
+            this.fill();
+        },
+
+        getClassNames: function(date){
+            var cls = [],
+                year = this.viewDate.getUTCFullYear(),
+                month = this.viewDate.getUTCMonth(),
+                today = new Date();
+            if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
+                cls.push('old');
+            }
+            else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
+                cls.push('new');
+            }
+            if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
+                cls.push('focused');
+            // Compare internal UTC date with local today, not UTC today
+            if (this.o.todayHighlight &&
+                date.getUTCFullYear() === today.getFullYear() &&
+                date.getUTCMonth() === today.getMonth() &&
+                date.getUTCDate() === today.getDate()){
+                cls.push('today');
+            }
+            if (this.dates.contains(date) !== -1)
+                cls.push('active');
+            if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
+                $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
+                cls.push('disabled');
+            }
+            if (this.range){
+                if (date > this.range[0] && date < this.range[this.range.length-1]){
+                    cls.push('range');
+                }
+                if ($.inArray(date.valueOf(), this.range) !== -1){
+                    cls.push('selected');
+                }
+            }
+            return cls;
+        },
+
+        fill: function(){
+            var d = new Date(this.viewDate),
+                year = d.getUTCFullYear(),
+                month = d.getUTCMonth(),
+                startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
+                startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
+                endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
+                endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
+                todaytxt = dates[this.o.language].today || dates['en'].today || '',
+                cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
+                tooltip;
+            this.picker.find('.datepicker-days thead th.datepicker-switch')
+                        .text(dates[this.o.language].months[month]+' '+year);
+            this.picker.find('tfoot th.today')
+                        .text(todaytxt)
+                        .toggle(this.o.todayBtn !== false);
+            this.picker.find('tfoot th.clear')
+                        .text(cleartxt)
+                        .toggle(this.o.clearBtn !== false);
+            this.updateNavArrows();
+            this.fillMonths();
+            var prevMonth = UTCDate(year, month-1, 28),
+                day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
+            prevMonth.setUTCDate(day);
+            prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
+            var nextMonth = new Date(prevMonth);
+            nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
+            nextMonth = nextMonth.valueOf();
+            var html = [];
+            var clsName;
+            while (prevMonth.valueOf() < nextMonth){
+                if (prevMonth.getUTCDay() === this.o.weekStart){
+                    html.push('<tr>');
+                    if (this.o.calendarWeeks){
+                        // ISO 8601: First week contains first thursday.
+                        // ISO also states week starts on Monday, but we can be more abstract here.
+                        var
+                            // Start of current week: based on weekstart/current date
+                            ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
+                            // Thursday of this week
+                            th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
+                            // First Thursday of year, year from thursday
+                            yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
+                            // Calendar week: ms between thursdays, div ms per day, div 7 days
+                            calWeek =  (th - yth) / 864e5 / 7 + 1;
+                        html.push('<td class="cw">'+ calWeek +'</td>');
+
+                    }
+                }
+                clsName = this.getClassNames(prevMonth);
+                clsName.push('day');
+
+                if (this.o.beforeShowDay !== $.noop){
+                    var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
+                    if (before === undefined)
+                        before = {};
+                    else if (typeof(before) === 'boolean')
+                        before = {enabled: before};
+                    else if (typeof(before) === 'string')
+                        before = {classes: before};
+                    if (before.enabled === false)
+                        clsName.push('disabled');
+                    if (before.classes)
+                        clsName = clsName.concat(before.classes.split(/\s+/));
+                    if (before.tooltip)
+                        tooltip = before.tooltip;
+                }
+
+                clsName = $.unique(clsName);
+                html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
+                if (prevMonth.getUTCDay() === this.o.weekEnd){
+                    html.push('</tr>');
+                }
+                prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
+            }
+            this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
+
+            var months = this.picker.find('.datepicker-months')
+                        .find('th:eq(1)')
+                            .text(year)
+                            .end()
+                        .find('span').removeClass('active');
+
+            $.each(this.dates, function(i, d){
+                if (d.getUTCFullYear() === year)
+                    months.eq(d.getUTCMonth()).addClass('active');
+            });
+
+            if (year < startYear || year > endYear){
+                months.addClass('disabled');
+            }
+            if (year === startYear){
+                months.slice(0, startMonth).addClass('disabled');
+            }
+            if (year === endYear){
+                months.slice(endMonth+1).addClass('disabled');
+            }
+
+            html = '';
+            year = parseInt(year/10, 10) * 10;
+            var yearCont = this.picker.find('.datepicker-years')
+                                .find('th:eq(1)')
+                                    .text(year + '-' + (year + 9))
+                                    .end()
+                                .find('td');
+            year -= 1;
+            var years = $.map(this.dates, function(d){
+                    return d.getUTCFullYear();
+                }),
+                classes;
+            for (var i = -1; i < 11; i++){
+                classes = ['year'];
+                if (i === -1)
+                    classes.push('old');
+                else if (i === 10)
+                    classes.push('new');
+                if ($.inArray(year, years) !== -1)
+                    classes.push('active');
+                if (year < startYear || year > endYear)
+                    classes.push('disabled');
+                html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
+                year += 1;
+            }
+            yearCont.html(html);
+        },
+
+        updateNavArrows: function(){
+            if (!this._allow_update)
+                return;
+
+            var d = new Date(this.viewDate),
+                year = d.getUTCFullYear(),
+                month = d.getUTCMonth();
+            switch (this.viewMode){
+                case 0:
+                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
+                        this.picker.find('.prev').css({visibility: 'hidden'});
+                    }
+                    else {
+                        this.picker.find('.prev').css({visibility: 'visible'});
+                    }
+                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
+                        this.picker.find('.next').css({visibility: 'hidden'});
+                    }
+                    else {
+                        this.picker.find('.next').css({visibility: 'visible'});
+                    }
+                    break;
+                case 1:
+                case 2:
+                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
+                        this.picker.find('.prev').css({visibility: 'hidden'});
+                    }
+                    else {
+                        this.picker.find('.prev').css({visibility: 'visible'});
+                    }
+                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
+                        this.picker.find('.next').css({visibility: 'hidden'});
+                    }
+                    else {
+                        this.picker.find('.next').css({visibility: 'visible'});
+                    }
+                    break;
+            }
+        },
+
+        click: function(e){
+            e.preventDefault();
+            var target = $(e.target).closest('span, td, th'),
+                year, month, day;
+            if (target.length === 1){
+                switch (target[0].nodeName.toLowerCase()){
+                    case 'th':
+                        switch (target[0].className){
+                            case 'datepicker-switch':
+                                this.showMode(1);
+                                break;
+                            case 'prev':
+                            case 'next':
+                                var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
+                                switch (this.viewMode){
+                                    case 0:
+                                        this.viewDate = this.moveMonth(this.viewDate, dir);
+                                        this._trigger('changeMonth', this.viewDate);
+                                        break;
+                                    case 1:
+                                    case 2:
+                                        this.viewDate = this.moveYear(this.viewDate, dir);
+                                        if (this.viewMode === 1)
+                                            this._trigger('changeYear', this.viewDate);
+                                        break;
+                                }
+                                this.fill();
+                                break;
+                            case 'today':
+                                var date = new Date();
+                                date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+
+                                this.showMode(-2);
+                                var which = this.o.todayBtn === 'linked' ? null : 'view';
+                                this._setDate(date, which);
+                                break;
+                            case 'clear':
+                                var element;
+                                if (this.isInput)
+                                    element = this.element;
+                                else if (this.component)
+                                    element = this.element.find('input');
+                                if (element)
+                                    element.val("").change();
+                                this.update();
+                                this._trigger('changeDate');
+                                if (this.o.autoclose)
+                                    this.hide();
+                                break;
+                        }
+                        break;
+                    case 'span':
+                        if (!target.is('.disabled')){
+                            this.viewDate.setUTCDate(1);
+                            if (target.is('.month')){
+                                day = 1;
+                                month = target.parent().find('span').index(target);
+                                year = this.viewDate.getUTCFullYear();
+                                this.viewDate.setUTCMonth(month);
+                                this._trigger('changeMonth', this.viewDate);
+                                if (this.o.minViewMode === 1){
+                                    this._setDate(UTCDate(year, month, day));
+                                }
+                            }
+                            else {
+                                day = 1;
+                                month = 0;
+                                year = parseInt(target.text(), 10)||0;
+                                this.viewDate.setUTCFullYear(year);
+                                this._trigger('changeYear', this.viewDate);
+                                if (this.o.minViewMode === 2){
+                                    this._setDate(UTCDate(year, month, day));
+                                }
+                            }
+                            this.showMode(-1);
+                            this.fill();
+                        }
+                        break;
+                    case 'td':
+                        if (target.is('.day') && !target.is('.disabled')){
+                            day = parseInt(target.text(), 10)||1;
+                            year = this.viewDate.getUTCFullYear();
+                            month = this.viewDate.getUTCMonth();
+                            if (target.is('.old')){
+                                if (month === 0){
+                                    month = 11;
+                                    year -= 1;
+                                }
+                                else {
+                                    month -= 1;
+                                }
+                            }
+                            else if (target.is('.new')){
+                                if (month === 11){
+                                    month = 0;
+                                    year += 1;
+                                }
+                                else {
+                                    month += 1;
+                                }
+                            }
+                            this._setDate(UTCDate(year, month, day));
+                        }
+                        break;
+                }
+            }
+            if (this.picker.is(':visible') && this._focused_from){
+                $(this._focused_from).focus();
+            }
+            delete this._focused_from;
+        },
+
+        _toggle_multidate: function(date){
+            var ix = this.dates.contains(date);
+            if (!date){
+                this.dates.clear();
+            }
+            else if (ix !== -1){
+                this.dates.remove(ix);
+            }
+            else {
+                this.dates.push(date);
+            }
+            if (typeof this.o.multidate === 'number')
+                while (this.dates.length > this.o.multidate)
+                    this.dates.remove(0);
+        },
+
+        _setDate: function(date, which){
+            if (!which || which === 'date')
+                this._toggle_multidate(date && new Date(date));
+            if (!which || which  === 'view')
+                this.viewDate = date && new Date(date);
+
+            this.fill();
+            this.setValue();
+            this._trigger('changeDate');
+            var element;
+            if (this.isInput){
+                element = this.element;
+            }
+            else if (this.component){
+                element = this.element.find('input');
+            }
+            if (element){
+                element.change();
+            }
+            if (this.o.autoclose && (!which || which === 'date')){
+                this.hide();
+            }
+        },
+
+        moveMonth: function(date, dir){
+            if (!date)
+                return undefined;
+            if (!dir)
+                return date;
+            var new_date = new Date(date.valueOf()),
+                day = new_date.getUTCDate(),
+                month = new_date.getUTCMonth(),
+                mag = Math.abs(dir),
+                new_month, test;
+            dir = dir > 0 ? 1 : -1;
+            if (mag === 1){
+                test = dir === -1
+                    // If going back one month, make sure month is not current month
+                    // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
+                    ? function(){
+                        return new_date.getUTCMonth() === month;
+                    }
+                    // If going forward one month, make sure month is as expected
+                    // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
+                    : function(){
+                        return new_date.getUTCMonth() !== new_month;
+                    };
+                new_month = month + dir;
+                new_date.setUTCMonth(new_month);
+                // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
+                if (new_month < 0 || new_month > 11)
+                    new_month = (new_month + 12) % 12;
+            }
+            else {
+                // For magnitudes >1, move one month at a time...
+                for (var i=0; i < mag; i++)
+                    // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
+                    new_date = this.moveMonth(new_date, dir);
+                // ...then reset the day, keeping it in the new month
+                new_month = new_date.getUTCMonth();
+                new_date.setUTCDate(day);
+                test = function(){
+                    return new_month !== new_date.getUTCMonth();
+                };
+            }
+            // Common date-resetting loop -- if date is beyond end of month, make it
+            // end of month
+            while (test()){
+                new_date.setUTCDate(--day);
+                new_date.setUTCMonth(new_month);
+            }
+            return new_date;
+        },
+
+        moveYear: function(date, dir){
+            return this.moveMonth(date, dir*12);
+        },
+
+        dateWithinRange: function(date){
+            return date >= this.o.startDate && date <= this.o.endDate;
+        },
+
+        keydown: function(e){
+            if (this.picker.is(':not(:visible)')){
+                if (e.keyCode === 27) // allow escape to hide and re-show picker
+                    this.show();
+                return;
+            }
+            var dateChanged = false,
+                dir, newDate, newViewDate,
+                focusDate = this.focusDate || this.viewDate;
+            switch (e.keyCode){
+                case 27: // escape
+                    if (this.focusDate){
+                        this.focusDate = null;
+                        this.viewDate = this.dates.get(-1) || this.viewDate;
+                        this.fill();
+                    }
+                    else
+                        this.hide();
+                    e.preventDefault();
+                    break;
+                case 37: // left
+                case 39: // right
+                    if (!this.o.keyboardNavigation)
+                        break;
+                    dir = e.keyCode === 37 ? -1 : 1;
+                    if (e.ctrlKey){
+                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
+                        newViewDate = this.moveYear(focusDate, dir);
+                        this._trigger('changeYear', this.viewDate);
+                    }
+                    else if (e.shiftKey){
+                        newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
+                        newViewDate = this.moveMonth(focusDate, dir);
+                        this._trigger('changeMonth', this.viewDate);
+                    }
+                    else {
+                        newDate = new Date(this.dates.get(-1) || UTCToday());
+                        newDate.setUTCDate(newDate.getUTCDate() + dir);
+                        newViewDate = new Date(focusDate);
+                        newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
+                    }
+                    if (this.dateWithinRange(newDate)){
+                        this.focusDate = this.viewDate = newViewDate;
+                        this.setValue();
+                        this.fill();
+                        e.preventDefault();
+                    }
+                    break;
+                case 38: // up
+                case 40: // down
+                    if (!this.o.keyboardNavigation)
+                        break;
+                    dir = e.keyCode === 38 ? -1 : 1;
+                    if (e.ctrlKey){
+                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
+                        newViewDate = this.moveYear(focusDate, dir);
+                        this._trigger('changeYear', this.viewDate);
+                    }
+                    else if (e.shiftKey){
+                        newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
+                        newViewDate = this.moveMonth(focusDate, dir);
+                        this._trigger('changeMonth', this.viewDate);
+                    }
+                    else {
+                        newDate = new Date(this.dates.get(-1) || UTCToday());
+                        newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
+                        newViewDate = new Date(focusDate);
+                        newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
+                    }
+                    if (this.dateWithinRange(newDate)){
+                        this.focusDate = this.viewDate = newViewDate;
+                        this.setValue();
+                        this.fill();
+                        e.preventDefault();
+                    }
+                    break;
+                case 32: // spacebar
+                    // Spacebar is used in manually typing dates in some formats.
+                    // As such, its behavior should not be hijacked.
+                    break;
+                case 13: // enter
+                    focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
+                    this._toggle_multidate(focusDate);
+                    dateChanged = true;
+                    this.focusDate = null;
+                    this.viewDate = this.dates.get(-1) || this.viewDate;
+                    this.setValue();
+                    this.fill();
+                    if (this.picker.is(':visible')){
+                        e.preventDefault();
+                        if (this.o.autoclose)
+                            this.hide();
+                    }
+                    break;
+                case 9: // tab
+                    this.focusDate = null;
+                    this.viewDate = this.dates.get(-1) || this.viewDate;
+                    this.fill();
+                    this.hide();
+                    break;
+            }
+            if (dateChanged){
+                if (this.dates.length)
+                    this._trigger('changeDate');
+                else
+                    this._trigger('clearDate');
+                var element;
+                if (this.isInput){
+                    element = this.element;
+                }
+                else if (this.component){
+                    element = this.element.find('input');
+                }
+                if (element){
+                    element.change();
+                }
+            }
+        },
+
+        showMode: function(dir){
+            if (dir){
+                this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
+            }
+            this.picker
+                .find('>div')
+                .hide()
+                .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
+                    .css('display', 'block');
+            this.updateNavArrows();
+        }
+    };
+
+    var DateRangePicker = function(element, options){
+        this.element = $(element);
+        this.inputs = $.map(options.inputs, function(i){
+            return i.jquery ? i[0] : i;
+        });
+        delete options.inputs;
+
+        $(this.inputs)
+            .datepicker(options)
+            .bind('changeDate', $.proxy(this.dateUpdated, this));
+
+        this.pickers = $.map(this.inputs, function(i){
+            return $(i).data('datepicker');
+        });
+        this.updateDates();
+    };
+    DateRangePicker.prototype = {
+        updateDates: function(){
+            this.dates = $.map(this.pickers, function(i){
+                return i.getUTCDate();
+            });
+            this.updateRanges();
+        },
+        updateRanges: function(){
+            var range = $.map(this.dates, function(d){
+                return d.valueOf();
+            });
+            $.each(this.pickers, function(i, p){
+                p.setRange(range);
+            });
+        },
+        dateUpdated: function(e){
+            // `this.updating` is a workaround for preventing infinite recursion
+            // between `changeDate` triggering and `setUTCDate` calling.  Until
+            // there is a better mechanism.
+            if (this.updating)
+                return;
+            this.updating = true;
+
+            var dp = $(e.target).data('datepicker'),
+                new_date = dp.getUTCDate(),
+                i = $.inArray(e.target, this.inputs),
+                l = this.inputs.length;
+            if (i === -1)
+                return;
+
+            $.each(this.pickers, function(i, p){
+                if (!p.getUTCDate())
+                    p.setUTCDate(new_date);
+            });
+
+            if (new_date < this.dates[i]){
+                // Date being moved earlier/left
+                while (i >= 0 && new_date < this.dates[i]){
+                    this.pickers[i--].setUTCDate(new_date);
+                }
+            }
+            else if (new_date > this.dates[i]){
+                // Date being moved later/right
+                while (i < l && new_date > this.dates[i]){
+                    this.pickers[i++].setUTCDate(new_date);
+                }
+            }
+            this.updateDates();
+
+            delete this.updating;
+        },
+        remove: function(){
+            $.map(this.pickers, function(p){ p.remove(); });
+            delete this.element.data().datepicker;
+        }
+    };
+
+    function opts_from_el(el, prefix){
+        // Derive options from element data-attrs
+        var data = $(el).data(),
+            out = {}, inkey,
+            replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
+        prefix = new RegExp('^' + prefix.toLowerCase());
+        function re_lower(_,a){
+            return a.toLowerCase();
+        }
+        for (var key in data)
+            if (prefix.test(key)){
+                inkey = key.replace(replace, re_lower);
+                out[inkey] = data[key];
+            }
+        return out;
+    }
+
+    function opts_from_locale(lang){
+        // Derive options from locale plugins
+        var out = {};
+        // Check if "de-DE" style date is available, if not language should
+        // fallback to 2 letter code eg "de"
+        if (!dates[lang]){
+            lang = lang.split('-')[0];
+            if (!dates[lang])
+                return;
+        }
+        var d = dates[lang];
+        $.each(locale_opts, function(i,k){
+            if (k in d)
+                out[k] = d[k];
+        });
+        return out;
+    }
+
+    var old = $.fn.datepicker;
+    $.fn.datepicker = function(option){
+        var args = Array.apply(null, arguments);
+        args.shift();
+        var internal_return;
+        this.each(function(){
+            var $this = $(this),
+                data = $this.data('datepicker'),
+                options = typeof option === 'object' && option;
+            if (!data){
+                var elopts = opts_from_el(this, 'date'),
+                    // Preliminary otions
+                    xopts = $.extend({}, defaults, elopts, options),
+                    locopts = opts_from_locale(xopts.language),
+                    // Options priority: js args, data-attrs, locales, defaults
+                    opts = $.extend({}, defaults, locopts, elopts, options);
+                if ($this.is('.input-daterange') || opts.inputs){
+                    var ropts = {
+                        inputs: opts.inputs || $this.find('input').toArray()
+                    };
+                    $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
+                }
+                else {
+                    $this.data('datepicker', (data = new Datepicker(this, opts)));
+                }
+            }
+            if (typeof option === 'string' && typeof data[option] === 'function'){
+                internal_return = data[option].apply(data, args);
+                if (internal_return !== undefined)
+                    return false;
+            }
+        });
+        if (internal_return !== undefined)
+            return internal_return;
+        else
+            return this;
+    };
+
+    var defaults = $.fn.datepicker.defaults = {
+        autoclose: false,
+        beforeShowDay: $.noop,
+        calendarWeeks: false,
+        clearBtn: false,
+        daysOfWeekDisabled: [],
+        endDate: Infinity,
+        forceParse: true,
+        format: 'mm/dd/yyyy',
+        keyboardNavigation: true,
+        language: 'en',
+        minViewMode: 0,
+        multidate: false,
+        multidateSeparator: ',',
+        orientation: "auto",
+        rtl: false,
+        startDate: -Infinity,
+        startView: 0,
+        todayBtn: false,
+        todayHighlight: false,
+        weekStart: 0
+    };
+    var locale_opts = $.fn.datepicker.locale_opts = [
+        'format',
+        'rtl',
+        'weekStart'
+    ];
+    $.fn.datepicker.Constructor = Datepicker;
+    var dates = $.fn.datepicker.dates = {
+        en: {
+            days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
+            daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
+            daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
+            months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
+            monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
+            today: "Today",
+            clear: "Clear"
+        }
+    };
+
+    var DPGlobal = {
+        modes: [
+            {
+                clsName: 'days',
+                navFnc: 'Month',
+                navStep: 1
+            },
+            {
+                clsName: 'months',
+                navFnc: 'FullYear',
+                navStep: 1
+            },
+            {
+                clsName: 'years',
+                navFnc: 'FullYear',
+                navStep: 10
+        }],
+        isLeapYear: function(year){
+            return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
+        },
+        getDaysInMonth: function(year, month){
+            return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
+        },
+        validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
+        nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
+        parseFormat: function(format){
+            // IE treats \0 as a string end in inputs (truncating the value),
+            // so it's a bad format delimiter, anyway
+            var separators = format.replace(this.validParts, '\0').split('\0'),
+                parts = format.match(this.validParts);
+            if (!separators || !separators.length || !parts || parts.length === 0){
+                throw new Error("Invalid date format.");
+            }
+            return {separators: separators, parts: parts};
+        },
+        parseDate: function(date, format, language){
+            if (!date)
+                return undefined;
+            if (date instanceof Date)
+                return date;
+            if (typeof format === 'string')
+                format = DPGlobal.parseFormat(format);
+            var part_re = /([\-+]\d+)([dmwy])/,
+                parts = date.match(/([\-+]\d+)([dmwy])/g),
+                part, dir, i;
+            if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
+                date = new Date();
+                for (i=0; i < parts.length; i++){
+                    part = part_re.exec(parts[i]);
+                    dir = parseInt(part[1]);
+                    switch (part[2]){
+                        case 'd':
+                            date.setUTCDate(date.getUTCDate() + dir);
+                            break;
+                        case 'm':
+                            date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
+                            break;
+                        case 'w':
+                            date.setUTCDate(date.getUTCDate() + dir * 7);
+                            break;
+                        case 'y':
+                            date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
+                            break;
+                    }
+                }
+                return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
+            }
+            parts = date && date.match(this.nonpunctuation) || [];
+            date = new Date();
+            var parsed = {},
+                setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
+                setters_map = {
+                    yyyy: function(d,v){
+                        return d.setUTCFullYear(v);
+                    },
+                    yy: function(d,v){
+                        return d.setUTCFullYear(2000+v);
+                    },
+                    m: function(d,v){
+                        if (isNaN(d))
+                            return d;
+                        v -= 1;
+                        while (v < 0) v += 12;
+                        v %= 12;
+                        d.setUTCMonth(v);
+                        while (d.getUTCMonth() !== v)
+                            d.setUTCDate(d.getUTCDate()-1);
+                        return d;
+                    },
+                    d: function(d,v){
+                        return d.setUTCDate(v);
+                    }
+                },
+                val, filtered;
+            setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
+            setters_map['dd'] = setters_map['d'];
+            date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
+            var fparts = format.parts.slice();
+            // Remove noop parts
+            if (parts.length !== fparts.length){
+                fparts = $(fparts).filter(function(i,p){
+                    return $.inArray(p, setters_order) !== -1;
+                }).toArray();
+            }
+            // Process remainder
+            function match_part(){
+                var m = this.slice(0, parts[i].length),
+                    p = parts[i].slice(0, m.length);
+                return m === p;
+            }
+            if (parts.length === fparts.length){
+                var cnt;
+                for (i=0, cnt = fparts.length; i < cnt; i++){
+                    val = parseInt(parts[i], 10);
+                    part = fparts[i];
+                    if (isNaN(val)){
+                        switch (part){
+                            case 'MM':
+                                filtered = $(dates[language].months).filter(match_part);
+                                val = $.inArray(filtered[0], dates[language].months) + 1;
+                                break;
+                            case 'M':
+                                filtered = $(dates[language].monthsShort).filter(match_part);
+                                val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
+                                break;
+                        }
+                    }
+                    parsed[part] = val;
+                }
+                var _date, s;
+                for (i=0; i < setters_order.length; i++){
+                    s = setters_order[i];
+                    if (s in parsed && !isNaN(parsed[s])){
+                        _date = new Date(date);
+                        setters_map[s](_date, parsed[s]);
+                        if (!isNaN(_date))
+                            date = _date;
+                    }
+                }
+            }
+            return date;
+        },
+        formatDate: function(date, format, language){
+            if (!date)
+                return '';
+            if (typeof format === 'string')
+                format = DPGlobal.parseFormat(format);
+            var val = {
+                d: date.getUTCDate(),
+                D: dates[language].daysShort[date.getUTCDay()],
+                DD: dates[language].days[date.getUTCDay()],
+                m: date.getUTCMonth() + 1,
+                M: dates[language].monthsShort[date.getUTCMonth()],
+                MM: dates[language].months[date.getUTCMonth()],
+                yy: date.getUTCFullYear().toString().substring(2),
+                yyyy: date.getUTCFullYear()
+            };
+            val.dd = (val.d < 10 ? '0' : '') + val.d;
+            val.mm = (val.m < 10 ? '0' : '') + val.m;
+            date = [];
+            var seps = $.extend([], format.separators);
+            for (var i=0, cnt = format.parts.length; i <= cnt; i++){
+                if (seps.length)
+                    date.push(seps.shift());
+                date.push(val[format.parts[i]]);
+            }
+            return date.join('');
+        },
+        headTemplate: '<thead>'+
+                            '<tr>'+
+                                '<th class="prev">&laquo;</th>'+
+                                '<th colspan="5" class="datepicker-switch"></th>'+
+                                '<th class="next">&raquo;</th>'+
+                            '</tr>'+
+                        '</thead>',
+        contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
+        footTemplate: '<tfoot>'+
+                            '<tr>'+
+                                '<th colspan="7" class="today"></th>'+
+                            '</tr>'+
+                            '<tr>'+
+                                '<th colspan="7" class="clear"></th>'+
+                            '</tr>'+
+                        '</tfoot>'
+    };
+    DPGlobal.template = '<div class="datepicker">'+
+                            '<div class="datepicker-days">'+
+                                '<table class=" table-condensed">'+
+                                    DPGlobal.headTemplate+
+                                    '<tbody></tbody>'+
+                                    DPGlobal.footTemplate+
+                                '</table>'+
+                            '</div>'+
+                            '<div class="datepicker-months">'+
+                                '<table class="table-condensed">'+
+                                    DPGlobal.headTemplate+
+                                    DPGlobal.contTemplate+
+                                    DPGlobal.footTemplate+
+                                '</table>'+
+                            '</div>'+
+                            '<div class="datepicker-years">'+
+                                '<table class="table-condensed">'+
+                                    DPGlobal.headTemplate+
+                                    DPGlobal.contTemplate+
+                                    DPGlobal.footTemplate+
+                                '</table>'+
+                            '</div>'+
+                        '</div>';
+
+    $.fn.datepicker.DPGlobal = DPGlobal;
+
+
+    /* DATEPICKER NO CONFLICT
+    * =================== */
+
+    $.fn.datepicker.noConflict = function(){
+        $.fn.datepicker = old;
+        return this;
+    };
+
+
+    /* DATEPICKER DATA-API
+    * ================== */
+
+    $(document).on(
+        'focus.datepicker.data-api click.datepicker.data-api',
+        '[data-provide="datepicker"]',
+        function(e){
+            var $this = $(this);
+            if ($this.data('datepicker'))
+                return;
+            e.preventDefault();
+            // component click requires us to explicitly show it
+            $this.datepicker('show');
+        }
+    );
+    $(function(){
+        $('[data-provide="datepicker-inline"]').datepicker();
+    });
 
 }(window.jQuery));
diff --git a/js/core.js b/js/core.js
index 4ba26e9e7beb6a6d78553b04859f041cf19869ec..0472981ba038a6abd9197515d85e5ae2c7596e9a 100644
--- a/js/core.js
+++ b/js/core.js
@@ -2,14 +2,56 @@ $(document).ready(function() {
     var lang = $('html').attr('lang');
 
     // Datepicker
-    $('.input-group.date').datepicker({
-        format: "dd/mm/yyyy",
-        todayBtn: "linked",
-        orientation: "top left",
-        autoclose: true,
-        language: lang
+    var framadatepicker = function() {
+        $('.input-group.date').datepicker({
+            format: "dd/mm/yyyy",
+            todayBtn: "linked",
+            orientation: "top left",
+            autoclose: true,
+            language: lang,
+            todayHighlight: true,
+            beforeShowDay: function (date){
+                var $selected_days = new Array();
+                $('#selected-days input[id^="day"]').each(function() {
+                    if($(this).val()!='') {
+                        $selected_days.push($(this).val());
+                    }
+                });
+                for(i = 0; i < $selected_days.length; i++){
+                    var $selected_date = $selected_days[i].split('/');
+
+                    if (date.getFullYear() == $selected_date[2] && (date.getMonth()+1) == $selected_date[1] && date.getDate() == $selected_date[0]){
+                        return {
+                            classes: 'disabled selected'
+                        };
+                    }
+                }
+            }
+        });
+    };
+
+
+    var datepickerfocus = false; // a11y : datepicker not display on focus until there is one click on the button
+
+    $(document).on('click','.input-group.date .input-group-addon', function() {
+        datepickerfocus = true;
+        // Re-init datepicker config before displaying
+        $(this).parent().datepicker(framadatepicker());
+        $(this).parent().datepicker('show');
+
+        // Trick to refresh calendar
+        $('.datepicker-days .prev').trigger('click');
+        $('.datepicker-days .next').trigger('click');
+        // .active must be clicable in order to unfill the form
+        $('.datepicker-days .active').removeClass('disabled');
     });
 
+    $(document).on('focus','.input-group.date input', function() {
+        if(datepickerfocus) {
+            $(this).parent('.input-group.date').datepicker(framadatepicker());
+            $(this).parent('.input-group.date').datepicker('show');
+        }
+    });
     /**
      *  choix_date.php
      **/
@@ -95,6 +137,7 @@ $(document).ready(function() {
                 $(this).addClass('disabled');
             }
         };
+        SubmitDaysAvalaible();
     });
 
     // Button "Add a day"
@@ -116,28 +159,17 @@ $(document).ready(function() {
         last_day.after('<fieldset>'+new_day_html+'</fieldset>');
         $('#day'+(nb_days)).focus();
         $('#remove-a-day, #copyhours').removeClass('disabled');
-
-        // Repeat datepicker init (junk code but it works for added days)
-        $('.input-group.date').datepicker({
-            format: "dd/mm/yyyy",
-            todayBtn: "linked",
-            orientation: "top left",
-            autoclose: true,
-            language: lang
-        });
-
     });
 
     // Button "Remove a day"
     $('#remove-a-day').on('click', function() {
-        var nb_days = $('#selected-days fieldset').length;
-
         $('#selected-days fieldset:last').remove();
+        var nb_days = $('#selected-days fieldset').length;
         $('#day'+(nb_days-1)).focus();
         if ( nb_days == 1) {
             $('#remove-a-day, #copyhours').addClass('disabled');
         };
-
+        SubmitDaysAvalaible();
     });
 
     // Title update on hours and buttons -/+ hours
@@ -180,8 +212,8 @@ $(document).ready(function() {
         }
     }
 
-    $(document).on('change','.hours, #selected-days fieldset legend input', function() {
-        SubmitDaysAvalaible()
+    $(document).on('keyup, change','.hours, #selected-days fieldset legend input', function() {
+        SubmitDaysAvalaible();
     });
     SubmitDaysAvalaible();
 
@@ -220,14 +252,13 @@ $(document).ready(function() {
 
     // Button "Remove a choice"
     $('#remove-a-choice').on('click', function() {
-        var nb_choices = $('.choice-field').length;
-
         $('.choice-field:last').remove();
-        $('#choice'+(nb_choices-2)).focus();
-        if (nb_choices == 3) {
-            $('#remove-a-choice, button[name="fin_sondage_autre"]').addClass('disabled');
+        var nb_choices = $('.choice-field').length;
+        $('#choice'+(nb_choices-1)).focus();
+        if (nb_choices == 2) {
+            $('#remove-a-choice').addClass('disabled');
         };
-
+        SubmitChoicesAvalaible();
     });
 
     // 2 choices filled and you can submit
@@ -245,11 +276,31 @@ $(document).ready(function() {
         }
     }
 
-    $(document).on('change','.choice-field input', function() {
-        SubmitChoicesAvalaible()
+    $(document).on('keyup, change','.choice-field input', function() {
+        SubmitChoicesAvalaible();
     });
     SubmitChoicesAvalaible();
 
+    $(document).on('click', '.md-a-img', function() {
+        $('#md-a-imgModal').modal('show');
+        $('#md-a-imgModal .btn-primary').attr('value',$(this).prev().attr('id'));
+    });
+    $('#md-a-imgModal .btn-primary').on('click', function() {
+        if($('#md-img').val()!='' && $('#md-a').val()!='') {
+            $('#'+$(this).val()).val('[!['+$('#md-text').val()+']('+$('#md-img').val()+')]('+$('#md-a').val()+')');
+        } else if ($('#md-img').val()!='') {
+            $('#'+$(this).val()).val('!['+$('#md-text').val()+']('+$('#md-img').val()+')');
+        } else if ($('#md-a').val()!='') {
+            $('#'+$(this).val()).val('['+$('#md-text').val()+']('+$('#md-a').val()+')');
+        } else {
+            $('#'+$(this).val()).val($('#md-text').val());
+        }
+        $('#md-a-imgModal').modal('hide');
+        $('#md-img').val(''); $('#md-a').val('');$('#md-text').val('');
+    });
+
+
+
     /**
      *  adminstuds.php
      **/
@@ -296,4 +347,67 @@ $(document).ready(function() {
         return false;
     });
 
+    $('#poll-rules-form .btn-edit').on('click', function() {
+        $('#poll-rules-form p').hide();
+        $('#poll-rules-form .js-poll-rules').removeClass("hidden");
+        $('.js-poll-rules select').focus();
+        return false;
+    });
+
+    $('#poll-rules-form .btn-cancel').on('click', function() {
+        $('#poll-rules-form p').show();
+        $('#poll-rules-form .js-poll-rules').addClass("hidden");
+        $('.js-poll-rules .btn-edit').focus();
+        return false;
+    });
+
+    // Horizontal scroll buttons
+    if($('.results').width() > $('.container').width()) {
+        $('.scroll-buttons').removeClass('hidden');
+    }
+
+    var $scroll_page = 1;
+    var $scroll_scale = $('#tableContainer').width()*2/3;
+
+    $('.scroll-left').addClass('disabled');
+
+    $('.scroll-left').click(function(){
+        $('.scroll-right').removeClass('disabled');
+        $( "#tableContainer" ).animate({
+            scrollLeft: $scroll_scale*($scroll_page-1)
+        }, 1000);
+        if($scroll_page == 1) {
+            $(this).addClass('disabled');
+        } else {
+            $scroll_page = $scroll_page-1;
+        }
+        return false;
+    });
+    $('.scroll-right').click(function(){
+        $('.scroll-left').removeClass('disabled');
+        $( "#tableContainer" ).animate({
+            scrollLeft: $scroll_scale*($scroll_page)
+        }, 1000);
+
+        if($scroll_scale*($scroll_page+1) > $( ".results" ).width()) {
+            $(this).addClass('disabled');
+        } else {
+            $scroll_page++;
+        }
+        return false;
+    });
+
+});
+
+// Vote form moving to the top or to the bottom
+$(window).scroll(function() {
+    var $table_offset = $('.results thead').offset();
+    if($table_offset != undefined && $(window).scrollTop() < $table_offset.top) {
+        $('.results tbody').prepend($('#vote-form'));
+        $('#tableContainer').before($('.scroll-buttons'));
+    } else {
+        $('#addition').before($('#vote-form'));
+        $('#tableContainer').after($('.scroll-buttons'));
+    }
+
 });
diff --git a/locale/fr_FR/LC_MESSAGES/Studs.mo b/locale/fr_FR/LC_MESSAGES/Studs.mo
index d18288035b93332ae163a6904a396d897fa1d409..24470428c56647ac18659ee62cd002b9d008d641 100644
Binary files a/locale/fr_FR/LC_MESSAGES/Studs.mo and b/locale/fr_FR/LC_MESSAGES/Studs.mo differ
diff --git a/locale/fr_FR/LC_MESSAGES/Studs.po b/locale/fr_FR/LC_MESSAGES/Studs.po
index 80c857754f5abf441aa751782baa4e56d7b96d37..130647cfcc8e876736923b7f46c9ce233b03d67a 100644
--- a/locale/fr_FR/LC_MESSAGES/Studs.po
+++ b/locale/fr_FR/LC_MESSAGES/Studs.po
@@ -21,6 +21,9 @@ msgstr ""
 msgid "Make your polls"
 msgstr "Organiser des rendez-vous simplement, librement."
 
+msgid "Home"
+msgstr "Accueil"
+
 msgid "Poll"
 msgstr "Sondage"
 
@@ -45,6 +48,12 @@ msgstr "Modifier"
 msgid "Next"
 msgstr "Continuer"
 
+msgid "Back"
+msgstr "Précédent"
+
+msgid "Close"
+msgstr "Fermer"
+
 msgid "Your name"
 msgstr "Votre nom"
 
@@ -55,7 +64,7 @@ msgid "Description"
 msgstr "Description"
 
 msgid "Back to the homepage of "
-msgstr "Retournez à la page d'accueil de"
+msgstr "Retourner à la page d'accueil de"
 
 msgid "Error!"
 msgstr "Erreur !"
@@ -79,30 +88,80 @@ msgstr "Changer la langue"
 msgid "Select the language"
 msgstr "Choisir la langue"
 
-########### Footer ###########
-msgid "Home"
-msgstr "Accueil"
-
-msgid "About"
-msgstr "Informations générales"
-
-msgid "Contact"
-msgstr "Contact"
-
 ############ Homepage ############
 msgid "Schedule an event"
 msgstr "Créer un sondage spécial dates"
 
-msgid "Make a poll"
+msgid "Make a classic poll"
 msgstr "Créer un sondage classique"
 
-msgid "or"
-msgstr "ou"
+# 1st section
+msgid "What is that?"
+msgstr "Prise en main"
+
+msgid "Framadate is an online service for planning an appointment or make a decision quickly and easily. No registration is required."
+msgstr "Framadate est un service en ligne permettant de planifier un rendez-vous ou prendre des décisions rapidement et simplement. Aucune inscription préalable n’est nécessaire."
+
+msgid "Here is how it works:"
+msgstr "Voici comment ça fonctionne :"
+
+msgid "Make a poll"
+msgstr "Créez un sondage"
+
+msgid "Define dates or subjects to choose"
+msgstr "Déterminez les dates ou les sujets à choisir"
+
+msgid "Send the poll link to your friends or colleagues"
+msgstr "Envoyez le lien du sondage à vos amis ou collègues"
+
+msgid "Discuss and make a decision"
+msgstr "Discutez et prennez votre décision"
+
+msgid "Do you want to "
+msgstr "Voulez-vous "
+
+msgid "view an example?"
+msgstr "voir un exemple ?"
+
+# 2nd section
+msgid "The software"
+msgstr "Le logiciel"
+
+msgid "Framadate was initially based on "
+msgstr "Framadate est initialement basé sur "
+
+msgid " a software developed by the University of Strasbourg. Today, it is devevoped by the association Framasoft"
+msgstr " un logiciel développé par l'Université de Strasbourg. Aujourd'hui, son développement est assuré par l’association Framasoft"
 
-msgid "view an example"
-msgstr "voir un exemple"
+msgid "This software needs javascript and cookies enabled. It is compatible with the following web browsers:"
+msgstr "Ce logiciel requiert l’activation du javascript et des cookies. Il est compatible avec les navigateurs web suivant :"
+
+msgid "It is governed by the "
+msgstr "Il est régi par la "
+
+msgid "CeCILL-B license"
+msgstr "licence CeCILL-B"
+
+# 3rd section
+msgid "Cultivate your garden"
+msgstr "Cultivez votre jardin"
+
+msgid "To participate in the software development, suggest improvements or simply download it, please visit "
+msgstr "Pour participer au développement du logiciel, proposer des améliorations ou simplement le télécharger, rendez-vous sur "
+
+msgid "the development site"
+msgstr "le site de développement"
+
+msgid "If you want to install the software for your own use and thus increase your independence, we help you on:"
+msgstr "Si vous souhaitez installer ce logiciel pour votre propre usage et ainsi gagner en autonomie, nous vous aidons sur :"
 
 ############## Poll ##############
+msgid "Poll administration"
+msgstr "Administration du sondage"
+
+msgid "Legend:"
+msgstr "Légende :"
+
 # Jumbotron adminstuds.php (+ studs.php)
 msgid "Back to the poll"
 msgstr "Retour au sondage"
@@ -158,6 +217,27 @@ msgstr "Lien public du sondage"
 msgid "Admin link of the pool"
 msgstr "Lien d'administration du sondage"
 
+msgid "Poll rules"
+msgstr "Permissions du sondage"
+
+msgid "Edit the poll rules"
+msgstr "Modifier les permissions du sondage"
+
+msgid "Votes and comments are locked"
+msgstr "Les votes et commentaires sont verrouillés"
+
+msgid "Votes and comments are open"
+msgstr "Les votes et commentaires sont ouverts"
+
+msgid "Votes are editable"
+msgstr "Les votes sont modifiables"
+
+msgid "Save the new rules"
+msgstr "Enregistrer les nouvelles permissions"
+
+msgid "Cancel the rules edit"
+msgstr "Annuler le changement de permissions"
+
 # Help text adminstuds.php
 msgid "As poll administrator, you can change all the lines of this poll with this button "
 msgstr "En tant qu'administrateur, vous pouvez modifier toutes les lignes de ce sondage avec ce bouton "
@@ -176,6 +256,9 @@ msgid "If you want to vote in this poll, you have to give your name, choose the
 msgstr "Pour participer à ce sondage, veuillez entrer votre nom, choisir toutes les valeurs qui vous conviennent et valider votre choix avec le bouton en bout de ligne."
 
 # Poll results
+msgid "Votes of the poll "
+msgstr "Votes du sondage "
+
 msgid "Remove the column"
 msgstr "Effacer la colonne"
 
@@ -233,6 +316,15 @@ msgstr "votes"
 msgid "for"
 msgstr "à"
 
+msgid "Remove all the votes"
+msgstr "Supprimer tous les votes"
+
+msgid "Scroll to the left"
+msgstr "Faire défiler à gauche"
+
+msgid "Scroll to the right"
+msgstr "Faire défiler à droite"
+
 # Comments
 msgid "Comments of polled people"
 msgstr "Commentaires de sondés"
@@ -252,6 +344,9 @@ msgstr "Envoyer le commentaire"
 msgid "anonyme"
 msgstr "anonyme"
 
+msgid "Remove all the comments"
+msgstr "Supprimer tous les commentaires"
+
 # Add a colum adminstuds.php
 msgid "Column's adding"
 msgstr "Ajout de colonne"
@@ -320,6 +415,9 @@ msgstr "Vous souhaitez que les sondés puissent modifier leur ligne eux-mêmes."
 msgid "To receive an email for each new vote."
 msgstr "Vous souhaitez recevoir un mail à chaque participation d'un sondé."
 
+msgid "Go to step 2"
+msgstr "Aller à l'étape 2"
+
 # Errors info_sondage.php
 msgid "Enter a title"
 msgstr "Il faut saisir un titre !"
@@ -337,6 +435,9 @@ msgstr "L'adresse saisie n'est pas correcte ! (Il faut une adresse valide pour r
 msgid "You haven't filled the first section of the poll creation."
 msgstr "Vous n'avez pas renseigné la première page du sondage"
 
+msgid "Back to step 1"
+msgstr "Revenir à l’étape 1"
+
 ########### Step 2 ###########
 # Step 2 choix_date.php
 msgid "Poll dates (2 on 3)"
@@ -391,15 +492,42 @@ msgstr "Pour créer un sondage classique, vous devez proposer au moins deux choi
 msgid "You can add or remove additional choices with the buttons"
 msgstr "Vous pouvez ajouter ou supprimer des choix supplémentaires avec les boutons"
 
+msgid "It's possible to propose links or images by using "
+msgstr "Il est possible d’insérer des liens ou des images en utilisant "
+
+msgid "the Markdown syntax"
+msgstr "la syntaxe Markdown"
+
 msgid "Choice"
 msgstr "Choix"
 
+msgid "Add a link or an image"
+msgstr "Ajouter un lien ou une image"
+
+msgid "These fields are optional. You can add a link, an image or both."
+msgstr "Ces champs sont optionnels. Vous pouvez ajouter un lien, une image ou les deux."
+
+msgid "URL of the image"
+msgstr "URL de l'image"
+
+msgid "Link"
+msgstr "Lien"
+
+msgid "Alternative text"
+msgstr "Texte alternatif"
+
 msgid "Remove a choice"
 msgstr "Supprimer un choix"
 
 msgid "Add a choice"
 msgstr "Ajouter un choix"
 
+msgid "Back to step 2"
+msgstr "Revenir à l’étape 2"
+
+msgid "Go to step 3"
+msgstr "Aller à l’étape 3"
+
 ########### Step 3 ###########
 msgid "Removal date and confirmation (3 on 3)"
 msgstr "Date d'expiration et confirmation (3 sur 3)"
@@ -407,6 +535,9 @@ msgstr "Date d'expiration et confirmation (3 sur 3)"
 msgid "Confirm the creation of your poll"
 msgstr "Confirmez la création de votre sondage"
 
+msgid "List of your choices"
+msgstr "Liste de vos choix"
+
 msgid "Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll."
 msgstr "Une fois que vous aurez confirmé la création du sondage, vous serez redirigé automatiquement vers la page d'administration de votre sondage."
 
@@ -417,15 +548,15 @@ msgid "Create the poll"
 msgstr "Créer le sondage"
 
 # Step 3 choix_date.php
-msgid "Your poll will expire automatically 2 days after the last date of your poll."
-msgstr "Votre sondage sera automatiquement effacé après la date la plus tardive."
+msgid "Your poll will be automatically removed 6 months after the last date of your poll:"
+msgstr "Votre sondage sera automatiquement effacé 6 mois après la date la plus tardive :"
 
 msgid "Removal date:"
 msgstr "Date de suppression :"
 
 # Step 3 choix_autre.php
-msgid "Your poll will be automatically removed after 6 months."
-msgstr "Votre sondage sera automatiquement effacé dans 6 mois."
+msgid "Your poll will be automatically removed after 6 months:"
+msgstr "Votre sondage sera automatiquement effacé dans 6 mois :"
 
 msgid "You can fix another removal date for it."
 msgstr "Néanmoins vous pouvez décider ci-dessous d'une date plus rapprochée pour la suppression de votre sondage."
@@ -433,29 +564,6 @@ msgstr "Néanmoins vous pouvez décider ci-dessous d'une date plus rapprochée p
 msgid "Removal date (optional)"
 msgstr "Date de fin (facultative)"
 
-########### Contact #########
-msgid "Contact us"
-msgstr "Nous contacter"
-
-msgid "If you have questions, you can send a message here."
-msgstr "Pour toutes questions ou suggestions vous pouvez laisser un message via ce formulaire."
-
-msgid "Question"
-msgstr "Question"
-
-msgid "Send your question"
-msgstr "Envoyer votre question"
-
-msgid "Your message has been sent!"
-msgstr "Votre message a bien été envoyé !"
-
-# Errors contact.php
-msgid "The address is not correct!"
-msgstr "L'adresse saisie n'est pas correcte !"
-
-msgid "You must ask a question!"
-msgstr "Vous devez poser au moins une question !"
-
 ############# Admin #############
 msgid "Polls administrator"
 msgstr "Administrateur de la base"
@@ -512,57 +620,28 @@ msgstr ""
 msgid "Thanks for your confidence."
 msgstr "Merci de votre confiance."
 
-# Mails adminstuds.php
-msgid "[ADMINISTRATOR] New title for your poll"
-msgstr "[ADMINISTRATEUR] Changement du titre du sondage avec "
-
-msgid ""
-"You have changed the title of your poll. \n"
-"You can modify this poll with this link"
-msgstr ""
-"Vous avez modifié le titre de votre sondage. \n"
-"Vous pouvez modifier ce sondage au lien suivant"
-
-msgid "[ADMINISTRATOR] New description for your poll"
-msgstr "[ADMINISTRATEUR] Changement de description de votre sondage "
+msgid "\n"
+"--\n\n"
+"« La route est longue, mais la voie est libre… »\n"
+"Framasoft ne vit que par vos dons (déductibles des impôts).\n"
+"Merci d'avance pour votre soutien http://soutenir.framasoft.org."
+msgstr "\n"
+"--\n\n"
+"« La route est longue, mais la voie est libre… »\n"
+"Framasoft ne vit que par vos dons (déductibles des impôts).\n"
+"Merci d'avance pour votre soutien http://soutenir.framasoft.org."
 
-msgid ""
-"You have changed the description of your poll. \n"
-"You can modify this poll with this link"
-msgstr ""
-"Vous avez modifié la description de votre sondage. \n"
-"Vous pouvez modifier ce sondage au lien suivant"
-
-msgid "[ADMINISTRATOR] New email address for your poll"
-msgstr "[ADMINISTRATEUR] Changement d'adresse électronique de l'administrateur avec "
+# Mails adminstuds.php
+msgid "[ADMINISTRATOR] New settings for your poll"
+msgstr "[ADMINISTRATEUR] Changement de configuration du sondage"
 
 msgid ""
-"You have changed your email address in your poll. \n"
+"You have changed the settings of your poll. \n"
 "You can modify this poll with this link"
 msgstr ""
-"Vous avez modifié l'adresse mail associé à votre sondage. \n"
+"Vous avez modifié la configuration de votre sondage. \n"
 "Vous pouvez modifier ce sondage au lien suivant"
 
-msgid "[ADMINISTRATOR] Removing of your poll"
-msgstr "[ADMINISTRATEUR] Suppression de sondage"
-
-msgid ""
-"You have removed your poll. \n"
-"You can make new polls with this link"
-msgstr ""
-"Vous supprimé un sondage. \n"
-"Vous pouvez faire de nouveaux sondages au lien suivant"
-
-msgid "[ADMINISTRATOR] New column for your poll"
-msgstr "[ADMINISTRATEUR] Ajout d'une nouvelle colonne au sondage "
-
-msgid ""
-"You have added a new column in your poll. \n"
-"You can inform the voters of this change with this link"
-msgstr ""
-"Vous avez ajouté une colonne à votre sondage. \n"
-"Vous pouvez informer vos utilisateurs de ce changement en leur envoyant l'adresse suivante"
-
 # Mails creation_sondage.php
 msgid ""
 "This is the message you have to send to the people you want to poll. \n"
@@ -591,28 +670,3 @@ msgstr "Réservé à l'auteur"
 
 msgid "For sending to the polled users"
 msgstr "Pour diffusion aux sondés"
-
-# Mails contact.php
-msgid "[CONTACT] You have sent a question "
-msgstr "[CONTACT] Envoi de question "
-
-msgid "You have a question from a user "
-msgstr "Vous avez une question d'utilisateur de "
-
-msgid "User"
-msgstr "Utilisateur"
-
-msgid "User's email address"
-msgstr "Adresse utilisateur"
-
-msgid "Message"
-msgstr "Message"
-
-msgid "[COPY] Someone has sent a question "
-msgstr "[COPIE] Envoi de question "
-
-msgid "Here is a copy of your question"
-msgstr "Voici une copie de votre question"
-
-msgid "We're going to answer your question shortly."
-msgstr "Nous allons prendre en compte votre message rapidement."
diff --git a/studs.php b/studs.php
index 425ec8538783f4dd110becb8eb3d730ea5c8f5c8..7abd5a6beebf06277b7256a0dfb3d10001202936 100644
--- a/studs.php
+++ b/studs.php
@@ -320,7 +320,7 @@ $td_headers = array(); // for a11y, headers="M1 D4 H5" on each td
 $radio_title = array(); // date for
 
 // Dates poll
-if ($dsondage->format=="D"||$dsondage->format=="D+") {
+if ($dsondage->format=="D"||$dsondage->format=="D+"||$dsondage->format=="D-") {
 
     $tr_months = '<tr><th role="presentation"></th>';
     $tr_days = '<tr><th role="presentation"></th>';
@@ -366,7 +366,7 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
             $hour = substr($current, strpos($current, '@')-count($current)+2);
 
             if ($hour != "") {
-                $tr_hours .= '<th class="bg-info'.$rbd.'" id="H'.$i.'">'.$hour.'</th>';
+                $tr_hours .= '<th class="bg-info'.$rbd.'" id="H'.$i.'" title="'.$hour.'">'.$hour.'</th>';
                 $radio_title[$i] .= ' - '.$hour;
                 $td_headers[$i] .= ' H'.$i;
             } else {
@@ -396,11 +396,35 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
         $td_headers[$i]='';$radio_title[$i]=''; // init before concatenate
 
         // Subjects
-        $tr_subjects .= '<th class="bg-info" id="S'.preg_replace("/[^a-zA-Z0-9]_+/", "", stripslashes($toutsujet[$i])).'">'.stripslashes($toutsujet[$i]).'</th>';
+        preg_match_all('/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/',$toutsujet[$i],$md_a_img);  // Markdown [![alt](src)](href)
+        preg_match_all('/!\[(.*?)\]\((.*?)\)/',$toutsujet[$i],$md_img);                 // Markdown ![alt](src)
+        preg_match_all('/\[(.*?)\]\((.*?)\)/',$toutsujet[$i],$md_a);                    // Markdown [text](href)
+        if (isset($md_a_img[2][0]) && $md_a_img[2][0]!='' && isset($md_a_img[3][0]) && $md_a_img[3][0]!='') { // [![alt](src)](href)
+
+            $th_subject_text = (isset($md_a_img[1][0]) && $md_a_img[1][0]!='') ? stripslashes($md_a_img[1][0]) : _("Choice") .' '.($i+1);
+            $th_subject_html = '<a href="'.$md_a_img[3][0].'"><img src="'.$md_a_img[2][0].'" class="img-responsive" alt="'.$th_subject_text.'" /></a>';
+
+        } elseif (isset($md_img[2][0]) && $md_img[2][0]!='') { // ![alt](src)
+
+            $th_subject_text = (isset($md_img[1][0]) && $md_img[1][0]!='') ? stripslashes($md_img[1][0]) : _("Choice") .' '.($i+1);
+            $th_subject_html = '<img src="'.$md_img[2][0].'" class="img-responsive" alt="'.$th_subject_text.'" />';
+
+        } elseif (isset($md_a[2][0]) && $md_a[2][0]!='') { // [text](href)
+
+            $th_subject_text = (isset($md_a[1][0]) && $md_a[1][0]!='') ? stripslashes($md_a[1][0]) : _("Choice") .' '.($i+1);
+            $th_subject_html = '<a href="'.$md_a[2][0].'">'.$th_subject_text.'</a>';
+
+        } else { // text only
+
+            $th_subject_text = stripslashes($toutsujet[$i]);
+            $th_subject_html = $th_subject_text;
+
+        }
+        $tr_subjects .= '<th class="bg-info" id="S'.$i.'" title="'.$th_subject_text.'">'.$th_subject_html.'</th>';
 
         $border[$i] = false;
-        $td_headers[$i] .= stripslashes($toutsujet[$i]);
-        $radio_title[$i] .= stripslashes($toutsujet[$i]);
+        $td_headers[$i] .= 'S'.$i;
+        $radio_title[$i] .= $th_subject_text;
 
    }
 
@@ -411,13 +435,35 @@ if ($dsondage->format=="D"||$dsondage->format=="D+") {
 echo '
 <form name="formulaire" action="' . Utils::getUrlSondage($dsondage->id_sondage) . '" method="POST">
     <input type="hidden" name="sondage" value="' . $numsondage . '"/>
-
+';
+if ($dsondage->format=="A-" || $dsondage->format=="D-") {
+    echo '
+    <div class="alert alert-danger">
+        <p>' . _("The administrator locked this poll, votes and comments are frozen, it's not possible to participate anymore.") . '</p>
+        <p><b>' . _('Legend:'). '</b> <span class="glyphicon glyphicon-ok"></span> =' . _('Yes') . ', <b>(<span class="glyphicon glyphicon-ok"></span>)</b> = ' . _('Ifneedbe') . ', <span class="glyphicon glyphicon-ban-circle"></span> = ' . _('No') . '</span></p>
+    </div>';
+} else {
+    echo '
     <div class="alert alert-info">
         <p>' . _("If you want to vote in this poll, you have to give your name, choose the values that fit best for you and validate with the plus button at the end of the line.") . '</p>
+        <p><b>' . _('Legend:'). '</b> <span class="glyphicon glyphicon-ok"></span> =' . _('Yes') . ', <b>(<span class="glyphicon glyphicon-ok"></span>)</b> = ' . _('Ifneedbe') . ', <span class="glyphicon glyphicon-ban-circle"></span> = ' . _('No') . '</span></p>
+    </div>';
+}
+echo'
+    <div class="hidden row scroll-buttons" aria-hidden="true">
+        <div class="btn-group pull-right">
+            <button class="btn btn-sm btn-link scroll-left" title="' . _('Scroll to the left') . '">
+                <span class="glyphicon glyphicon-chevron-left"></span>
+            </button>
+            <button class="btn  btn-sm btn-link scroll-right" title="' . _('Scroll to the right') . '">
+                <span class="glyphicon glyphicon-chevron-right"></span>
+            </button>
+        </div>
     </div>
+
     <div id="tableContainer" class="tableContainer">
         <table class="results">
-            <caption>'._('Votes of the poll ').$title.'</caption>
+            <caption class="sr-only">'._('Votes of the poll ').$title.'</caption>
             <thead>'. $thead . '</thead>
         <tbody>';
 
@@ -499,8 +545,12 @@ while ($data = $user_studs->FetchNextObject(false)) {
 
     //a la fin de chaque ligne se trouve les boutons modifier
     if ($compteur != $ligneamodifier && ($dsondage->format=="A+"||$dsondage->format=="D+") && $mod_ok) {
-        echo '<td><button type="submit" class="btn btn-link btn-sm" name="modifierligne'.$compteur.'" title="'. _('Edit the line:') .' '.stripslashes($nombase).'">
-        <span class="glyphicon glyphicon-pencil"></span></button></td>'."\n";
+        echo '
+                <td>
+                    <button type="submit" class="btn btn-link btn-sm" name="modifierligne'.$compteur.'" title="'. _('Edit the line:') .' '.stripslashes($nombase).'">
+                        <span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span>
+                    </button>
+                </td>'."\n";
     }
 
     //demande de confirmation pour modification de ligne
@@ -517,7 +567,7 @@ while ($data = $user_studs->FetchNextObject(false)) {
 }
 
 // affichage de la ligne pour un nouvel utilisateur
-if (( !(USE_REMOTE_USER && isset($_SERVER['REMOTE_USER'])) || !$user_mod) && $ligneamodifier==-1) {
+if (( !(USE_REMOTE_USER && isset($_SERVER['REMOTE_USER'])) || !$user_mod) && $ligneamodifier==-1 && ($dsondage->format!="A-" && $dsondage->format!="D-")) {
     //affichage de la case vide de texte pour un nouvel utilisateur
     echo '<tr id="vote-form">
 <td class="bg-info" style="padding:5px">
@@ -562,71 +612,56 @@ if (( !(USE_REMOTE_USER && isset($_SERVER['REMOTE_USER'])) || !$user_mod) && $li
 
 // Addition and Best choice
 //affichage de la ligne contenant les sommes de chaque colonne
-$tr_addition = '<tr><td>'. _("Addition") .'</td>';
-$tr_bestchoice = '<tr><td></td>';
-$meilleurecolonne = 0;
-
-for ($i = 0; $i < $nbcolonnes; $i++) {
-    if (isset($somme[$i]) && $somme[$i] > 0 ) {
-        if (isset($somme[$i]) && $somme[$i] > $meilleurecolonne){
-            $meilleurecolonne = $somme[$i];
-        }
-        $tr_addition .= '<td>'.$somme[$i].'</td>';
-    } else {
-        $tr_addition .= '<td></td>';
-    }
-}
-$tr_addition .= '<td></td></tr>';
-
-//recuperation des valeurs des sujets et adaptation pour affichage
-$toutsujet = explode(",", $dsondage->sujet);
-
+$tr_addition = '<tr id="addition"><td>'. _("Addition") .'</td>';
+$meilleurecolonne = max($somme);
 $compteursujet = 0;
 $meilleursujet = '<ul style="list-style:none">';
 for ($i = 0; $i < $nbcolonnes; $i++) {
+    if (isset($somme[$i]) && $somme[$i] > 0 ) {
+        if (in_array($i, array_keys($somme, max($somme)))){
 
-    if (isset($somme[$i]) && $somme[$i] > 0 && $somme[$i] == $meilleurecolonne){
-        $tr_bestchoice .= '<td><span class="glyphicon glyphicon-star text-warning"></span></td>';
+            $tr_addition .= '<td><span class="glyphicon glyphicon-star text-warning"></span><span>'.$somme[$i].'</span></td>';
 
-        if ($dsondage->format == "D" || $dsondage->format == "D+") {
-            $meilleursujetexport = $toutsujet[$i];
+            $meilleursujet.= '<li><b>'.$radio_title[$i].'</b></li>';
+            $compteursujet++;
 
-            if (strpos($toutsujet[$i], '@') !== false) {
-                $toutsujetdate = explode("@", $toutsujet[$i]);
-                $meilleursujet .= '<li><b>'.strftime(_("%A, den %e. %B %Y"),$toutsujetdate[0]). ' - ' . $toutsujetdate[1].'</b></li>';
-            } else {
-                $meilleursujet .= '<li><b>'.strftime(_("%A, den %e. %B %Y"),$toutsujet[$i]).'</b></li>';
-            }
         } else {
-            $meilleursujet.= '<li><b>'.$toutsujet[$i].'</b></li>';
+            $tr_addition .= '<td>'.$somme[$i].'</td>';
         }
-        $compteursujet++;
-
     } else {
-        $tr_bestchoice .= '<td></td>';
+        $tr_addition .= '<td></td>';
     }
 }
-$tr_bestchoice .= '<td></td></tr>';
+$tr_addition .= '<td></td></tr>';
 
 $meilleursujet = str_replace("°", "'", $meilleursujet).'</ul>';
 $vote_str = ($meilleurecolonne > 1) ? $vote_str = _('votes') : _('vote');
 
 // Print Addition and Best choice
-echo $tr_addition."\n".$tr_bestchoice.'
+echo $tr_addition.'
         </tbody>
     </table>
-        <div class="col-sm-4 col-sm-offset-4"><p>'."\n";
+    </div>
+    <div class="row">'."\n";
 
 if ($compteursujet == 1) {
-    echo '<span class="glyphicon glyphicon-star text-warning"></span> ' . _("The best choice at this time is:") . '</p>' . $meilleursujet . '<p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . ".\n";
+    echo '
+        <div class="col-sm-6 col-sm-offset-3 alert alert-success">
+            <p><span class="glyphicon glyphicon-star text-warning"></span> ' . _("The best choice at this time is:") . '</p>
+            ' . $meilleursujet . '
+            <p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . '.</p>
+        </div>'."\n";
 } elseif ($compteursujet > 1) {
-    echo '<span class="glyphicon glyphicon-star text-warning"></span> ' . _("The bests choices at this time are:") . '</p>' . $meilleursujet . '<p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . ".\n";
+    echo '
+        <div class="col-sm-6 col-sm-offset-3 alert alert-success">
+            <p><span class="glyphicon glyphicon-star text-warning"></span> ' . _("The bests choices at this time are:") . '</p>
+            ' . $meilleursujet . '
+            <p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . '.</p>
+        </div>'."\n";
 }
 
 echo '
-        </p></div>
     </div>
-
     <hr />';
 
 // Comments
@@ -635,7 +670,7 @@ $sql = $connect->Prepare($sql);
 $comment_user=$connect->Execute($sql, array($numsondage));
 
 if ($comment_user->RecordCount() != 0) {
-    echo '<div class="row"><h3>' . _("Comments of polled people") . '</h3>'."\n";
+    echo '<div><h3>' . _("Comments of polled people") . '</h3>'."\n";
 
     while($dcomment = $comment_user->FetchNextObject(false)) {
         echo '
@@ -647,8 +682,10 @@ if ($comment_user->RecordCount() != 0) {
 
     echo '</div>';
 }
+
+if ($dsondage->format!="A-" && $dsondage->format!="D-") {
 echo '
-        <div class="row hidden-print alert alert-info">
+        <div class="hidden-print alert alert-info">
             <div class="col-md-6 col-md-offset-3">
             <fieldset id="add-comment"><legend>' . _("Add a comment in the poll") . '</legend>
                 <div class="form-group">
@@ -661,10 +698,12 @@ echo '
                 <p class="text-center"><input type="submit" name="ajoutcomment" value="'. _("Send the comment") .'" class="btn btn-success"></p>
             </fieldset>
             </div>
-        </div>
-    </div>
-</form>
+            <div class="clearfix"></div>
+        </div>';
+}
 
-<a id="bas"></a>';
+echo '
+    </div>
+</form>';
 
 bandeau_pied();