///////////////////////////////////////////////////
// script by Daniel Lemire with some bits from   //
// all over the web                              //
// http://www.daniel-lemire.com/                 // 
///////////////////////////////////////////////////
 
function displayRSS(URI) {
var xmlhttp=false;
var mydiv = document.getElementById("rss");
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
xmlhttp.open("GET", URI,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
  xmlDoc=xmlhttp.responseXML;
  items=xmlDoc;
  formatRSS();
  }
 }
 xmlhttp.send(null);


	function formatRSS() {
		var items_count=3;
		link=new Array(), title=new Array(), pubDate=new Array()
		for(var i=0; i<items_count; i++) {
			if(items.getElementsByTagName('item')[i].getElementsByTagName('link').length==1)
				link[i]=items.getElementsByTagName('item')[i].getElementsByTagName('link')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('title').length==1)
				title[i]=items.getElementsByTagName('item')[i].getElementsByTagName('title')[0];
			if(items.getElementsByTagName('item')[i].getElementsByTagName('pubDate').length==1)
				pubDate[i]=getDateFormat(items.getElementsByTagName('item')[i].getElementsByTagName('pubDate')[0].firstChild.nodeValue);
		}
		if(title.length==0) return false;
		var ws=/\S/;
		ul = document.createElement("ul");
		mydiv.appendChild(ul);
		for(var i=0; i<items_count; i++) {
			var title_w, link_w, pubDate_w;
			title_w=(title.length>0)?title[i].firstChild.nodeValue:"<i>Untitled</i>";
			link_w=(link.length>0)?link[i].firstChild.nodeValue:"";
			pubDate_w=pubDate[i];
			 	
			
			litag = document.createElement("li");
                        linktag =document.createElement("a");
			linktag.setAttribute("href",link_w);
			linktag.appendChild(document.createTextNode(title_w + " (" + pubDate_w + ")"));
			
			litag.appendChild(linktag);
			ul.appendChild(litag);
		}
	}
	
	function getDateFormat(myData) {
	da = new Date(myData) // create a date object set to the RSS pubDate
	db = da.toGMTString() // convert to a string
	dc = db.split(" ") // split the string on spaces
	// Wed 19 Jan 2007 01:30:00 -0700
	// [0] Day of week
	// [1] Date
	// [2] Month
	// [3] Year
	// [4] Time
	// [5] GMT zone
	dd = dc[1] + "." + dc[2] + "." + dc[3]; // format date
	return dd;
       }
}


