// JavaScript Document
String.prototype.stripComments = function()
{
	return (this.replace(/^&nbsp;/,'').replace(/^[\s]+/,''));
}

function present_text(message)
{
	if (message)
	{
		$('#message').text(message);
	}
}

function restore_text()
{
	$('#message').text("Use your mouse/pointer to select an industry");
}

function loadXMLDoc(url)
{
	$(function () {
		$.get(url, function(d) {
			$(d).find('tr.datarow').each(function(i) {
				var cells = $(this).find('td');
				var title = $(cells).eq(0).text().stripComments();
				var storyURL = $(cells).eq(1).text().stripComments();
				var story = $(cells).eq(2).text().stripComments();
				var html = '<div class="newsitem">';
				html += '<h2>'; 
				if (storyURL != "") {
					html += '<a href="' + storyURL + '" target="_blank">' + title + '</a>';
				} else {
					html += title;
				}
				html += '</h2>';
				html += '<p>' + story + '</p>';
				$('#articles').append(html);
			});
		},'html');
	});
}
