var ajax = new sack();
var contentObj;    // Reference to article content <div>
   
function showContent() {
  contentObj.innerHTML = ajax.response;    // ajax.response is a variable that contains the content of the external file
}

function showWaitMessage(){
  contentObj.innerHTML = '<img src=http://www.catholic.org/images/mycol/loading.gif />Loading Content...';
}

function getAjaxFile(fileName) {
  ajax.requestFile = fileName;       // Specifying which file to get
  ajax.onCompletion = showContent;   // Specify function that will be executed after file has been found
  ajax.onLoading = showWaitMessage;  // Action when AJAX is loading the file
  ajax.runAJAX();                    // Execute AJAX function
}

window.onload = function (){
  contentObj = document.getElementById('contentContainer');
  getAjaxFile('http://www.catholic.org/video/loadContent.php?cid=1');
};
