   var http_request = false;
   function changeLab(blogid, index, direction){
    send_labrequest('/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=label&direction=' + direction);
    return true;
   } 

   function send_labrequest(url) {
		http_request = false;
		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("cant create XMLHttpRequest.");
			return false;
		}
		http_request.onreadystatechange = processLabRequest;
		http_request.open("GET", url, true);
//		http_request.setRequestHeader( " Content-Type " , " application/x-www-form-urlencoded " );
		http_request.send(null);
	}

    function processLabRequest() {
//alert(http_request.responseText);
        if (http_request.readyState == 4) { 
            if (http_request.status == 200) { 
               processLabel();
            }else{ 
                alert("\u60a8\u6240\u8bf7\u6c42\u7684\u9875\u9762\u6709\u5f02\u5e38\u3002");
            }
        }
    }

   function processLabel(){
      var xmlobj=http_request.responseXML;
	  var label=xmlobj.getElementsByTagName("label");
	  var mdiv = document.getElementById("show_hide_content13");
	  var feedbackStr = "";
	  var blogid = label[0].getElementsByTagName("blogid")[0].firstChild.data;
	  var curindex = label[0].getElementsByTagName("curindex")[0].firstChild.data;
	  var lastindex = label[0].getElementsByTagName("lastindex")[0].firstChild.data;
	  var nextindex = label[0].getElementsByTagName("nextindex")[0].firstChild.data;
	  var title = label[0].getElementsByTagName("title")[0].firstChild.data;
	  var content = unescape(label[0].getElementsByTagName("content")[0].firstChild.data);
	  
	  var lastlink = "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" class=\"last\" />";
	  var nextlink = "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" class=\"next\" />";
	  if(lastindex != "-1"){
          lastlink = "<a href=\"javascript:;\" onclick=\"return changeLab(" + blogid + ", " + curindex + ", 'last');\">" + lastlink + "</a>";
	  }
	  if(nextindex != "-1"){
          nextlink = "<a href=\"javascript:;\" onclick=\"return changeLab(" + blogid + ", " + curindex + ", 'next');\">" + nextlink + "</a>";
	  }
	  
	  feedbackStr += "<div class=\"topic\">" + title + "</div>";
	  feedbackStr += "<div class=\"txt\">" + content + "</div>";
	  feedbackStr += "<div class=\"more\">" + lastlink + nextlink + "</div>";

      mdiv.innerHTML=feedbackStr;
   }

//   function changeBul(blogid, index, direction){
//    send_bulrequest('/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=bulletin&direction=' + direction);
//    return true;
//   } 
   function changeBul(blogid, index, direction){ 
  	var s=document.createElement('SCRIPT');
	s.id = "cgi_bul";
	s.src='http://rblog.china.com/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=bulletin&direction=' + direction; 
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	return false;
   }
   
    function setBulletinContent(v)
{
	document.getElementsByTagName("HEAD")[0].removeChild(document.getElementById("cgi_bul"));
	var dv = document.getElementById("show_hide_content04");
	dv.innerHTML = v; 
}

   function send_bulrequest(url) {
		http_request = false;
		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("cant create XMLHttpRequest.");
			return false;
		}
		http_request.onreadystatechange = processBulRequest;
		http_request.open("GET", url, true);
//		http_request.setRequestHeader( " Content-Type " , " application/x-www-form-urlencoded " ); 		
		http_request.send(null);
	}
    function processBulRequest() {
//alert(http_request.responseText);
        if (http_request.readyState == 4) { 
            if (http_request.status == 200) { 
               processBulletin();
            }else{ 
                alert("\u60a8\u6240\u8bf7\u6c42\u7684\u9875\u9762\u6709\u5f02\u5e38\u3002");
            }
        }
    }
    
   function processBulletin(){
      var xmlobj=http_request.responseXML;
	  var bulletin=xmlobj.getElementsByTagName("bulletin");
	  var mdiv = document.getElementById("show_hide_content04");
	  var feedbackStr = "";
	  var blogid = bulletin[0].getElementsByTagName("blogid")[0].firstChild.data;
	  var curindex = bulletin[0].getElementsByTagName("curindex")[0].firstChild.data;
	  var lastindex = bulletin[0].getElementsByTagName("lastindex")[0].firstChild.data;
	  var nextindex = bulletin[0].getElementsByTagName("nextindex")[0].firstChild.data;
	  var title = bulletin[0].getElementsByTagName("title")[0].firstChild.data;
	  var content = unescape(bulletin[0].getElementsByTagName("content")[0].firstChild.data);
	  
	  var lastlink = "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" class=\"last\" />";
	  var nextlink = "<img src=\"http://blog.china.com/skins/themes/default/images/spacer.gif\" class=\"next\" />";
	  if(lastindex != "-1"){
          lastlink = "<a href=\"javascript:;\" onclick=\"return changeBul(" + blogid + ", " + curindex + ", 'last');\">" + lastlink + "</a>";
	  }
	  if(nextindex != "-1"){
          nextlink = "<a href=\"javascript:;\" onclick=\"return changeBul(" + blogid + ", " + curindex + ", 'next');\">" + nextlink + "</a>";
	  }
	  
	  feedbackStr += "<div class=\"topic\">" + title + "</div>";
	  feedbackStr += "<div class=\"txt\">" + content + "</div>";
	  feedbackStr += "<div class=\"more\">" + lastlink + nextlink + "</div>";

      mdiv.innerHTML=feedbackStr;
   }

   //function changeThread(blogid, index){
   // send_threadrequest('/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=thread&direction=last');
   // return true;
   //}
   function changeThread(blogid, index){ 
  	var s=document.createElement('SCRIPT');
	s.id = "cgi_threadc";
	s.src='http://rblog.china.com/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=thread&direction=last'; 
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	return false;
   }
    
