<% var set_course_date = ""; var d = new Date(); var firstDayOfMonth = new Date(get_year, get_month, 1).getDay(); var lastDateOfMonth = new Date(get_year, get_month+1, 0).getDate(); var lastDayOfLastMonth = get_month == 0 ? new Date(get_year-1, 11, 0).getDate() : new Date(get_year, get_month, 0).getDate(); %>
<% for(var i=0; i < DaysOfWeek.length;i++) { %> <%= DaysOfWeek[i] %> | <% } %>
<% var i=1; do { var dow = new Date(get_year, get_month, i).getDay(); if ( dow == 0 ) { %> <% }else if ( i == 1 ) { %>
<% var k = lastDayOfLastMonth - firstDayOfMonth+1; for(var j=0; j < firstDayOfMonth; j++) { %> <%= k %> | <% k++; } } var chk = new Date(); var chkY = chk.getFullYear(); var chkM = chk.getMonth(); current_date_course = ""; course_date_class = ""; var active_class = ""; if(typeof all_course_dates[i] !== "undefined"){ current_date_course = JSON.stringify(all_course_dates[i]); course_date_class = "course_available"; } if (chkY == get_year && chkM == get_month && i == chk.getDate()) { var today = i; if(typeof all_course_dates[i] !== "undefined") set_course_date = i; if(course_date_class !== "") active_class = "active"; %> | <% } else { if(typeof all_course_dates[i] !== "undefined" && set_course_date == ""){ set_course_date = i; if((typeof all_course_dates[chk.getDate()] == "undefined" && get_month == current_month) || get_month != current_month) active_class = "active"; } %> | <% } if ( dow == 6 ) { %>
<% }else if ( i == lastDateOfMonth ) { var k=1; for(dow; dow < 6; dow++) { %> <%= k %> | <% k++; } } i++; }while(i <= lastDateOfMonth); %>