var nCurrentYear = 0; var nCurrentMonth = 0; var WEEK_START = 1; var nFirstYear = nCurrentYear; var nFirstMonth = nCurrentMonth; var podInYear = new Array(); var arrayAsAString = '2018=322,323,325,326,327,328,329,332,333,334,336,337,342,344,347,348,349,350,355,361,362,365|2019=12,19,20,33,38,89,109,128,181'; podInYear = arrayAsAString.split("|"); function kalendarNad(day,month,year){ var sel_datumPodE = day + '.' + month + '.' + year; //alert(sel_datumPodE); getDateAJAX(sel_datumPodE) ; } function skryKalendar(){ var targetDiv = document.getElementById("targetDivKalendar"); targetDiv.innerHTML = "
"; targetDiv.style.display = "none"; document.body.style.cursor=''; } function getDayName(i) { var skDay = new Array("", "", "", "", "", "", ""); return skDay[i]; } function getDayOfMonth() { var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31); if ((((nCurrentYear % 4 == 0) && (nCurrentYear % 100 != 0)) || (nCurrentYear % 400 == 0)) && nCurrentMonth == 2) { return 29; } return monthLength[nCurrentMonth-1]; } function getDayOfYear() { if ((((nCurrentYear % 4 == 0) && (nCurrentYear % 100 != 0)) || (nCurrentYear % 400 == 0))) { var dayOfYear = new Array(0,31,60,91,121,152,182,213,244,274,305,335); } else { var dayOfYear = new Array(0,31,59,90,120,151,181,212,243,273,304,334); } return dayOfYear[nCurrentMonth-1]; } function isPod(day) { var arActYear = new Array(); for(var i=0; i 12) { nCurrentMonth -= 12; nextYear(); } } function prevYear() { nCurrentYear--; } function nextYear() { nCurrentYear++; } function clickCalendar(day, month, year) { var sel_datumPodE = day + '.' + month + '.' + year; window.location.href = '/search_datum.asp?sel_datumPodE=' + sel_datumPodE; } function genCalendars(id, change) { var strHTML = ""; var dt = new Date(); if (dt.getYear()<1000) dt.setYear(dt.getYear()+1900); dt.setDate(1); strHTML += ""; } strHTML += "
"; if (change && new Date(nCurrentYear, nCurrentMonth-1, 1) > dt) { strHTML += "" } //else alert('e-e'); strHTML += "" if (change) { strHTML += "
"; strHTML += "
"; strHTML += ""; for(var i=0; i <=6; i++) { strHTML += ""; } strHTML += "
" + getDayName(i) + "
"; strHTML += ""; var ciselko = new Date(nCurrentYear, nCurrentMonth-1, 1).getDay(); if(ciselko == 0) { ciselko = 7; } var index = 1 + WEEK_START - ciselko; var numDays = getDayOfMonth(); var dayInYear = getDayOfYear(); while(index <= numDays) { strHTML += ""; for(var i=1; i<=7; i++) { if(index <= numDays && index > 0) { dayInYear ++; if(isPod(dayInYear)) { if(i==6 || i==7) { if (change){ strHTML += ""; } else { strHTML += ""; } } else { if (change){ strHTML += ""; } else { strHTML += ""; } } } else if(i==6 || i==7) { strHTML += ""; } else { strHTML += ""; } } else { strHTML += ""; } index++; //strHTML += ""; } } strHTML += "" strHTML += "
"; strHTML += "" + index + "" + index + ""; strHTML += "" + index + "" + index + "" + index + "" + index + "
" return strHTML; } function setCurrentMonth() { var dt = new Date(); curYear=dt.getYear() if (curYear < 1000) curYear+=1900 nCurrentYear = curYear; nCurrentMonth = dt.getMonth()+1; } function goNextMonth(id, change) { var strHTML = ""; nextMonth(1); strHTML += genCalendars(id, change); document.getElementById(id).innerHTML = strHTML; } function goPrevMonth(id, change) { var strHTML = ""; prevMonth(1); strHTML += genCalendars(id, change); document.getElementById(id).innerHTML = strHTML; } function startCalendar(id, change) { setCurrentMonth(); var strHTML = ""; strHTML += genCalendars(id, change); document.getElementById(id).innerHTML = strHTML; }