// Start function when DOM has completely loaded 
$(document).ready(function(){ 

	// Open the xml file
	$.get("/blogfeeds/wcoop/wcoop_lposts.xml",{},function(xml){
      	
	// Build an HTML string
	HTMLOutput = '';
			
		// Run the function for each student tag in the XML file
		$('item',xml).each(function(i) {
												
			blogtitle = $(this).find("title").text();
			bloglink = $(this).find("link").text();
			blogpubdate = $(this).find("pubDate").text();
			
			// Build row HTML data and store in string
			mydata = buildHTMLa(blogtitle,bloglink,blogpubdate);
			HTMLOutput = HTMLOutput + mydata;
			
		});
		
		// Update the DIV called Content Area with the HTML string
		$("#latestPosts").append(HTMLOutput);
});
	
});
 
 function buildHTMLa(blogtitle,bloglink,blogpubdate){
	
	// Build HTML string and return
	output = '';
	output += '<br />';
	output += '<a href="' + bloglink + '" class="link1" target="_blank">';
	output += '<strong>'+ blogtitle + '</strong></a>';
	output += '<br />';
	output += 'Posted on ' + blogpubdate +'<br /><img src="/no/images/post-spacer.gif" alt="Spacer">';
	return output;
}
	 
