   var http_request = false;
//   function changeCal(blogid, year, month){
//    send_calrequest('/ShowMeTheCalendar?blogid='+blogid+'&year='+year+'&month='+month);
//    return true;
//   } 
 function changeCal(blogid, year, month){
 	var s=document.createElement('SCRIPT');
	s.id = "cgi_calendar";
	s.src='http://rblog.china.com/ShowMeTheCalendar?blogid='+blogid+'&year='+year+'&month='+month;
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	return false;
 } 
function setCalContent(v)
{
	document.getElementsByTagName("HEAD")[0].removeChild(document.getElementById("cgi_calendar"));
	var dv = document.getElementById("show_hide12");
	dv.innerHTML = v; 
}

   function send_calrequest(url) {//初始化、指定处理函数、发送请求的函数
		http_request = false;
		//开始初始化XMLHttpRequest对象
		if(window.XMLHttpRequest) { //Mozilla 浏览器
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {//设置MiME类别
				http_request.overrideMimeType("text/xml");
			}
		}
		else if (window.ActiveXObject) { // IE浏览器
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		if (!http_request) { // 异常，创建对象实例失败
			window.alert("不能创建XMLHttpRequest对象实例.");
			return false;
		}
		http_request.onreadystatechange = processCalRequest;
		// 确定发送请求的方式和URL以及是否同步执行下段代码
		http_request.open("GET", url, true);
		http_request.send(null);
	}
	// 处理返回信息的函数
    function processCalRequest() {
    	if (http_request.readyState == 5){
    		alert("error 5");
    	}
        if (http_request.readyState == 4) { // 判断对象状态
            if (http_request.status == 200) { // 信息已经成功返回，开始处理信息
               processCalendar();
            }else{ //页面不正常
                alert("您所请求的页面有异常。");
            }
        }
    }
    
   function processCalendar(){
      var xmlobj=http_request.responseXML;
	  var calendar=xmlobj.getElementsByTagName("calendar");
	  var mdiv = document.getElementById("show_hide12");
	  var feedbackStr = "";
	  var year = calendar[0].getElementsByTagName("year")[0].firstChild.data;
	  var month = calendar[0].getElementsByTagName("month")[0].firstChild.data;
	  var preYear = calendar[0].getElementsByTagName("preYear")[0].firstChild.data;
	  var nextYear = calendar[0].getElementsByTagName("nextYear")[0].firstChild.data;
	  var preMonth = calendar[0].getElementsByTagName("preMonth")[0].firstChild.data;
	  var nextMonth = calendar[0].getElementsByTagName("nextMonth")[0].firstChild.data;
	  var blogid = calendar[0].getElementsByTagName("blogid")[0].firstChild.data;
	  var week = xmlobj.getElementsByTagName("wwww");
	  
	  feedbackStr += "<div class=\"calendar\"><div class=\"bor\">" +
                "<table width=\"155\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>&nbsp;</td></tr><tr><td class=\"year\">" +
                "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"cal_last\">" +
                "<a href=\"javascript:;\" onclick=\"return changeCal(" + blogid + ", " + preYear + ", " + preMonth + ");\">" +
                "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" /></a>" +
                "</td><td>" + year + "年" + month + "月</td><td class=\"cal_next\">" +
                "<a href=\"javascript:;\" onclick=\"return changeCal(" + blogid + ", " + nextYear + ", " + nextMonth + ");\">" +
                "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" /></a>" +
                "</td></tr></table></td></tr><tr><td class=\"week\">" +
                "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" width=\"1\" height=\"1\" /></td></tr>" +
                "<tr><td class=\"day\">" +
                "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";

	  for(var i = 0;i < week.length;i++){
	      var days = week[i].getElementsByTagName("dddd");
	      feedbackStr += "<tr>";
	      for(var j = 0;j < 7;j++){
	      	  if(days[j].firstChild.data == "0"){
	      	      feedbackStr += "<td>&nbsp;</td>";
	      	  }else{
	      	      if(days[j].getAttribute("year") != null){
                      var aaa = "/year=" + days[j].getAttribute("year") + "&month=" + days[j].getAttribute("month");
	      	          aaa = aaa + "&day=" + days[j].getAttribute("day") + "&blogid=" + blogid;
	      	          var bbb = '<a href="javascript:;" onclick="return changeThreadC(' + blogid + ',' + year + ',' + month + ',' + days[j].getAttribute("day") + ');">';
	      	          feedbackStr += "<td>" + bbb + days[j].firstChild.data + "</a></td>";
	      	      }
	      	      else{
	          	      feedbackStr += "<td>" + days[j].firstChild.data + "</td>";
	          	  }
	          }
	      }
	      feedbackStr += "</tr>";
	  }

      feedbackStr += "</tr></table></td></tr><tr><td>&nbsp;</td></tr></table></div></div>";

      mdiv.innerHTML=feedbackStr;
   }
