function parseXml(xml)
{
	if (jQuery.browser.msie)
	{
		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.loadXML(xml);
		xml = xmlDoc;
	}
	return xml;
}

function createXmlDOMObject(xmlString)
{
    var xmlDoc = null;

    if( ! window.DOMParser )
    {
        // the xml string cannot be directly manipulated by browsers
        // such as Internet Explorer because they rely on an external
        // DOM parsing framework...
        // create and load an XML document object through the DOM
        // ActiveXObject that it can deal with
        xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
        xmlDoc.async = false;
        xmlDoc.loadXML( xmlString );
    }
    else
    {
        // the current browser is capable of creating its own DOM parser
        parser = new DOMParser();
        xmlDoc = parser.parseFromString( xmlString, "text/xml" ) ;
    }

    return xmlDoc;
}

function get_rss_feed() {

	//clear the content in the div for the next feed.
	$("#feedContent").empty();

    var i = 1;

    $.ajax({
       type: "GET",
       dataType: "XML",
       url: "/bootcamp/proxy.php",
       success: function(r){
            if ( $.browser.msie ) {
                r = createXmlDOMObject(r);
            }
            $(r).find("item").each(function() {
                if ( i <= 5 ) {
                    var link = $(this).find("jlink").text();
                    var title = $(this).find("title").text();
                    //var description = $(this).find("description").text();

                    // now create a var 'html' to store the markup we're using to output the feed to the browser window
                    var html = "<div class=\"entry\"><li class=\"postTitle\">" + title + "<br/>";
                    //html += "<div class=\"description\">" + description + "</div>";
                    html += "<a href=\"" + link + "\" target=\"_blank\">Read More...</a></li>";

                    //put that feed content on the screen!
                    $("#feedcontent").append($(html));
                    
                    i += 1;
                }

            });
       },
       error: function( objAJAXRequest, r ){
            //alert("Server Error");
       }
    });
};

