var blogentry = new Array(); var curmonth="7"; var curyear="2008"; var months=new Array(); months[1]=new Array("Janvier", "31"); months[2]=new Array("F\351vrier"); months[3]=new Array("Mars", "31"); months[4]=new Array("Avril", "30"); months[5]=new Array("Mai", "31"); months[6]=new Array("Juin", "30"); months[7]=new Array("Juillet", "31"); months[8]=new Array("Ao\373t", "31"); months[9]=new Array("Septembre", "30"); months[10]=new Array("Octobre", "31"); months[11]=new Array("Novembre", "30"); months[12]=new Array("D\351cembre", "31"); var nbdays=31; function changeMonth(action) { with (document) { if (action == "next") { for (i = 28; i < 43; i++) { var dayval = getElementById("cal"+i); if (dayval.hasChildNodes()) { if (dayval.childNodes[0].data == nbdays) {daystart = i + 1; break;} } } while (daystart > 7) { daystart = daystart-7; } curmonth++; if (curmonth == 13) {curmonth = 1; curyear++;} if (curmonth == 2) { if ((curyear % 4 == 0) && ((!(curyear % 100 == 0)) || (curyear % 400 == 0))) {nbdays = 29;} else {nbdays = 28;} } else {nbdays = months[curmonth][1];} } else { curmonth--; if (curmonth == 0) {curmonth=12; curyear--;} for (i = 1; i < 8; i++) { var dayval = getElementById("cal"+i); if (dayval.hasChildNodes()) { if (dayval.childNodes[0].data == "1" || dayval.childNodes[0].nodeName == "A") {daystart = i - 1; break;} } } if (daystart == 0) daystart = 7; if (curmonth == 2) { if ((curyear % 4 == 0) && ((!(curyear % 100 == 0)) || (curyear % 400 == 0))) {nbdays = 29;} else {nbdays = 28;} } else {nbdays = months[curmonth][1];} days = nbdays; while (days > 1) { daystart--; if (daystart == 0) daystart = 7; days--; } } var http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}} } if (!http_request) { alert("XMLHTTP impossible ! Veuillez utiliser un autre navigateur."); return false; } var url = 'get_entries.php?y='+curyear+'&m='+curmonth; http_request.onreadystatechange = function() {getEntries(http_request);}; http_request.open('GET', url, true); http_request.send(null); } } function getEntries(http_request) { if (http_request.readyState == 4) { if (http_request.status == 200) { blogentry = new Array(); if (http_request.responseText != "") { blogentry = http_request.responseText.split('|'); } with (document) { var caltit = getElementById("calpage"); while (caltit.hasChildNodes()) { caltit.removeChild(caltit.firstChild); } var boldtext = createElement("a"); var newcaltit = createTextNode(months[curmonth][0]+" "+curyear); boldtext.appendChild(newcaltit); var newcaltiturl = ""+curyear+"/"; if (curmonth < 10) newcaltiturl += "0"; newcaltiturl += curmonth+"/"; boldtext.setAttribute("class","caltitle"); boldtext.setAttribute("href",newcaltiturl); caltit.appendChild(boldtext); for (i = 1; i < 43; i++) { var rmday = getElementById("cal"+i); while (rmday.hasChildNodes()) { rmday.removeChild(rmday.firstChild); } rmday.className = 'emptytd'; } for (i = 1; i <= nbdays; i++) { var newday = getElementById("cal"+daystart); var dayfound = 0; for (j = 0; j < blogentry.length; j = j + 2) { if (blogentry[j] == i) { var newlink = createElement("a"); var daytn = createTextNode(i); newlink.appendChild(daytn); if (blogentry[j].length == 1) {var curday = "0"+ blogentry[j];} else {var curday = blogentry[j];} var newurl = ""+curyear+"/"; if (curmonth < 10) newurl += "0"; newurl += curmonth+"/"+curday+"/"; newlink.setAttribute("href",newurl); newlink.setAttribute("class","callink"); newlink.setAttribute("onmouseover","showBubble('"+blogentry[j+1]+"');"); newlink.setAttribute("onmouseout","hideBubble();"); newday.appendChild(newlink); dayfound = 1; break; } } if (dayfound == 0) { var daytn = createTextNode(i); newday.appendChild(daytn); } if (curyear == 2008 && curmonth == 7 && i == 24) {newday.className='caltoday';} else {newday.className='caltd';} daystart++; } } } } }