function loadFeed(url, handler, id) {

    var ajax = null;

    if (window.XMLHttpRequest) {
        try { ajax = new XMLHttpRequest(); } catch(e) { ajax = false; }
    }
    else if (window.ActiveXObject) {
        try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {
        try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { ajax = false; } }
    }

    if (ajax) {
        ajax.onreadystatechange = function() {
            if (ajax.readyState == 4) { 
              if (ajax.status == 200) {
                  handler(ajax.responseText, id);
              }
              else {
                handler("<channel><div class='section'><p>Cannot access channel: <a href='" + url + "' rel='external'>" + url + "</a>: status=" + ajax.status + "</p></div></channel>", id);
              }
            }
        };
        
        // PHP path relative to the calling page, absolute path breaks on prefixed sites
        //ajax.open("GET", "php/rss/proxy.php?feed=" + escape(url), true);
                
        ajax.open("GET", url, true);
        ajax.send(null);
    }
}

function writeHTML(html, id) {
    document.getElementById(id).innerHTML = html;
}

function showFeed(feed, section) {
  loadFeed(feed, writeHTML, section );
}
