Javascript to highlight today’s opening times or a notice about a public holidau
<h3>Opening Hours</h3>
<div style=" font-size: 1em; font-family:NB; ">
<table>
<tr style="border: 1px solid #dddddd;">
<td style="padding:10px;"><div id="monday"><div id="tuesday"><div id="wednesday">Monday to Wednesday:</div></td>
<td><div id="mondaytime"><div id="tuesdaytime"><div id="wednesdaytime">10:00am - 9:00pm</div></td>
</tr>
<tr style="border: 1px solid #dddddd;">
<td style="padding:10px;"><div id="thursday">Thursday:</div></td>
<td><div id="thursdaytime">10:00am - 9:30pm</div></td>
</tr>
<tr style="border: 1px solid #dddddd;">
<td style="padding:10px;"><div id="friday">Friday:</div></td>
<td><div id="fridaytime">10:00am - 10:00pm</div></td>
</tr>
<tr style="border: 1px solid #dddddd;">
<td style="padding:10px;"><div id="saturday">Saturday:</div></td>
<td><div id="saturdaytime">9:00am - 10:00pm</div></td>
</tr>
<tr style="border: 1px solid #dddddd;">
<td style="padding:10px;"><div id="sunday">Sunday:</div></td>
<td><div id="sundaytime">10:00am - 9:30pm</div></td>
</tr>
</table>
<br>
<div id="goodfriday"><div id="xmas">The store is closed on Good Friday and Christmas Day</div></div></br>
<div id="anzac">We are open on Anzac Day from 12pm</div>
</div>
<script type="text/javascript">
// Work out Good Friday
var d = new Date();
var currentYear = d.getFullYear();
var a = Math.floor(currentYear % 19);
var b = Math.floor(currentYear / 100);
var c = Math.floor(currentYear % 100);
var d = Math.floor(b / 4);
var e = Math.floor(b % 4);
var f = Math.floor((b + 8) / 25);
var g = Math.floor((b - f + 1) / 3);
var h = Math.floor((19 * a + b - d - g + 15) % 30);
var i = Math.floor(c / 4);
var k = Math.floor(c % 4);
var l = Math.floor((32 + 2 * e + 2 * i - h - k) % 7);
var m = Math.floor((a + 11 * h + 22 * l) / 451);
var n = Math.floor((h + l - 7 * m + 114) / 31);
var p = Math.floor(((h + l - 7 * m + 114) % 31) -1);
var eastermonth = n.toString();
var goodfridaydate = p.toString();
var goodfriday = goodfridaydate + eastermonth ;
//Work out todays dates
var currentmonth = new Date().getMonth();
var currentday = new Date().getDate();
var currentmonths = currentmonth.toString();
var currentdays = currentday.toString();
var currentdaymonth = currentdays + currentmonths ;
var publicholiday
if (currentdaymonth == goodfriday) document.getElementById("goodfriday").className = ’today’; publicholiday = "Yes";
if (currentdaymonth == "2511") document.getElementById("xmas").className = ’today’; publicholiday = "Yes";
if (currentdaymonth == "253") document.getElementById("anzac").className = ’today’; publicholiday = "Yes";
if( typeof variable === ’undefined’ || variable === null ){
// Make the current day bold if not holiday
var d = new Date();
var days = ’sunday,monday,tuesday,wednesday,thursday,friday,saturday’.split(‘,’);
document.getElementById( days[new Date().getDay()] ).className = ’today’;
document.getElementById( days[new Date().getDay()] + ’time’).className = ’today’;
}
</script>
</br>
.today {
font-family:Marr;
text-transform: uppercase;
}