function formatFeed(obj,number) {

            //number can be optional to change the number of stories shown
            number = typeof(number) != 'undefined' ? number : 6;
            var html = '';
            
            var topStory = '';
    
            var topStoryImg = '<div id="topStoryImage" >' + formatImg(obj.value.items[0],250,250) + '</div>';
            var topStory = '<div class="topStory" >' + formatNewsItem(obj.value.items[0]) + '</div>';
    
            html += topStoryImg + topStory;
            
            var stories = '';
            var x;
            for (x = 1; x < number ; x++)
            {
                stories += formatNewsItem(obj.value.items[x]);
            }
            html += stories;
    
            html = '<div id="newsfeed" >' + html + '</div>';
        
            return (html);
      }

      function formatNewsItem(item){
        
            var stories = '<div class=\"listingItem\" > <div class="title"><a href="' + item.link + '"  target="blank" >' + item.title + '</a></div>';
            now = new Date(item.pubDate);
            stories += '<div class="date" >' + now.toLocaleString() + '&nbsp;-&nbsp;<span class="source" >' + item.source + '</span></div>';
            stories += '<div class="desc">' + item.description + '</div></div>';
              
            return stories
      }
    
      function formatImg(item,maxHeight,maxWidth){
                                  
            var height = item["media:content"].height;
            var width = item["media:content"].width;
              
            if((height > maxHeight)){
                  
                  width = Math.round( width * (maxHeight / height) );
                  height = maxHeight;
            }
              
            if((width > maxWidth)){
                  
                  height = Math.round( height * (maxWidth / width) );
                  width = maxWidth;
      
            }
            var image = '<a href=' + item.link + ' target="blank" ><img src="' + item["media:content"].url + '" height="' + height + '" width=" ' + width + '" border="0"></a>';
            
            return image;
    }