///////////////////////////////////////////////////
// script by Daniel Lemire with some bits from   //
// all over the web                              //
// http://www.daniel-lemire.com/                 // 
///////////////////////////////////////////////////
 
function displayRSS(URI, anzahl) {
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(anzahl);
  }
 }
 xmlhttp.send(null);


	function formatRSS(anzahl) {
		var items_count=items.getElementsByTagName('item').length;
		if (anzahl<items_count) items_count = anzahl;
		
		link=new Array(), title=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(title.length==0) return false;
		h2=document.createElement("h2");
		h2.appendChild(document.createTextNode(xmlDoc.getElementsByTagName('title')[0].firstChild.nodeValue));
		mydiv.appendChild(h2);
		var ws=/\S/;
		ul = document.createElement("ul");
		mydiv.appendChild(ul);
		for(var i=0; i<items_count; i++) {
			var title_w, link_w;
			title_w=(title.length>0)?title[i].firstChild.nodeValue:"<i>Untitled</i>";
			link_w=(link.length>0)?link[i].firstChild.nodeValue:"";
			litag = document.createElement("li");
                        linktag =document.createElement("a");
			linktag.setAttribute("href",link_w);
			linktag.appendChild(document.createTextNode(title_w));
			
			litag.appendChild(linktag);
			ul.appendChild(litag);
		}
		fixHeight();
	}
}


