// File: readXML.js

// Start function when DOM has completely loaded 
jQuery(document).ready(function(){ 

	// Open the news.xml file
	jQuery.get("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 style="border-TOP:dotted 1px #eeeeee;border-bottom:dotted 1px #790F12;padding-bottom:3px;margin-top:3px;" colspan=2> <FONT COLOR="ffffff"> &#8226; </FONT> '+ newsHeadline +'</td>';
	output += '</tr>';
	output += '<tr>';
	output += '<td style="font-size:9px; color:#ffffff; padding-top:4px;" width="80%" valign=top>'+ newsDetail +'</td>';
	output += '<td style="font-size:9px; color:#ffffff; padding-top:4px; padding-bottom:4px; padding-left:4px;" width="20%" valign=top>'+ newsDate +'</td>';
	output += '</tr>';	
	return output;
}
	 