// Start function when DOM has completely loaded 
$(document).ready(function(){ 

	// Open the xml file
	$.get("/poker/promotions/boku87/data/boku87.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 = buildHTML(blogtitle,bloglink,blogpubdate,blogpost);
			HTMLOutput = HTMLOutput + mydata;
			
		});
		
		// Update the DIV called Content Area with the HTML string
		$("#box-middle").append(HTMLOutput);
});
	
});
 
 function buildHTML(blogtitle,bloglink,blogpubdate,blogpost){
	
	// Build HTML string and return
	output = '';
	output += '<p style="padding-left: 15px; padding-right: 10px;"><img src="/images/blog-bullett.gif" class="bullet" alt="" />';
	output += '<a href="' + bloglink + '" class="title" target="_blank">' + blogtitle + '</a>';
	output += '<br /><br />';
	output += '<em>Posted on ' + blogpubdate + '</em>';
	output += '<br /><br />'
	output += blogpost + '... <a href="' + bloglink + '" target="_blank">more</a>';
	output += '<div class="divider"></div></p>';
	return output;
}
