﻿$(document).ready(function() {

    //ready feed from trendmicro
    //http://us.trendmicro.com/us/about/news/rss-feeds/
    $.jGFeed('http://feeds.trendmicro.com/TrendMicroSecurityAdvisories?format=xml',
    function(feeds) {
        // Check for errors
        if (!feeds) {
            // there was an error
            $("#security_alert_rss").append('Sorry, no data found!');
            return false;
        }
        // do whatever you want with feeds here
        $("#security_alert_rss").append('<table id="security_alert_rss_table">');
        $("#security_alert_rss_table").append('<tr><th id="security_alert_column1">Advisory Name</th><th>Advisory Date</th></tr>');
        for (var i = 0; i < feeds.entries.length; i++) {
            var entry = feeds.entries[i];
            // Entry title
            entry.title;

            $("#security_alert_rss_table").append('<tr id="security_alert_rss_row' + i + '">');
            $("#security_alert_rss_row" + i).append('<td class="security_alert_column"><a href=' + entry.link + '>' + new String(entry.title).replace('Security Advisory: ', '') + '</a></td>');
            $("#security_alert_rss_row"+i).append('<td class="security_alert_column">' + new Date(entry.publishedDate).toDateString() + '</td>');
        }
    }, 5);


    //adverts
    $("div#gallery").slideViewerPro({
        galBorderWidth: 0,  // the border width around the main images 
        thumbsTopMargin: 0, // the distance that separates the thumbnails and the buttons from the main images 
        thumbsRightMargin: 0, // the distance of each thumnail respect to the next one 
        thumbsBorderWidth: 3, // the border width of each thumbnail. Note that the border in reality is above, not around 
        buttonsWidth: 0, // the width of the prev/next buttons that commands the thumbnails
        galBorderColor: "aqua", // the border color around the main images 
//        thumbsBorderColor: "#d8d8d8", // the border color of the thumbnails but not the current one 
        thumbsActiveBorderColor: "gold", // the border color of the current thumbnail 
        buttonsTextColor: "#707070", //the color of the optional text in leftButtonInner/rightButtonInner 
        thumbsBorderOpacity: 0, // could be 0, 0.1 up to 1.0 
        thumbsActiveBorderOpacity: 0.8, // could be 0, 0.1 up to 1.0 
        easeTime: 1000, // the time it takes a slide to move to its position 
        asTimer: 10000, // if autoslide is true, this is the interval between each slide 
        thumbs: 4, // the number of visible thumbnails 
        thumbsPercentReduction: 24.9, // the percentual reduction of the thumbnails in relation to the original 
        thumbsVis: true, // with this option set to false, the whole UI (thumbs and buttons) are not visible 
        leftButtonInner: "<img src='images/larw.gif' />", //could be an image "<img src='images/larw.gif' />" or an escaped char as "&larr"; 
        rightButtonInner: "<img src='images/rarw.gif' />", //could be an image or an escaped char as "&rarr"; 
        autoslide: true, // by default the slider do not slides automatically. When set to true REQUIRES the jquery.timers plugin 
        typo: false, // the typographic info of each slide. When set to true, the ALT tag content is displayed 
        typoFullOpacity: 0.5, // the opacity for typographic info. 1 means fully visible. 
        shuffle: false // the LI items can be shuffled (randomly mixed) when shuffle is true         
    });

    //announcement
    $("#myScroll1").mbScrollable({
        dir: "vertical",
        width: 630,
        height: 360,
        elementsInPage: 3,
        elementMargin: 0,
//        shadow: "#999 2px 2px 2px",
        controls: "#controls",
        slideTimer: 1000,
        autoscroll: true,
        scrollTimer: 10000
    });

});
