/**
 * loadPageData
 * Presents the RSS feed to the user so that the user can view the material.
 * Pass in the full URL to the RSS Feed.  The function uses the same XSL file
 * for each RSS feed.
 *
 * rssFeedUrl - The full URL path to the rss feed.
 */
   function loadPageData(rssFeedUrl, contentId)
   {
     var processor = new XSLTProcessor();
     var xmlhttp = new XMLHttpRequest();
     var xmldom = Sarissa.getDomDocument();

     xmlhttp.open("GET", rssFeedUrl, false);
     xmlhttp.send(null);

     xmldom = (new DOMParser()).parseFromString(xmlhttp.responseText, "text/xml");

    // the following two lines are needed for IE
    xmldom.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
    xmldom.setProperty("SelectionLanguage", "XPath");

     var xslhttp = new XMLHttpRequest();
     xslhttp.open("GET", "http://www.northpointcoc.com/rss.xsl", false);  
     xslhttp.send(null);
     
     var xsldom = Sarissa.getDomDocument();
     xsldom = (new DOMParser()).parseFromString(xslhttp.responseText, "text/xml");

     processor.importStylesheet(xsldom);

     var newDocument = processor.transformToDocument(xmldom);

     // present the new data to the user:
     var audiocontent = document.getElementById(contentId);

     var serializer = new XMLSerializer();
     audiocontent.innerHTML = serializer.serializeToString(newDocument);

   }


/**
 * presentMaterial
 *
 * Presents the material according to the type of file passed in.
 * file - full URL to file on website.
 * type - currently, two types are supported: audio/mpeg and application/pdf.
 */
    function presentMaterial(file, type)
    {
        switch(type)
        {
            case "audio/mpeg": // displayed in QuickTime player 

                //alert("Playing file: " + file);
                var player = document.getElementById("player");
                var ieplayer = document.getElementById("ieplayer");

                if(document.player)
                    player = document.player;


                //alert("loading file.");

                if(player != null)
                {
                    player.SetURL(file);
                    player.Play();

                }
                else
                {
                    ieplayer.SetURL(file);
                    ieplayer.Play();

                }
                break;

            case "application/pdf":

                window.open(file);            
                break;

            default:
                window.open(file);
                break;
        } // end of switch statement
    }
