<!--- newsfeed script -->
var xMax = 20;
var xmlDoc=null;
<!--- Functions -->
function procNoPhoto() {
<!--- fill in td -->

	try {
	  document.write("<strong><big><a href='",
	  x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue)
	  document.write("'>");
	  document.write(
	  x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
	  document.write("</a></big></strong> ");
	}
	catch(err)
	{ 
	  document.write("<strong><big>",
	  x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
	  document.write("</big></strong> ");
	}
	document.write(" - ",
	x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
	document.write("<p/><p/>");
}
function procOnePhoto() {
<!--- fill in td with table then TR TD -->

	document.write("<table border='0' style='text-align: left; width:100%'><tr><td>");

	try {
	  document.write("<strong><big><a href='",
	  x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue)
	  document.write("'>");
	  document.write(
	  x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
	  document.write("</a></big></strong> ");
	}
	catch(err)
	{ 
	  document.write("<strong><big>",
	  x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
	  document.write("</big></strong> ");
	}

	document.write(" - ",
	x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
	document.write("<p/><p/></td>");

	var yp=x[i].getElementsByTagName("photo");
	var ypc=yp[0].getElementsByTagName("caption");

	document.write("<td>");
	document.write("<img src='",
		yp[0].childNodes[0].nodeValue);
	document.write("' style='width:",yp[0].getAttribute("width"),
		"'; height:'",yp[0].getAttribute("height"),
		 "'; float: right;' Alt='",ypc[0].childNodes[0].nodeValue, " photo'>",
		ypc[0].childNodes[0].nodeValue,
		"</img></td>");

	document.write("</tr></table>");
}
function procMultiPhoto() {
<!--- fill in td with 2 row table -->

	document.write("<table style='text-align: left; width:100%'><tr><td style='text-align: left; width:100%'>");

	try {
	  document.write("<strong><big><a href='",
	  x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue)
	  document.write("'>");
	  document.write(
	  x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
	  document.write("</a></big></strong> ");
	}
	catch(err)
	{ 
	  document.write("<strong><big>",
	  x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
	  document.write("</big></strong> ");
	}

	document.write(" - ",
		x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
	document.write("<p/><p/></td></tr>");
<!--- create second row table for photos -->
 	document.write("<tr><table style='text-align: left; width:100%'><tr style='text-align: left; width:100%'>");

	var yp=x[i].getElementsByTagName("photo");

	for (var ic = 0; ic < yp.length; ic++) 
	{
		if (yp[ic].childNodes[0].nodeValue!=null)
		{ if (yp[ic].childNodes[0].nodeValue!=" ")
		  {
  			var ypc=yp[ic].getElementsByTagName("caption");
			if (ypc.length >0)
			{
			  document.write("<td>");
			  document.write("<img src='",
				yp[ic].childNodes[0].nodeValue);
			  document.write("' style='width:",yp[ic].getAttribute("width"),
				"'; height:'",yp[ic].getAttribute("height"));
			  if (ypc[0].nodeValue)
			  { 
				document.write("'; float: right;' Alt='Photo'><p>Photo</p>");
			  }
			  else
			  {
				document.write("'; float: right;' Alt='",ypc[0].childNodes[0].nodeValue," photo'><p>");
				document.write(ypc[0].childNodes[0].nodeValue);
		  	  }
			  document.write("</p></img></td>");
			}
			else
			{
			  document.write("<td>");
			  document.write("<img src='",
				yp[ic].childNodes[0].nodeValue);
			  document.write("' style='width:",yp[ic].getAttribute("width"),
				"'; height:'",yp[ic].getAttribute("height"));
				document.write("'; float: right;' Alt='Photo'><p>Photo");
			  document.write("</p></img></td>");
			}
		  }
		}
	}

	  document.write("</tr></table>");
}


if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;

var loadName='http://' + document.domain + '/newsfeed.xml';
xmlDoc.load(loadName);

<!--- Start output -->
document.write("<table border='0' style='text-align: left; width:100%'>");
document.write("<tr bgcolor='#9acd32'>"); 
document.write("<th style='text-align: center;'>FSP Latest News Reports</th>");
document.write("</tr>");
var x=xmlDoc.getElementsByTagName("item");
if (x.length > xMax)
{ xl = xMax; }
else
{ xl = x.length; }
 
<!--- Main Loop -->
for (i=0;i<xl;i++)
{ 
<!--- for each Item create a tr and td -->
	document.write("<tr style='text-align: left; width:100%'>");
	document.write("<td >");
	<!---  check for photos -->
	var xp=x[i].getElementsByTagName("photo");

	if (xp.length == 0) <!--- no photo -->
	{
		procNoPhoto();
	}
	else
	{
	  if (xp.length == 1) <!--- one photo -->
	  {
		procOnePhoto();
	  }
	  else <!--- multiple photos -->
	  {	 
		procMultiPhoto();
	  }
	}
	document.write("</td></tr>");
}
<!---  end of main -->

//	document.write("</table>");
 
if (x.length > xMax)
{

document.write("<tr><td style='text-align: center;'><big>");
document.write("<a href='http://ncfsp.org/archives.html'>More News</a>");
}
document.write("</big></td></tr>"); document.write("</table>");
}
