﻿setTimeout("DisplayNews()", 500);

function DisplayNews() {
    $.ajax({
        type: "GET",
        url: "/AjaxWCFHelper.svc/ReadNews",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            if (response != null) {
                $("#prev").css("visibility", "visible");
                $("#next").css("visibility", "visible");
                for (var i = 0; i <= response.length - 1; i++) {
                    $("#jCarouselLite ul").append(
                            '<li class="news">' +
                                '<a href="' + response[i].link + '" class="linkopacity" target="_blank">' +
                                    '<img src="' + response[i].imageUrl + '" width="80" height="50" vspace="3" border="0" alt="' + response[i].title + '" />' +
                                '</a>' +
                                 '<p>' +
                                    '<strong>' +
                                        response[i].title +
                                    '</strong><br />' +
                                    response[i].description +
                                  '</p><br /><p><a href="' + response[i].link + '" target="_blank">Read more</a></p></li>');
                }
                $("#jCarouselLite").jCarouselLite({ btnNext: "#next", btnPrev: "#prev", vertical: true, scroll: 2 });
            }            
        },
        error: function (response) {
        }
    });
}
