var XML_Http_Request = false;
 
function createXMLHttpRequest(){
    XML_Http_Request = false;
    
    if(window.XMLHttpRequest){        //for Mozilla
        XML_Http_Request = new XMLHttpRequest();
        if(XML_Http_Request.overrideMimeType){
            XML_Http_Request.overrideMimeType("text/xml");
        }
    }
    else if(window.ActiveXObject){   //for IE
        try{
            XML_Http_Request = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                XML_Http_Request = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){}
        }
    }
}    
 
function send_Request(url){
/*The function send_request has some other parameters.
function send_request(url,Parameter1,Parameter2,...,Parametern){
*/
	url = "AJAXProxy.asp?RSS_URL=http://feynet.spaces.live.com/feed.rss";
    createXMLHttpRequest();
 
    if(!XML_Http_Request){
        window.alert("Cannot create XMLHttpRequest instance!");
        return false;
    }
    
    XML_Http_Request.onreadystatechange = processRequest;
    /*The function processRequest has some parameters.
    XML_Http_Request.onreadystatechange = function(){
        processRequest(Parameter1,Parameter2,...,Parametern);
    };
    */
    
    XML_Http_Request.open("GET",url,true);   //true---异步;false---同步
    XML_Http_Request.send(null);
}

function categoryURL(category){
	var URL;
	var category;
　　switch(category){
　　　　case "心情":
　　　　　　URL = "http://feynet.spaces.live.com/?_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=cat%3d%25e5%25bf%2583%25e6%2583%2585" ;
　　　　　　break; 
　　　　case "用视觉纪录心情":
　　　　　　URL = "http://feynet.spaces.live.com/?_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=cat%3d%25e7%2594%25a8%25e8%25a7%2586%25e8%25a7%2589%25e7%25ba%25aa%25e5%25bd%2595%25e5%25bf%2583%25e6%2583%2585" ;
　　　　　　break;
　　　　case "网摘":
　　　　　　URL = "http://feynet.spaces.live.com/?_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=cat%3d%25e7%25bd%2591%25e6%2591%2598" ;
　　　　　　break; 
　　　　case "图书":
　　　　　　URL = "http://feynet.spaces.live.com/?_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=cat%3d%25e5%259b%25be%25e4%25b9%25a6" ;
　　　　　　break; 
　　　　case "娱乐":
　　　　　　URL = "http://feynet.spaces.live.com/?_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=cat%3d%25e5%25a8%25b1%25e4%25b9%2590" ;
　　　　　　break; 
　　　　case "My MSN Space":
　　　　　　URL = "http://feynet.spaces.live.com/?_c11_BlogPart_blogpart=blogview&_c=BlogPart&partqs=cat%3dMy%2b%2bMSN%2b%2bSpace" ;
　　　　　　break;
　　　　case "未分类":
　　　　　　URL = "http://feynet.spaces.live.com/blog/" ;
　　　　　　break; 

　　　　default:
　　　　　　URL = "http://feynet.spaces.live.com/blog/" ;
　　　　　　break;

　　}	
return URL;
}

function processRequest(){
/*The function processRequest has some parameters.
function processRequest(Parameter1,Parameter2,...,Parametern){
*/
    if(XML_Http_Request.readyState == 4) {
        if(XML_Http_Request.status == 200) {  
/*******************************************************************************/
            //statements  
            var results = XML_Http_Request.responseXML;
            var title = null;
            var item = null;
            var link = null;
			var pubDate = null;
            var description = null;
			var comments = null;
			var pubTime = null;
			var category="未分类";
            var ccc = results.getElementsByTagName("channel");
            var headtitle = ccc[0].getElementsByTagName("title")[0].firstChild.nodeValue;
            var headlink = ccc[0].getElementsByTagName("link")[0].firstChild.nodeValue;
            var cell = document.createElement("div");
            cell.innerHTML = "<iframe src=javascript:false style='position:absolute; visibility:inherit; top:0px; left:0px; width:0px; height:0px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';></iframe><div class=blogtitle><a href="+headlink+" target=_blank title=为便于浏览，您现在看到的是简化的Blog>点这里浏览完整博客</a><br><a href=http://feynet.spaces.live.com/ target=_blank> " + headtitle + "</a></div><br>";
            document.getElementById("result").appendChild(cell);
            var items = results.getElementsByTagName("item");
            for(var i = 0; i < 15; i++) {
                item = items[i];
                link=item.getElementsByTagName("link")[0].firstChild.nodeValue;
                title = item.getElementsByTagName("title")[0].firstChild.nodeValue;
				description = item.getElementsByTagName("description")[0].firstChild.nodeValue;
				pubDate = item.getElementsByTagName("dcterms:modified")[0].firstChild.nodeValue;
				pubDate=pubDate.replace(/T.*Z/g," ");
				//pubTime = item.getElementsByTagName("dcterms:modified")[0].firstChild.nodeValue;
				pubTime = item.getElementsByTagName("pubDate")[0].firstChild.nodeValue;
				//var a =new Date(pubTime);
				//a= pubTime;
				comments = item.getElementsByTagName("comments")[0].firstChild.nodeValue;
				if(item.childNodes(3).nodeName == "category") {
				category = item.getElementsByTagName("category")[0].firstChild.nodeValue;
				}
                var cell = document.createElement("div");
                cell.innerHTML = "<div id=mytitle><a href="+link+" target=_blank><b>&nbsp;&nbsp;"+title+"&nbsp;&nbsp;</b></a><div class=date style=text-align:right;><b>&nbsp;&nbsp;" + pubDate + " </b></div></div><br><div class=description><div class=descriptions>" + description + "</div><div class=mytitle_b><a href="+link+" target=_blank>浏览全文</a>&nbsp;&nbsp;&nbsp;<a href=/?i=book target=_blank>留言给我</a> &nbsp;&nbsp;&nbsp;<a href=" + comments + " target=_blank>评论本文(需要Windows Live ID)</a> &nbsp;&nbsp;&nbsp;分类：<a href="+ categoryURL(category) +" target=_blank>" + category + "</a><div class=date><table width=100%><tr><td width=90%><div class=date><!--" + pubTime + "--> </div> </td><td width=8% align=center><a href=http://feynet.spaces.live.com/feed.rss target=_blank title=订阅本博客RSS><img src=index_images/synd.gif border=0></a></td></tr></table></div> <br><br></div>";
                  document.getElementById("result").appendChild(cell);
				  document.all["result"].style.width = 625;

            }
/*******************************************************************************/
        }

    }
    if(XML_Http_Request.readyState == 4) {
        if(XML_Http_Request.status == 200) {  
		document.getElementById("myloading").innerHTML = "";
		}}
	initLightbox();
}