{
    
    function GetNews(webid, amount, type, teaser) {
        

        $.ajax({
            type: "GET",
            url: "https://www.barry.edu/xml/" + webid + ".txt",
            data: {},
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            success: function(jsonnews) {
            if (type == "Horizontal")
                buildNewsTableHorizontal(jsonnews, amount, teaser, webid);
            if (type == "Vertical")
                buildNewsTableVertical(jsonnews, teaser, webid, amount);
            }
        });

    }
    function buildNewsTableVertical(jsonnews, teaser, webid, amount) {

        if (amount == "0")
            amount = jsonnews.length;
        var table = "<table border='0' cellpadding='3' cellspacing='0'>";
        for (var i = 0; i < amount; i++) {
            var row = "<tr class='photo-list'> ";
            row += "<td valign='top' ><a href='http://www.barry.edu/news/details.htm?ID=" + jsonnews[i].Article_ID + "&webid=" + webid + "'><img alt='" + jsonnews[i].Title + "' src='" + jsonnews[i].Image_URL + "' width='165' style='border-color:#CC0000;border-style:solid;border-width:1px;' /></a></td>";

            row += "<td valign='top' style='width:250px'><span class='newsDate'>" + jsonnews[i].Date_Posted + "</span><br /><a href='http://www.barry.edu/news/details.htm?ID=" + jsonnews[i].Article_ID + "&webid=" + webid + "' class='newsTitle'>" + jsonnews[i].Title + "</a>";
			 if (teaser == "yes")
                row += "<br>" + jsonnews[i].Teaser;
			row += "</td>";
            row += "</tr>";
           
            table += row;

        }
        table += "</table>";
        $('#news').html(table);

    }
    function buildNewsTableHorizontal(jsonnews, amount, teaser, webid) {
        if (amount == "0")
            amount = jsonnews.length;
        var table = "<table width='100%' border='0' cellpadding='3' cellspacing='0'><tbody>";
        var row = "<tr>";
        table += row;
        for (var i = 0; i < amount; i++) {

            var td = "<td valign='top' align='center'><ul class='photo-list'>";
            td += "<li><a href='http://www.barry.edu/news/details.htm?ID=" + jsonnews[i].Article_ID + "&webid=" + webid + "'><img alt='" + jsonnews[i].Title + "' src='" + jsonnews[i].Image_URL + "' width='165' border='0' /></a>";

            td += "<p><a href='http://www.barry.edu/news/details.htm?ID=" + jsonnews[i].Article_ID + "&webid=" + webid + "'>" + jsonnews[i].Title + "</a></p>";
            td += " </li>";
            if(teaser == "yes")
            td += "<li>" + jsonnews[i].Teaser + "</li>";
            td += "</ul></td>";
            row += td;

        }
        row += "</tr>";
        table += row;
        table += "</td></tr></tbody></table>";
        $('#news').html(table);

    }
}
