How to display a specific container once a day?


I need to show the tipical 'use of cookies' message at the bottom of the page just when some user visits the web, and just show it once at day,I'm trying but my code it's not working properly. here's the code I have so far...

<div id="cookie1"> </div>
<button id="botoncookie">Acept</button>

   <script type="text/javascript">
document.getElementById('cookie1').style.bottom = '-50px';
var expiresdate =  5000 ; //1 day

var mensaje = document.cookie.split('cookie1=')[1] + expiresdate;

if(mensaje != null){
 document.getElementById('cookie1').style.display = 'none'; 

 document.cookie = 'cookie1=visto;path=/';

Set a cookie with an expiration time of 24*60*60 and whenever a page is loaded, check if the cookie exists, otherwise, display the message.