var months = ["&#1032;&#1072;&#1085;&#1091;&#1072;&#1088;","&#1060;&#1077;&#1073;&#1088;&#1091;&#1072;&#1088;","&#1052;&#1072;&#1088;&#1090;","&#1040;&#1087;&#1088;&#1080;&#1083;","&#1052;&#1072;&#1112;","&#1032;&#1091;&#1085;","&#1032;&#1091;&#1083;","&#1040;&#1091;&#1075;&#1091;&#1089;&#1090;","&#1057;&#1077;&#1087;&#1090;&#1077;&#1084;&#1073;&#1072;&#1088;","&#1054;&#1082;&#1090;&#1086;&#1073;&#1072;&#1088;","&#1053;&#1086;&#1074;&#1077;&#1084;&#1073;&#1072;&#1088;","&#1044;&#1077;&#1094;&#1077;&#1084;&#1073;&#1072;&#1088;"];
var daycounts = [31,28,31,30,31,30,31,31,30,31,30,31]; //for leap years, remember to set february to 29 days
var firstdays = [4,0,0,3,5,1,3,6,2,4,0,2];

var now = new Date
var mm = now.getMonth()

var mesec = now.getMonth()
var dan = now.getDate()
var mes=mesec+1

var apps = [
[dan,mes,dan,mes,"&#1044;&#1072;&#1085;&#1072;&#1096;&#1114;&#1080; &#1044;&#1072;&#1085;"],
[7,1,7,1,"&#1056;&#1086;&#1078;&#1076;&#1077;&#1089;&#1090;&#1074;&#1086; &#1061;&#1088;&#1080;&#1089;&#1090;&#1086;&#1074;&#1086;, &#1041;&#1054;&#1046;&#1048;&#1035;"],
[8,1,8,1,"&#1057;&#1072;&#1073;&#1086;&#1088; &#1055;&#1088;&#1077;&#1089;&#1074;&#1077;&#1090;&#1077; &#1041;&#1086;&#1075;&#1086;&#1088;&#1086;&#1076;&#1080;&#1094;&#1077;"],
[9,1,9,1,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1087;&#1088;&#1074;&#1086;&#1084;&#1091;&#1095;&#1077;&#1085;&#1080;&#1082; &#1080; &#1072;&#1088;&#1093;&#1080;&#1106;&#1072;&#1082;&#1086;&#1085; &#1057;&#1058;&#1045;&#1060;&#1040;&#1053;"],
[14,1,14,1,"&#1054;&#1073;&#1088;&#1077;&#1079;&#1072;&#1114;&#1077; &#1043;&#1086;&#1089;&#1087;&#1086;&#1076;&#1114;&#1077;, &#1089;&#1074;&#1077;&#1090;&#1080; &#1042;&#1072;&#1089;&#1080;&#1083;&#1080;&#1112;&#1077; &#1042;&#1077;&#1083;&#1080;&#1082;&#1080;, &#1057;&#1088;&#1087;&#1089;&#1082;&#1072; &#1053;&#1086;&#1074;&#1072; &#1043;o&#1076;&#1080;&#1085;&#1072;"],
[19,1,19,1,"&#1041;&#1054;&#1043;&#1054;&#1032;&#1040;&#1042;&#1033;&#1040;&#1034;&#1045;"],
[20,1,20,1,"&#1057;&#1072;&#1073;&#1086;&#1088; &#1089;&#1074;&#1077;&#1090;&#1086;&#1075; &#1032;&#1086;&#1074;&#1072;&#1085;&#1072; &#1050;&#1088;&#1089;&#1090;&#1080;&#1090;&#1077;&#1113;&#1072;, &#1032;&#1054;&#1042;&#1040;&#1034;&#1044;&#1040;&#1053;"],
[27,1,27,1,"&#1057;&#1042;&#1045;&#1058;&#1048; &#1057;&#1040;&#1042;&#1040;, &#1087;&#1088;&#1074;&#1080; &#1072;&#1088;&#1093;&#1080;&#1077;&#1087;&#1080;&#1089;&#1082;&#1086;&#1087; &#1057;&#1088;&#1087;&#1089;&#1082;&#1080;"],
[12,2,12,2,"&#1057;&#1074;&#1077;&#1090;&#1072; &#1058;&#1088;&#1080; &#1032;&#1077;&#1088;&#1072;&#1088;&#1093;&#1072;"],
[15,2,15,2,"&#1057;&#1088;&#1077;&#1090;&#1077;&#1114;&#1077; &#1043;&#1086;&#1089;&#1087;&#1086;&#1076;&#1114;&#1077;"],
[22,3,22,3,"&#1057;&#1074;&#1077;&#1090;&#1080;&#1093; 40 &#1084;&#1091;&#1095;&#1077;&#1085;&#1080;&#1082;&#1072; &#1057;&#1077;&#1074;&#1072;&#1089;&#1090;&#1080;&#1112;&#1089;&#1082;&#1080;&#1093; - &#1052;&#1083;&#1072;&#1076;&#1077;&#1085;&#1094;&#1080;"],
[7,4,7,4,"&#1041;&#1083;&#1072;&#1075;&#1086;&#1074;&#1077;&#1089;&#1090;&#1080;"],
[12,4,12,4,"&#1059;&#1083;&#1072;&#1079;&#1072;&#1082; &#1043;&#1086;&#1089;&#1087;&#1086;&#1076;&#1072; &#1048;&#1089;&#1091;&#1089;&#1072; &#1061;&#1088;&#1080;&#1089;&#1090;&#1072; &#1091; &#1032;&#1077;&#1088;&#1091;&#1089;&#1072;&#1083;&#1080;&#1084; - &#1062;&#1074;&#1077;&#1090;&#1080;"],
[17,4,17,4,"&#1042;&#1077;&#1083;&#1080;&#1082;&#1080; &#1055;&#1077;&#1090;&#1072;&#1082;"],
[19,4,19,4,"&#1042;&#1072;&#1089;&#1082;&#1088;&#1089;&#1077;&#1114;&#1077; &#1043;&#1086;&#1089;&#1087;&#1086;&#1076;&#1072; &#1048;&#1089;&#1091;&#1089;&#1072; &#1061;&#1088;&#1080;&#1089;&#1090;&#1072; - &#1042;&#1072;&#1089;&#1082;&#1088;&#1089;"],
[20,4,20,4,"&#1042;&#1072;&#1089;&#1082;&#1088;&#1089;&#1085;&#1080; &#1087;&#1086;&#1085;&#1077;&#1076;&#1077;&#1113;&#1072;&#1082;"],
[21,4,21,4,"&#1042;&#1072;&#1089;&#1082;&#1088;&#1089;&#1085;&#1080; &#1091;&#1090;&#1086;&#1088;&#1072;&#1082;"],
[6,5,6,5,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1074;&#1077;&#1083;&#1080;&#1082;&#1086;&#1084;&#1091;&#1095;&#1077;&#1085;&#1080;&#1082; &#1043;&#1077;&#1086;&#1088;&#1075;&#1080;&#1112;&#1077; - &#1026;&#1091;&#1088;&#1106;&#1077;&#1074;&#1076;&#1072;&#1085;"],
[12,5,12,5,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1042;&#1072;&#1089;&#1080;&#1083;&#1080;&#1112;&#1077; &#1054;&#1089;&#1090;&#1088;&#1086;&#1096;&#1082;&#1080; &#1063;&#1091;&#1076;&#1086;&#1090;&#1074;&#1086;&#1088;&#1072;&#1094;"],
[24,5,24,5,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1035;&#1080;&#1088;&#1080;&#1083;&#1086; &#1080; &#1052;&#1077;&#1090;&#1086;&#1076;&#1080;&#1112;&#1077;"],
[28,5,28,5,"&#1042;&#1072;&#1079;&#1085;&#1077;&#1089;&#1077;&#1114;&#1077; &#1043;&#1086;&#1089;&#1087;&#1086;&#1076;&#1114;&#1077; - &#1057;&#1087;&#1072;&#1089;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[3,6,3,6,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1094;&#1072;&#1088; &#1050;&#1086;&#1085;&#1089;&#1090;&#1072;&#1085;&#1090;&#1080;&#1085; &#1080; &#1094;&#1072;&#1088;&#1080;&#1094;&#1072; &#1032;&#1077;&#1083;&#1077;&#1085;&#1072;"],
[7,6,7,6,"&#1057;&#1080;&#1083;&#1072;&#1079;&#1072;&#1082; &#1089;&#1074;&#1077;&#1090;&#1086;&#1075; &#1076;&#1091;&#1093;&#1072; &#1085;&#1072; &#1072;&#1087;&#1086;&#1089;&#1090;&#1086;&#1083;&#1077; - &#1055;&#1077;&#1076;&#1077;&#1089;&#1077;&#1090;&#1085;&#1080;&#1094;&#1072; - &#1058;&#1088;&#1086;&#1112;&#1080;&#1094;&#1077;"],
[8,6,8,6,"&#1044;&#1091;&#1093;&#1086;&#1074;&#1089;&#1082;&#1080; &#1087;&#1086;&#1085;&#1077;&#1076;&#1077;&#1113;&#1072;&#1082;"],
[9,6,9,6,"&#1044;&#1091;&#1093;&#1086;&#1074;&#1089;&#1082;&#1080; &#1091;&#1090;&#1086;&#1088;&#1072;&#1082;"],
[28,6,28,6,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1084;&#1091;&#1095;&#1077;&#1085;&#1080;&#1082; &#1082;&#1085;&#1077;&#1079; &#1051;&#1072;&#1079;&#1072;&#1088; &#1080; &#1089;&#1074;&#1077;&#1090;&#1080; &#1084;&#1091;&#1095;&#1077;&#1085;&#1080;&#1094;&#1080; &#1089;&#1088;&#1087;&#1089;&#1082;&#1080; - &#1042;&#1080;&#1076;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[7,7,7,7,"&#1056;&#1086;&#1106;&#1077;&#1114;&#1077; &#1057;&#1074;&#1077;&#1090;&#1086;&#1075; &#1032;&#1086;&#1074;&#1072;&#1085;&#1072; &#1055;&#1088;&#1077;&#1090;&#1077;&#1095;&#1077; - &#1048;&#1074;&#1072;&#1114;&#1076;&#1072;&#1085;"],
[12,7,12,7,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1040;&#1087;&#1086;&#1089;&#1090;&#1086;&#1083;&#1080; &#1055;&#1077;&#1090;&#1072;&#1088; &#1080; &#1055;&#1072;&#1074;&#1083;&#1077; - &#1055;&#1077;&#1090;&#1088;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[2,8,2,8,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1087;&#1088;&#1086;&#1088;&#1086;&#1082; &#1048;&#1083;&#1080;&#1112;&#1072; - &#1048;&#1083;&#1080;&#1085;&#1076;&#1072;&#1085;"],
[19,8,19,8,"&#1055;&#1088;&#1077;&#1086;&#1073;&#1088;&#1072;&#1078;&#1077;&#1114;&#1077; &#1043;&#1086;&#1089;&#1087;&#1086;&#1076;&#1114;&#1077;"],
[28,8,28,8,"&#1059;&#1089;&#1087;&#1077;&#1085;&#1080;&#1112;&#1077; &#1055;&#1088;&#1077;&#1089;&#1074;&#1077;&#1090;&#1077; &#1041;&#1086;&#1075;&#1086;&#1088;&#1086;&#1076;&#1080;&#1094;&#1077; - &#1042;&#1077;&#1083;&#1080;&#1082;&#1072; &#1043;&#1086;&#1089;&#1087;&#1086;&#1112;&#1080;&#1085;&#1072;"],
[11,9,11,9,"&#1059;&#1089;&#1077;&#1082;&#1086;&#1074;&#1072;&#1114;&#1077; &#1075;&#1083;&#1072;&#1074;&#1077; &#1057;&#1074;&#1077;&#1090;&#1086;&#1075; &#1032;&#1086;&#1074;&#1072;&#1085;&#1072; &#1050;&#1088;&#1089;&#1090;&#1080;&#1090;&#1077;&#1113;&#1072;"],
[21,9,21,9,"&#1056;&#1086;&#1106;&#1077;&#1114;&#1077; &#1055;&#1088;&#1077;&#1089;&#1074;&#1077;&#1090;&#1077; &#1041;&#1086;&#1075;&#1086;&#1088;&#1086;&#1076;&#1080;&#1094;&#1077; - &#1052;&#1072;&#1083;&#1072; &#1043;&#1086;&#1089;&#1087;&#1086;&#1112;&#1080;&#1085;&#1072;"],
[27,9,27,9,"&#1042;&#1086;&#1079;&#1076;&#1074;&#1080;&#1078;&#1077;&#1114;&#1077; &#1063;&#1072;&#1089;&#1085;&#1086;&#1075; &#1050;&#1088;&#1089;&#1090;&#1072; - &#1050;&#1088;&#1089;&#1090;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[27,10,27,10,"&#1055;&#1088;&#1077;&#1087;&#1086;&#1076;&#1086;&#1073;&#1085;&#1072; &#1084;&#1072;&#1090;&#1080; &#1055;&#1072;&#1088;&#1072;&#1089;&#1082;&#1077;&#1074;&#1072;, &#1057;&#1074;&#1077;&#1090;&#1072; &#1055;&#1077;&#1090;&#1082;&#1072; - &#1055;&#1077;&#1090;&#1082;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[31,10,31,10,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1055;&#1077;&#1090;&#1072;&#1088; &#1062;&#1077;&#1090;&#1080;&#1114;&#1089;&#1082;&#1080;"],
[8,11,8,11,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1074;&#1077;&#1083;&#1080;&#1082;&#1086;&#1084;&#1091;&#1095;&#1077;&#1085;&#1080;&#1082; &#1044;&#1080;&#1084;&#1080;&#1090;&#1088;&#1080;&#1112;&#1077; - &#1052;&#1080;&#1090;&#1088;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[21,11,21,11,"&#1057;&#1072;&#1073;&#1086;&#1088; &#1057;&#1074;&#1077;&#1090;&#1086;&#1075; &#1072;&#1088;&#1093;&#1072;&#1085;&#1106;&#1077;&#1083;&#1072; &#1052;&#1080;&#1093;&#1072;&#1080;&#1083;&#1072; &#1080; &#1086;&#1089;&#1090;&#1072;&#1083;&#1080;&#1093; &#1085;&#1077;&#1073;&#1077;&#1089;&#1082;&#1080;&#1093; &#1089;&#1080;&#1083;&#1072; &#1073;&#1077;&#1089;&#1090;&#1077;&#1083;&#1077;&#1089;&#1085;&#1080;&#1093; - &#1040;&#1088;&#1072;&#1085;&#1106;&#1077;&#1083;&#1086;&#1074;&#1076;&#1072;&#1085;"],
[4,12,4,12,"&#1042;&#1072;&#1074;&#1077;&#1076;&#1077;&#1114;&#1077; &#1055;&#1088;&#1077;&#1089;&#1074;&#1077;&#1090;&#1077; &#1041;&#1086;&#1075;&#1086;&#1088;&#1086;&#1076;&#1080;&#1094;&#1077;"],
[19,12,19,12,"&#1057;&#1074;&#1077;&#1090;&#1080; &#1053;&#1080;&#1082;&#1086;&#1083;&#1072;&#1112;, &#1040;&#1088;&#1093;&#1080;&#1077;&#1087;&#1080;&#1089;&#1082;&#1086;&#1087; &#1084;&#1080;&#1088;&#1083;&#1080;&#1082;&#1080;&#1112;&#1089;&#1082;&#1080; &#1063;&#1091;&#1076;&#1086;&#1090;&#1074;&#1086;&#1088;&#1072;&#1094; - &#1053;&#1080;&#1082;&#1086;&#1113;&#1076;&#1072;&#1085;"]
];

function CheckDate(month,dayno)
{
var retval = new String(dayno);
var m = month + 1;
for(var app = 0; app < apps.length; app++)
{
if(m == apps[app][1] ) //first month
{
if(apps[app][3] - apps[app][1] > 0)
{
if(dayno >= apps[app][0])
{
retval = "<div style='background-color:red;' title='" + apps[app][4] + "'>" + dayno + "</div>";
}
}
else
{
if(dayno >= apps[app][0] && dayno <= apps[app][2])
{
retval = "<div style='background-color:red;' title='" + apps[app][4] + "'>" + dayno + "</div>";
}
}
}
else if(m == apps[app][3]) // second month
{
if(dayno <= apps[app][2])
{
retval = "<div style='background-color:red;' title='" + apps[app][4] + "'>" + dayno + "</div>";
}
}
else if( m > apps[app][1] && m < apps[app][3] )
{
retval = "<div style='background-color:red;' title='" + apps[app][4] + "'>" + dayno + "</div>";
}


}
return retval;
}

function PrintMonth(month)
{
var done = false;
var day = 0;
document.write("<table style='font-weight:bold;background-color:rgb(221,255,255);color:rgb(0,0,0);font-size:10px;'><caption><b>" + months[month] + "</b></caption><thead>");
document.write("<th>Pon</th><th>Uto</th><th>Sre</th><th>&#268;et</th><th>Pet</th><th>Sub</th><th>Ned</th></thead>");
while(!done)
{
document.write("<tr>");
PrintWeek(month,day, firstdays[month], daycounts[month]);
document.write("</tr>");
day = day + 7;
if( day > daycounts[month] + firstdays[month])
{
done = true;
}
}
document.write("</tbody></table><br>");
}
function PrintWeek(monthno,start,min,max)
{
var d;
var desc;
for(var j = 0; j < 7; j++)
{
document.write("<td>");
d = start + j;
if(d >= min && d < max + min)
{
desc = CheckDate(monthno,d - min + 1);
document.write(desc);
}
document.write("</td>");
}
}
