function RssViewer()
{
	this.Width;
	this.Height;
	this.FeedSource;
	this.HTMLTemplate;

	this.show = function()
	{
		if (!this.IsPostBack){
			var buff = "";
			buff += '<div id="'+this.ContainerName+'rssTitleTemplate"></div>';
			buff += '<div id="'+this.ContainerName+'rssBodyTemplate">	<table>';
			buff += '<tr><td class="rssTitle">(::Title::)</td></tr>';
			buff += '<tr><td class="rssDescription">(::Description::)<br/><a  class="rssLink" target=_blank href="(::Link::)">More...</a></td></tr>';
			buff += '<tr><td height="15px"></td></tr>';
			buff += '</table></div>';
			this.HTMLTemplate = buff.toString();
			this.ReadRSS(this.FeedSource,this.ContainerName+'rssBodyTemplate',this.ContainerName+'rssTitleTemplate');
		}
	}

	this.Replace = function(totalValue,oldValue,newValue)
	{
		while(totalValue.indexOf(oldValue) > -1)
			totalValue=totalValue.replace(oldValue,newValue);
				return totalValue;
	}
	this.getNode = function (TagName, node)
	{
		var currentNode = (node == null) ? xmlDoc.getElementsByTagName(TagName) : 
						items[node].getElementsByTagName(TagName);
		if(currentNode.length > 0)
			return currentNode[0].firstChild.nodeValue;
	}
	this.ReadRSS = function (rssFeed, Body, Title) 
	{
		try
	{
		req = gx.http.getRequest();
		req.open("GET",rssFeed,false);
		req.send(null);
		xmlDoc = req.responseXML.documentElement;
		
		items=xmlDoc.getElementsByTagName('item');
		this.SetRSSTemplates();
		}catch(e)
		{}
	}
	this.SetRSSTemplates = function() {
	    if (this.HTMLTemplate) {
	        var buffer = "";
	        for (var i = 0; i < items.length; i++) {

	            var output = this.Replace(this.HTMLTemplate, "(::Link::)", this.getNode('link', i));
	            output = this.Replace(output, "(::Title::)", this.getNode('title', i));
	            output = this.Replace(output, "(::Pubdate::)", this.getNode('pubDate', i));
	            output = this.Replace(output, "(::Description::)", this.getNode('description', i));
	            buffer += output;
	        }

	        document.getElementById(this.ContainerName).innerHTML = buffer.toString();
	    }

	}
}

