function dateChanged(calendar) { if (calendar.dateClicked) { var y = calendar.date.getFullYear(); var m = calendar.date.getMonth() + 1; var d = calendar.date.getDate(); var datum = y + "-" + m + "-" + d; $.ajax({ url: '/' + defaultlang + '/ajax/datelist/' + datum, type: 'GET', dataType: 'xml', timeout: 5000, error: function(){ alert('Error while loading the document!'); }, success: function(xml){ if ( $(xml).find("record").size() > 0 ) { $("#content").children("div").remove(); $("#content").append('
'); $(xml).find("record").each(function() { article_show('#content', $(this).attr("title"), $(this).attr("comment"), $(this).attr("link"), $(this).text() ); }); } } }); } } var dates=[]; function isDisabled(date) { var disabled=true; var dstr = (date.getMonth()+1) + "/" + date.getDate() + "/" + date.getFullYear(); for (var i=0; i< dates.length; i++) { if (dates[i]==dstr) { disabled=false; } } var date2=new Date(); var dstr2 = (date2.getMonth()+1) + "/" + date2.getDate() + "/" + date2.getFullYear(); if (dstr==dstr2) { disabled=false; } return disabled; } function showthecalendar() { var parent = document.getElementById("display"); var cal = new Calendar( 0, null, dateChanged ); cal.onSelected=dateChanged; cal.setDisabledHandler( isDisabled ); cal.weekNumbers = false; cal.setDateFormat("%A, %B %e"); cal.create(parent); cal.show(); } function showFlatCalendar() { $.ajax({ url: '/' + defaultlang + '/ajax/calendar.xml', type: 'GET', dataType: 'xml', timeout: 5000, error: function(){ showthecalendar() alert('Error while loading the calendar data!'); }, success: function(xml){ if ( $(xml).find("item").size() > 0 ) { $(xml).find("item").each(function() { dates.push( $(this).text() ); }); } showthecalendar() } }); }