{

  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);
    //        }
    //    });

    $.ajax({
      type: "GET",
      url: "//www.barry.edu/xml/xml.aspx?id=" + webid,
      dataType: "jsonp",
      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'>";

        var mainSite = "//www.barry.edu";

        for (var i = 0; i < amount; i++) {
          var imageURL = jsonnews[i].Image_URL;

          if (imageURL.indexOf('http', 0) > 0) {
            imageURL = imageURL.replace('https:').replace('http:');
          }
          else {
            imageURL = mainSite + imageURL;
          }
            var row = "<tr class='photo-list'> ";
            row += "<td valign='top' ><a href='news/details.htm?ID=" + jsonnews[i].Article_ID + "&webid=" + webid + "'><img alt='" + jsonnews[i].Title + "' src='" + imageURL + "' 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='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 mainSite = "//www.barry.edu";
        var table = "<table border='0' cellpadding='3' cellspacing='0'><tbody>";
        var row = "<tr>";
        table += row;
        for (var i = 0; i < amount; i++) {
          var imageURL = jsonnews[i].Image_URL;

          if (imageURL.indexOf('http', 0) > 0) {
            imageURL = imageURL.replace('https:').replace('http:');
          }
          else {
            imageURL = mainSite + imageURL;
          }

            var td = "<td valign='top' align='center'><ul class='photo-list'>";
            td += "<li><a href='news/details.htm?ID=" + jsonnews[i].Article_ID + "&webid=" + webid + "'><img alt='" + jsonnews[i].Title + "' src='" + imageURL + "' width='165' border='0' /></a>";

            td += "<p><a href='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);
    }
}
