// File: readXML.js

// Start function when DOM has completely loaded 
jQuery(document).ready(function(){ 

	// Open the news.xml file
	jQuery.get("http://www.delts.org/news/news.xml",{},function(xml){
      	
		// Build an HTML string
		myHTMLOutput = '';
	 	myHTMLOutput += '<table border="0" cellpadding="0" cellspacing="0" style="font-family: Verdana, Arial, Helvetica, sans-serif">';
	  	
		// Run the function for each news tag in the XML file
		jQuery('news',xml).each(function(i) {
			newsHeadline = jQuery(this).find("headline").text();
			newsDetail = jQuery(this).find("detail").text();
			newsDate = jQuery(this).find("date").text();
			
			// Build row HTML data and store in string
			mydata = BuildNewsHTML(newsHeadline,newsDetail,newsDate);
			myHTMLOutput = myHTMLOutput + mydata;
		});
		myHTMLOutput += '</table>';
		
		// Update the DIV called news with the HTML string
		jQuery("#news").append(myHTMLOutput);
	});
});
 
 
 
 function BuildNewsHTML(newsHeadline,newsDetail,newsDate,newsSE){

	// Build HTML string and return
	output = '';
	output += '<tr>';
	output += '<td class="news-headline">'+ newsHeadline +'</td>';
	output += '</tr>';
	output += '<tr>';
	output += '<td class="news-detail">'+ newsDetail +'</td>';
	output += '</tr>';
	output += '<tr>';
	output += '<td class="news-date">'+ newsDate +'</td>';
	output += '</tr>';
	return output;
}
	 