diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee
index 3f4b0f61dc45ce41838e341263df4aceb92e030e..bdb83f4947430e4334d7cf3219e7382541263cd2 100644
--- a/app/assets/javascripts/main.js.coffee
+++ b/app/assets/javascripts/main.js.coffee
@@ -33,6 +33,11 @@ $ ->
   # Bottom tooltip
   $('.has_bottom_tooltip').tooltip(placement: 'bottom')
 
+  # Flash
+  if (flash = $("#flash-container")).length > 0
+    flash.click -> $(@).slideUp("slow")
+    flash.slideDown "slow"
+    setTimeout (-> flash.slideUp("slow")), 3000
 
   # Disable form buttons while a form is submitting
   $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index c82ddc185b3fada649ffc4d40dd83b6ebb68827a..d79e97aa437201c7548d5cb0e88f27402a85928c 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -68,7 +68,7 @@ table a code {
 }
 
 /** FLASH message **/
-#flash_container {
+#flash-container {
   height: 50px;
   position: fixed;
   z-index: 10001;
@@ -79,6 +79,8 @@ table a code {
   background: white;
   cursor: pointer;
   border-bottom: 1px solid #ccc;
+  text-align: center;
+  display: none;
 
   h4 {
     color: #666;
diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml
index 86564ad7110fa7266737c838ddf60288c3145052..9961ce8dd349dcff22d89c02566863a32aac31bc 100644
--- a/app/views/layouts/_flash.html.haml
+++ b/app/views/layouts/_flash.html.haml
@@ -1,17 +1,3 @@
-- if alert || notice
-  - text = alert || notice
-  %div{style: "display:none", id: "flash_container"}
-    %center
-      %h4= text
-  :javascript
-    $(function(){
-      $("#flash_container").slideDown("slow");
-      $("#flash_container").click(function(){
-        $(this).slideUp("slow");
-      });
-      setTimeout("hideFlash()",3000);
-    });
-
-    function hideFlash(){
-      $("#flash_container").slideUp("slow");
-    }
+- if text = alert || notice
+  #flash-container
+    %h4= text
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 70c4f007ba1c0e5e2983d9463ea89017f4d447d9..36c6b4c6c35d8617e1ee94811c66ed2a8e1e3bd6 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -2,5 +2,5 @@
 %html{ lang: "en"}
   = render "layouts/head"
   %body.ui_basic.login-page
-    = render partial: "layouts/flash"
+    = render "layouts/flash"
     .container= yield