//  function changeIndexThread(blogid, index){
//    send_threadrequest('/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=index&direction=last');
//    return true;
//   } 
  function changeIndexThread(blogid, index){
   	var s=document.createElement('SCRIPT');
	s.id = "cgi_threadc";
	s.src='http://rblog.china.com/ScarboroughFair?blogid='+blogid+'&index='+index+'&part=index&direction=last'; 
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	return false;
   } 

//   function changeThreadC(blogid,year,month,day){
//   //  alert('/ScarboroughFair?blogid='+blogid+'&part=calendar&direction=last&year='+year+'&month='+month+'&day='+day);
//    send_threadrequest('/ScarboroughFair?blogid='+blogid+'&index=1&part=calendar&direction=last&year='+year+'&month='+month+'&day='+day);
//  
//    return true;
//   } 
 
  function changeThreadC(blogid, year, month,day){
 	var s=document.createElement('SCRIPT');
	s.id = "cgi_threadc";
	s.src='http://rblog.china.com/ScarboroughFair?blogid='+blogid+'&index=1&part=calendar&direction=last&year='+year+'&month='+month+'&day='+day; 
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	return false;
 }
 
 function setThreadCContent(v)
{
	document.getElementsByTagName("HEAD")[0].removeChild(document.getElementById("cgi_threadc"));
	var dv = document.getElementById("thread");
	dv.innerHTML = v; 
}
    
   function send_threadrequest(url) {
		http_request = false;
		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("cant create XMLHttpRequest.");
			return false;
		}
		http_request.onreadystatechange = processThreadRequest;
		http_request.open("GET", url, true);
//		http_request.setRequestHeader( " Content-Type " , " application/x-www-form-urlencoded " );
		http_request.send(null);
	}
    function processThreadRequest() {
//alert(http_request.responseText);
        if (http_request.readyState == 4) { 
            if (http_request.status == 200) { 
               processThread();
            }else{ 
                alert("\u60a8\u6240\u8bf7\u6c42\u7684\u9875\u9762\u6709\u5f02\u5e38\u3002");
            }
        }
        else{
        	document.getElementById("thread").innerHTML="<div class=\"gbook\"><div class=\"title\">\u6211\u7684\u6587\u7ae0</div><div align=\"center\">\u6570\u636e\u6b63\u5728\u52a0\u8f7d....</div></div>";
        }
    }
    
   function processThread(){
      var xmlobj=http_request.responseXML;
	  var thread=xmlobj.getElementsByTagName("thread");
	  var mdiv = document.getElementById("thread");
	  var content = unescape(thread[0].getElementsByTagName("content")[0].firstChild.data);
      mdiv.innerHTML=content;
   }
   
//  function showTypeThread(blogid, typeid, page){
//    send_threadrequest('/ScarboroughFair?part=type&direction=last&blogid='+blogid+'&typeid='+typeid+'&index='+page);
//    return true;
//   }  
function showTypeThread(blogid, typeid, page){
   	var s=document.createElement('SCRIPT');
	s.id = "cgi_threadc";
	s.src='http://rblog.china.com/ScarboroughFair?part=type&direction=last&blogid='+blogid+'&typeid='+typeid+'&index='+page; 
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	return false;
}

//    function showSerialList(blogid, serialid, page){
//    send_threadrequest('/ScarboroughFair?part=serial&direction=last&blogid='+blogid+'&serialid='+serialid+'&index='+page);
//    return true;
//   }  
    function showSerialList(blogid, serialid, page){
    var s=document.createElement('SCRIPT');
	s.id = "cgi_threadc";
	s.src='http://rblog.china.com/ScarboroughFair?part=serial&direction=last&blogid='+blogid+'&serialid='+serialid+'&index='+page; 
	document.getElementsByTagName("HEAD")[0].appendChild(s);
    return false;
   }  
