// Start function when DOM has completely loaded 
$(document).ready(function(){ 

	// Open the xml file
	$.get("http://www.pokerstarscaribbeanadventure.com/blogfeeds/pca/pca_teamps.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();
			blogpost = $(this).find("post").text();
			
			// Build row HTML data and store in string
			mydata = buildHTMLb(blogtitle,bloglink,blogpubdate,blogpost);
			HTMLOutput = HTMLOutput + mydata;
			
		});
		
		// Update the DIV called Content Area with the HTML string
		$("#TPS").append(HTMLOutput);
});
	
});
 
 function buildHTMLb(blogtitle,bloglink,blogpubdate,blogpost){
	
	// Build HTML string and return
	output = '';
	output += '<div class="txt">';
	output += '<p><a href="' + bloglink + '" class="bold_link" target="_blank"><span class="red_title_big">' + blogtitle + '</span></a></p>';
	output += '<p class="posted">Posted on ' + blogpubdate + '</p>';
	output += '<p>' + blogpost + '... <a href="' + bloglink + '" target="_blank"><strong>more</strong></a></p>';
	output += '</div>';
	output += '<div class="clear"></div><div class="line">&nbsp;</div>';
	return output;
}
