// This is the base-RSS-module code
// FOR TWITTER FEED OF "TEAM_GB" USER
renderRSSModule2 = function(feedContent,feedDisplay, elementToAppend) {

    // The user will replace the below with their own code to render if they desire
    jQuery.getFeed({
        xml: feedContent,
        success: function(feed) {        
            /*jQuery(elementToAppend).append('<h3>'
            + '<a href="'
            + feed.link
            + '">'
            + feed.title
            + '</a>'
            + '</h3>');*/
            
            var html = '';
            
            for(var i = 0; i < feed.items.length && i < 1; i++) {
            
                var item = feed.items[i];
                html += '<h4>';

                if (item.link.length > 0 ) {
                    html += '<span class="quote">'
                    + item.title
                    + '</span><span class="endquote"><img src="http://static.global.ciscoeos.com/zipupload/f5e/b20/18531fa6e33bdf169b5801a796/images/modules/tweet_quote_end.png" /></span>';
                } else {
                    html += item.title;
                }

                html += '</h4>';
                
                html += '<div class="author"><div class="author_name"><a href="http://www.twitter.com/teamgb" target="_blank">TeamGB</a></div></div>';
              

                if (item.mthumbnail) {
                    html += '<div class="image">'
                    + '<img src="'
                    + item.mthumbnail
                    + '">'
                    + '</div>';
                }

            }
            
            jQuery(elementToAppend).append(html);
            
        }    
    });

}

// This is the base-RSS-module code
// FOR TWITTER FEED OF A SEARCH ON "TEAM GB"
renderRSSModule1 = function(feedContent,feedDisplay, elementToAppend) {

    // The user will replace the below with their own code to render if they desire
    jQuery.getFeed({
        xml: feedContent,
        success: function(feed) {        
            /*jQuery(elementToAppend).append('<h3>'
            + '<a href="'
            + feed.link
            + '">'
            + feed.title
            + '</a>'
            + '</h3>');*/
            
            var html = '';
            
            for(var i = 0; i < feed.items.length && i < 1; i++) {
            
                var item = feed.items[i];
                html += '<h4>';

                if (item.link.length > 0 ) {
                    html += '<span class="quote">'
                    + item.title
                    + '</span><span class="endquote"><img src="http://static.global.ciscoeos.com/zipupload/f5e/b20/18531fa6e33bdf169b5801a796/images/modules/tweet_quote_end.png" /></span>';
                } else {
                    html += item.title;
                }

                html += '</h4>';
                
                html += '<div class="author"><div class="author_name">'
                + item.author
                + '</div><div class="avatar"><img src="'
                + item.avatar
                + '"/></div></div>';
              

                if (item.mthumbnail) {
                    html += '<div class="image">'
                    + '<img src="'
                    + item.mthumbnail
                    + '">'
                    + '</div>';
                }

            }
            
            jQuery(elementToAppend).append(html);
            
            //this shows the twitter username only and removes the "real name" in parenthesis
            var twittername = $('.rss_in #twitter_search .author_name').text().match(/\S+/)[0];
            $('.rss_in #twitter_search .author_name').replaceWith('<div class="author_name">' + twittername + '</div>');
        }    
    });

}
