	function showCalendar(y, m, day,base_url) {
	    var strYear = y.toString();
	    var strMonth = m;
	    if (m < 10) {
	    	strMonth = "0" + m.toString();
	    } else {
	    	strMonth = m.toString();
	    }
	    var textHead = "";
			textHead +='<span class="image" style="margin-left:34px;"><a href="javascript:showCalendar('+(m==1?(y-1)+','+12:y+','+(m-1))+',0,\''+base_url+'\')"><img src="/public/images/blog/skin1/icon_arrow2.gif"></a></span>';
			textHead +='<span class="text"><span class="link_orange font_bold">' + strYear + '.' + strMonth + '</span></span>';
			textHead +='<span class="image"><a href="javascript:showCalendar('+(m==12?(y+1)+','+1:y+','+(m+1))+',0,\''+base_url+'\')"><img src="/public/images/blog/skin1/icon_arrow3.gif"></a></span>';
	    var text = '';
	    var d1 = (y+(y-y%4)/4-(y-y%100)/100+(y-y%400)/400+m*2+(m*5-m*5%9)/9-(m<3?y%4||y%100==0&&y%400?2:3:4))%7;
	    var the_year,the_month,the_day,span_id;
	    for (i = 0; i < 42; i++) {
	        //if (i%7==0) text += '</tr>\n<tr>';
	        if (i < d1 || i >= d1+(m*9-m*9%8)/8%2+(m==2?y%4||y%100==0&&y%400?28:29:30)) {
	            text += '<span>&nbsp;</span>';
	        } else {
	        	the_year=y;
	        	the_month=m;
	        	the_day=i+1-d1;
	        	if ( the_month < 10 ) {	the_month="0"+the_month;  }
	        	if ( the_day < 10 ) { 	the_day="0"+the_day;  }
	        	target_day=the_year+"-"+the_month+"-"+the_day;
	        	span_id="cal_"+target_day;
	        	if (((i+2-d1)-day) == true) {
		        	//text += '<span><a href="javascript:goTimeline(' + y + ',' + m + ',' + (i+1-d1) + ')" class="link_yellow">' + (i+1-d1) + '</a></span>';
		        	text += '<span id="'+span_id+'"><a href="javascript:fnDateSearch(' + y + ',' + m + ',' + (i+1-d1) + ');" class="link_yellow">' + (i+1-d1) + '</a></span>';
	        	} else {
		        	//text += '<span><a href="javascript:goTimeline(' + y + ',' + m + ',' + (i+1-d1) + ')" class="' + (i%7 ? 'link_orange' : 'link_white"') + '">' + (i+1-d1) + '</a></span>';
		        	text += '<span id="'+span_id+'"><a href="javascript:fnDateSearch(' + y + ',' + m + ',' + (i+1-d1) + ');" class="' + (i%7 ? 'link_orange' : 'link_white"') + '">' + (i+1-d1) + '</a></span>';
	        	}	    
	        }
	    }
	    document.getElementById('calendarHeadDiv').innerHTML = textHead;
	    document.getElementById('calendarDiv').innerHTML = text;
	   	//########################################################
	   	var the_url;
			$(document).ready(function(){
	    	$.ajaxSetup({ cache: false });
	    	for (var j=1;j<=the_day;j++){
	    		if (j<10){j="0"+j;}
	    		target_day=target_day=the_year+"-"+the_month+"-"+j;
	    		the_url=base_url+target_day+".json?callback=?";
	    		$.getJSON(the_url, function(json) {
	    			//alert(json.target_day);
	    			//alert(json.post_count);
	    			if (json.post_count>0){
	    				$('#cal_'+json.target_day).attr('class','article');
	    			}
	    		});
	    	}	    	
			});
			//########################################################
	}

	function goTimeline(year, month, date) {
	    var strYear  = year.toString();
	    var strMonth = month;
	    var strDate  = date;

	    if (month < 10) {
	    	strMonth = "0" + month.toString();
	    } else {
	    	strMonth = month.toString();
	    }

	    if (date < 10) {
	    	strDate = "0" + date.toString();
	    } else {
	    	strDate = date.toString();
	    }

		location.href= "";
	}