var monthCalendarGen=function(e,t){var d,a=/^-?[0-9]{1,2}$/,n=/^-?[0-9]{4}$/;d=void 0!==e&&void 0!==t&&n.test(e)&&a.test(t)?new Date(e,t):new Date;var r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate()),l=d.getMonth(),o=d.getFullYear(),i=new Date(d.getFullYear(),d.getMonth(),1),c=new Date(d.getFullYear(),d.getMonth()+1,0),u=new Date(d.getFullYear(),d.getMonth(),1-i.getDay()),h=new Date(d.getFullYear(),d.getMonth()+1,13-c.getDay()),v=function(){for(var e=[],t=6,a=0;t>a;a++){for(var n=[],d=new Date(u.getFullYear(),u.getMonth(),u.getDate()+7*a),r=0;7>r;r++){var s=new Date(d.getFullYear(),d.getMonth(),d.getDate()+r);n.push(s)}e.push(n)}return e},m=function(e,t){t(e)},p=function(e,t){void 0===t&&(t={});var r,a={months:t.months||["January","February","March","April","May","June","July","August","September","October","November","December"],weekDays:t.weekDays||["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],sendDateTo:t.sendDateTo,table:t.table||!1,hasButtons:t.hasButtons||!1,busyDaysEntry:t.busyDaysEntry||[]},n=function(a){e.innerHTML="",monthCalendarGen(o,l+a).constructSheet(e,t)};r="function"==typeof a.busyDaysEntry?a.busyDaysEntry(u,h):a.busyDaysEntry;var i=v(d),c=document.createElement(a.table?"table":"div");c.classList.add("month");var p=document.createElement(a.table?"thead":"div");p.classList.add("month-head");var y=document.createElement(a.table?"tbody":"div");y.classList.add("month-body");var f=document.createElement(a.table?"tr":"div");f.classList.add("month-head-line"),p.appendChild(f);var D=document.createElement(a.table?"th":"div");D.classList.add("button-before"),D.colSpan="1",a.hasButtons&&(D.onclick=function(){n(-1)});var b=document.createElement(a.table?"th":"div");b.classList.add("year-title"),b.colSpan="2";var g=document.createTextNode(o);b.appendChild(g);var C=document.createElement(a.table?"th":"div");C.colSpan="3",C.classList.add("month-title");var L=document.createTextNode(a.months[l]);C.appendChild(L);var w=document.createElement(a.table?"th":"div");w.classList.add("button-next"),w.colSpan="1",a.hasButtons&&(w.onclick=function(){n(1)}),f.appendChild(D),f.appendChild(b),f.appendChild(C),f.appendChild(w);var E=document.createElement(a.table?"tr":"div");E.classList.add("weekdays"),p.appendChild(E);for(var M=0;Ml?Y.classList.add("next-month"):Date.parse(i[F][S])==Date.parse(s)&&Y.classList.add("today"),Y.classList.add("day");var x=document.createTextNode(i[F][S].getDate());Y.dataset.date=Date.parse(i[F][S]),-1!=r.indexOf(parseInt(Y.dataset.date))&&Y.classList.add("busy-day"),a.sendDateTo&&(Y.onclick=function(){for(var e=document.getElementsByClassName("active-day"),t=0;t