/**
 * Formats the rss data into html that can be easily styled.
 * @param strTitle
 * @param strLink
 * @param strBody
 * @return string
 */
function getFormattedItem(strTitle,strLink,strText)
{
	var strOutput = '';
	strLinkStart = '<a class="item_link" href="' + strLink + '">';
	strOutput += '<div "feed_item"><div "item_title">';
	strOutput += strLinkStart + strTitle + '</a></div>';
	strOutput += '<div class="item_text">' + strText + '</div>';
	strOutput += '</div>';
	return strOutput;
}
/**
 * Retrieves a local RSS feed and parses the results.
 * @param sender
 * @param uri
 * @return
 */
function getFeed(strTarget, strUri, intMaxItems) {
	jQuery(strTarget).append('<div class="feed_wait" id="' + '3984v3098475nv390847n5v' + '"></div>');/*Reading RSS Feed...*/
	if(intMaxItems == null){
		intMaxItems = 3;
	}
    jQuery.getFeed({
        url: strUri,
        success: function(feed) {
            var html = '<div class="rss_feed">';
            for(var i = 0; i < feed.items.length && i < intMaxItems; i++) {
                var item = feed.items[i];
                html += getFormattedItem(item.title,item.link,item.description);
            }
            html += '</div>';
            //alert(html);
            jQuery('#3984v3098475nv390847n5v').hide();
            jQuery(strTarget).append(html);
        }
    });
}
/**
 *  Retrieves a proxied rss feed and parses the results.
 *  The proxy is needed to get around javascript security
 *  when it come to making requests for content from other sites.
 * 
 * @param sender
 * @param uri
 * @return
 */
function getFeedWithProxy(strTarget, strUri, intMaxItems) {
    var proxyUri = 'jquery/proxy.php?url=' + strUri;
    getFeed(strTarget,proxyUri,intMaxItems);
}
