function loadSponsorPage() {
  // Load the sponsor data (JSON) from the file
  $.getJSON('sponsors.json', function(data) {

    // PREMIER SPONSORS
    var premiers = data['premiersponsors'];

    $.each(premiers, function(index, sponsor) {
      $('#sponsors-premier-div').append('<p style="text-align: center; margin-bottom: 30px;"><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.width + '" height="' + sponsor.height + '" alt="' + sponsor.name + '" border="0"></a></p>');
    });

    // STAGE SPONSORS
    var stages = data['stagesponsors'];

    $.each(stages, function(index, sponsor) {
      $('#sponsors-stage-div').append('<p style="text-align: center; margin-bottom: 30px;"><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.width + '" height="' + sponsor.height + '" alt="' + sponsor.name + '" border="0"></a></p>');
    });

    // GOLD SPONSORS
    var golds = data['goldsponsors'];

    $.each(golds, function(index, sponsor) {
      $('#sponsors-gold-div').append('<p style="text-align: center; margin-bottom: 30px;"><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.width + '" height="' + sponsor.height + '" alt="' + sponsor.name + '" border="0"></a></p>');
    });

    // SILVER SPONSORS
    var silvers = data['silversponsors'];
    var col = 0;

    if (silvers) {
      $('#sponsors-silver-title').show();

      $.each(silvers, function(index, sponsor) {
          if (col == 0) {
            $('#sponsors-silver-table > tbody:last').append('<tr></tr>');
          }
          $('#sponsors-silver-table > tbody:last > tr:last').append('<td><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.width + '" height="' + sponsor.height + '" alt="' + sponsor.name + '" border="0"></a></td>');
  
          if (++col == 2) {
            col = 0;
          }
      });
    } else {
      $('#sponsors-silver-title').hide();
      $('#sponsors-silver-table').hide();
    }

    // BRONZE SPONSORS
    var bronzes = data['bronzesponsors'];
    var col = 0;

    if (bronzes) {
      $('#sponsors-bronze-title').show();

      if (bronzes) {
        $.each(bronzes, function(index, sponsor) {
            if (col == 0) {
              $('#sponsors-bronze-table > tbody:last').append('<tr></tr>');
            }
            $('#sponsors-bronze-table > tbody:last > tr:last').append('<td><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.width + '" height="' + sponsor.height + '" alt="' + sponsor.name + '" border="0"></a></td>');

            if (++col == 2) {
              col = 0;
            }
        });
      }
    } else {
      $('#sponsors-bronze-title').hide();
      $('#sponsors-bronze-table').hide();
    }

    // MATCH CONTRIBUTORS
    var contribs = data['matchcontributors'];
    var col = 0;

    if (contribs) {
      $('#sponsors-matchcontributor-title').show();

      $.each(contribs, function(index, sponsor) {
          if (col == 0) {
            $('#sponsors-matchcontributor-table > tbody:last').append('<tr></tr>');
          }
          $('#sponsors-matchcontributor-table > tbody:last > tr:last').append('<td><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.width + '" height="' + sponsor.height + '" alt="' + sponsor.name + '" border="0"></a></td>');

          if (++col == 3) {
            col = 0;
          }
      });
    } else {
      $('#sponsors-matchcontributor-title').hide();
      $('#sponsors-matchcontributor-table').hide();
    }
  });
}

function loadSponsorSidebar() {
  // Load the sponsor data (JSON) from the file
  $.getJSON('sponsors.json', function(data) {

    var premiers = data['premiersponsors'];

    $.each(premiers, function(index, sponsor) {
      $('#sidebar').append('<p><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.sidebar_width + '" alt="' + sponsor.name + '" border="0"></a></p>');
    });

    var stages = data['stagesponsors'];

    $.each(stages, function(index, sponsor) {
      $('#sidebar').append('<p><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.sidebar_width + '" alt="' + sponsor.name + '" border="0"></a></p>');
    });

    var golds = data['goldsponsors'];

    $.each(golds, function(index, sponsor) {
      $('#sidebar').append('<p><a href="' + sponsor.url + '" target="_blank"><img src="' + sponsor.image + '" width="' + sponsor.sidebar_width + '" alt="' + sponsor.name + '" border="0"></a></p>');
    });
  });
}

