document.write('<style type="text/css">.container.newsfeed,.container.gereports-newsfeed{background:transparent url('+GE_baselink+'html_view/images/small-loader.gif) no-repeat 50% 100%; padding-bottom:32px;</style>');

GE_Main.addInitFn( function() {

/*
// notice the use of a proxy to circumvent the Same Origin Policy.
var url = GE_baselink + 'html_view/jsp/request_proxy.jsp?url=' + encodeURIComponent('http://genewscenter.com/rss/default.aspx?feedid={E05B7BCC-AA48-48E2-B4AB-2C2A8F98619B}');

*/
if (GE_currentPath == '/news/olympic_games/index.html') {
	var max=5;
	var url = GE_baselink + 'html_view/jsp/request_proxy.jsp?url=' + encodeURIComponent('http://www.genewscenter.com/rss/default.aspx?feedid={1AFFE82B-5B4E-4CD2-BD36-D0F905791DE0}');
} else {
	var max=5;
	var url = GE_baselink + 'html_view/jsp/request_proxy.jsp?url=' + encodeURIComponent('http://www.businesswire.com/portal/site/ge/index.jsp?epi-content=GENERIC&epi-process=generic.jsp&beanStrID=bwrss&viewID=headline_list_rss&rss=G1QFDERJXkJeFF9UWQ==');
}


new Ajax.Request( url, {
  method: 'get',
  onSuccess: function(transport) {
	var xml = transport.responseXML;

	if (xml) {
		var ulEl = new Element('ul',{className:'list'});
		$$('.container.newsfeed')[0].setStyle({background:'transparent',paddingBottom:'0px'}).insert( ulEl );
		var items = xml.getElementsByTagName("item");
		var end = Math.min(items.length,max);

		for (var i=0; i<end; i++) {
			var item = items[i];
			
			var title = item.getElementsByTagName("title")[0].firstChild.nodeValue;
			var pubDate = item.getElementsByTagName("pubDate")[0].firstChild.nodeValue;
			pubDate = pubDate.substring(0,pubDate.length-12).replace(' 0',' ');
			var feedLink = item.getElementsByTagName("link")[0].firstChild.nodeValue;

			var aEl = new Element('a',{href:feedLink,title:title}).insert(title);
			var liEl = new Element("li", {className:"list_item"});
			liEl.insert( new Element('span',{className:'note'}).insert(pubDate) );
			liEl.insert( new Element('p').insert( aEl ) );

			if (GE_currentPath != '/news/olympic_games/index.html') {
				aEl.observe('click',function(e){
					e.stop();
					window.open(this.readAttribute('href'), 'press_release','height=480px,width=640px,menubar=0,scrollbars=1,titlebar=0,resizable=1,toolbar=0,location=0,status=0,directories=0');
				}.bind(aEl));
			}

			ulEl.appendChild( liEl );

		}

	}
  }
});

});

GE_Main.mapCSSToFn('gereports-newsfeed',function(el){
	var max=5;
	var url = GE_baselink + 'html_view/jsp/request_proxy.jsp?url=' + encodeURIComponent('http://www.gereports.com/feed');
	new Ajax.Request( url, {
	  method: 'get',
	  onSuccess: function(transport) {
		var xml = transport.responseXML;
		if (xml) {
			var ulEl = new Element('ul',{className:'list'});
			$(el).setStyle({background:'transparent',paddingBottom:'0px'}).insert( ulEl );
			var items = xml.getElementsByTagName("item");
			var end = Math.min(items.length,max);
			for (var i=0; i<end; i++) {
				var item = items[i];
				var title = item.getElementsByTagName("title")[0].firstChild.nodeValue;
				var pubDate = item.getElementsByTagName("pubDate")[0].firstChild.nodeValue;
				pubDate = pubDate.substring(0,pubDate.length-15).replace(' 0',' ');
				var feedLink = item.getElementsByTagName("link")[0].firstChild.nodeValue;
				var aEl = new Element('a',{href:feedLink,title:title}).insert(title);
				var liEl = new Element("li", {className:"list_item"});
				liEl.insert( new Element('span',{className:'note'}).insert(pubDate) );
				liEl.insert( new Element('p').insert( aEl ) );
				aEl.observe('click',function(e){
					e.stop();
					window.open(this.readAttribute('href'), 'ge_reports','');
				}.bind(aEl));
				ulEl.appendChild( liEl );
			}
		}
	  }
	});
});
