﻿$(document).ready(function() {

    //ready feed from trendmicro
    //http://us.trendmicro.com/us/about/news/rss-feeds/
    $.jGFeed('http://feeds.trendmicro.com/MalwareAdvisories?format=xml',
    function(feeds) {
        // Check for errors
        if (!feeds) {
            // there was an error
            $("#malware_alert_rss").append('Sorry, no data found!');
            return false;
        }
        // do whatever you want with feeds here
        $("#malware_alert_rss").append('<table id="malware_alert_rss_table">');
        $("#malware_alert_rss_table").append('<tr><th id="malware_alert_column1">Malware</th><th>Advisory Date</th></tr>');
        for (var i = 0; i < feeds.entries.length; i++) {
            var entry = feeds.entries[i];
            // Entry title
            entry.title;

            $("#malware_alert_rss_table").append('<tr id="malware_alert_rss_row' + i + '">');
            $("#malware_alert_rss_row"+i).append('<td class="malware_alert_column"><a href=' + entry.link + '>' + new String(entry.content).replace('malware Advisory: ', '') + '</a></td>');
            $("#malware_alert_rss_row"+i).append('<td class="malware_alert_column">' + new Date(entry.publishedDate).toDateString() + '</td>');
	    }
    }, 5);

});
