function loadXMLs(str) 
	{
	try //Internet Explorer
	  {
	  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	  xmlDoc.async="false";
	  xmlDoc.loadXML(str);
	  return(xmlDoc); 
	  }
	catch(e)
	  {
	  try //Firefox, Mozilla, Opera, etc.
		{
		parser=new DOMParser();
		xmlDoc=parser.parseFromString(str,"text/xml");
		return(xmlDoc);
		}
	  catch(e) {alert(e.message)}
	  }
	return(null);
	}
xmlstr='<rss version="2.0"> <channel> <title>New Media Age - Breaking News</title> <link>http://www.nma.co.uk</link> <description>http://www.nma.co.uk</description> <image> <url>http://www.nma.co.uk/magazine/graphics/logo.png 					</url> <title></title> <link>http://www.nma.co.uk</link> </image> <item> <title> Blinkbox to stream movies to Samsung web-TVs</title> <link>http://www.nma.co.uk/news/-blinkbox-to-stream-movies-to-samsung-web-tvs/3017778.article</link> <guid isPermaLink="true">http://www.nma.co.uk/news/-blinkbox-to-stream-movies-to-samsung-web-tvs/3017778.article</guid> <description>Blinkbox is to launch its movie and TV on-demand streaming service on Samsung web-enabled TVs.</description> <pubDate>Thu, 2 Sep 2010 17:30 GMT</pubDate> </item> <item> <title>Sony to launch cloud-based content service Qriocity</title> <link>http://www.nma.co.uk/news/sony-to-launch-cloud-based-content-service-qriocity/3017744.article</link> <guid isPermaLink="true">http://www.nma.co.uk/news/sony-to-launch-cloud-based-content-service-qriocity/3017744.article</guid> <description>Sony is to take on Apple with the launch of a networked music, games and movie service across its TV, Blu-ray and music players in Europe.</description> <pubDate>Thu, 2 Sep 2010 11:09 GMT</pubDate> </item> <item> <title>Carat reshuffles senior management team</title> <link>http://www.nma.co.uk/news/carat-reshuffles-senior-management-team/3017753.article</link> <guid isPermaLink="true">http://www.nma.co.uk/news/carat-reshuffles-senior-management-team/3017753.article</guid> <description>Aegis-owned media agency Carat has appointed Tracy de Groose as MD, replacing Robert Horler.</description> <pubDate>Thu, 2 Sep 2010 11:05 GMT</pubDate> </item> <item> <title>ITV expands cross-platform offering for This Morning</title> <link>http://www.nma.co.uk/news/itv-expands-cross-platform-offering-for-this-morning/3017746.article</link> <guid isPermaLink="true">http://www.nma.co.uk/news/itv-expands-cross-platform-offering-for-this-morning/3017746.article</guid> <description>ITV is stepping up its cross-platform offering for daytime show This Morning with the launch of an interactive studio hub.</description> <pubDate>Thu, 2 Sep 2010 10:57 GMT</pubDate> </item> <item> <title>Virgin Media to publish typical broadband speeds</title> <link>http://www.nma.co.uk/news/virgin-media-to-publish-typical-broadband-speeds/3017745.article</link> <guid isPermaLink="true">http://www.nma.co.uk/news/virgin-media-to-publish-typical-broadband-speeds/3017745.article</guid> <description>93% of UK consumers want a change in how broadband speeds are advertised, according to an ICM survey commissioned by Virgin Media.</description> <pubDate>Thu, 2 Sep 2010 10:53 GMT</pubDate> </item> </channel> </rss> 	';
xmlDoc = loadXMLs(xmlstr);
var txt = '';
var txt = '';
items = xmlDoc.getElementsByTagName("item");
	for (i=0; i<4; i++) {
	
		var title="";
		var hlink="";
		var descr="";
		var pubdate="";
		var nma=""
date = items[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue;
	result = date.match(/\d{1,2}.*\d{4}/);
	date = result[0];
	date = date.replace(/ /g,"-");if (items[i].getElementsByTagName("title")[0].length != 0)
title = items[i].getElementsByTagName("title")[0].childNodes[0].nodeValue;
nma = title.substring(0, title.indexOf(":"));
title = title.substring(title.indexOf(":") + 1, title.length );
if (items[i].getElementsByTagName("link")[0].length != 0)
hlink = items[i].getElementsByTagName("link")[0].childNodes[0].nodeValue;
if (items[i].getElementsByTagName("description")[0].childNodes.length != 0)
descr = items[i].getElementsByTagName("description")[0].childNodes[0].nodeValue;
		//descr = descr.substring(0,10);
txt += '<li><h2 style="font-weight:normal;"><a href="'+ hlink +'">' + title + '</a></h2></li>';
txt += '<div style="clear:both;"></div>'
}
document.write (txt);
