Выбор отображаемых блоков от даты

Магазин праздников

by vovkasolovev

HTML

<a href="/we-can/new-year" class="not-actual" id="new-year-flag"><div class='newYear vertical-move'><span>Новый год</span></div></a>			
<a href="/we-can/graduation" class="not-actual" id="graduation-flag"><div class='graduation vertical-move'><span>Выпускной</span></div></a>			
<a href="/we-can/corporate"  class="not-actual" id="corporate-flag"><div class='corporate vertical-move'><span>Корпоратив</span></div></a>	

<ul class='holidays'>
    <li><a class='anniversary' href="/we-can/anniversary">Юбилей</a></li>
    <li><a class='teambulding' href="/we-can/team">Тимбилдинг</a></li>
    <li><a class='corporate' href="/we-can/corporate">Корпоратив</a></li>
    <li><a class='child' href="/we-can/child">Детский</a></li>
    <li><a class='newYear' href="/we-can/new-year">Новый год</a></li>
    <li><a class='graduation' href="/we-can/graduation">Выпускной</a></li>
</ul>
<span id="test">Ничего</span>

CSS

.not-actual{display:none}

JavaScript

var today = new Date();
var actual_event = 'newYear';

if (today.getMonth() == 0) {
    if (today.getDate() >= 14) {actual_event = 'graduation';}
}
if (today.getMonth() == 1) {actual_event = 'graduation';}

if (today.getMonth() > 1 && today.getMonth() <= 7) {actual_event = 'corporate';}

if (today.getMonth() == 8) {
    if (today.getDate() <= 9) {actual_event = 'corporate';}
}


if (actual_event == 'newYear'){
    document.getElementById("new-year-flag").style.display="inline";
    $('.holidays .newYear').parent().hide();     

}

if (actual_event == 'graduation'){
    document.getElementById("graduation-flag").style.display="inline";
    $('.holidays .graduation').parent().hide();     
}

if (actual_event == 'corporate'){
    document.getElementById("corporate-flag").style.display="inline";
    $('.holidays .corporate').parent().hide();    
}

document.getElementById('test').innerHTML = actual_event;