// JavaScript Document

function loadXMLDoc(dname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Sorry, your browser cannot display the dynamic slideshow');
}
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}

xmlDoc=loadXMLDoc(xmlFeed);

// var pageProperties=xmlDoc.getElementsByTagName('photos');
var photoList=xmlDoc.getElementsByTagName('photo');


for(i=0;i<photoList.length;i++)
  {
  var photoID=photoList.item(i).attributes.getNamedItem("id");
  var photoOwner=photoList.item(i).attributes.getNamedItem("owner");
  var photoSecret=photoList.item(i).attributes.getNamedItem("secret");
  var photoServer=photoList.item(i).attributes.getNamedItem("server");
  var photoFarm=photoList.item(i).attributes.getNamedItem("farm");
  var photoTitle=photoList.item(i).attributes.getNamedItem("title");
  var photoOwnerName=photoList.item(i).attributes.getNamedItem("ownername");
  
  if (photoTitle.value.length>60){
	  photoTitle.value=(photoTitle.value.substring(0, 57) + "...");
  }
  document.write("<div class=\"ssSlide\">");  //slideshow photo wrapper
  document.write("<p><a href=\"http://www.flickr.com/photos/" + photoOwner.value + "/" + photoID.value + "\"><img src=\"http://farm" + photoFarm.value + ".static.flickr.com/" + photoServer.value + "/" + photoID.value + "_" + photoSecret.value + "_m.jpg\" alt=\"" + photoTitle.value + "\" border=\"0\"></a><br />" );
  document.write("<em>" + photoTitle.value + "</em><br /> by <a href=\"http://www.flickr.com/photos/" + photoOwner.value + "\">" + photoOwnerName.value + "</a><br />");
  document.write("This image comes from flickr.com<br /><a href=\"http://www.flickr.com/photos/" + photoOwner.value + "/" + photoID.value + "\">view original and add comments</a></p>");
  document.write("</div>");
}

  document.write("<div class=\"ssSlide\">");  //slideshow photo wrapper
  document.write("<h3>Where next\?</h3><br /><br /><br />" );
  document.write("<a href=\"" + ssFlickrURL + "\" target=\"_blank\"\">" + ssFlickrLinkText + "</a><br /><br />" );
  document.write("<a href=\"#\" onclick=\"ssRun()\">Restart slideshow</a>");
  document.write("</div>");

// var page=pageProperties.item(0).attributes.getNamedItem("page");
// var pages=pageProperties.item(0).attributes.getNamedItem("pages");
  
//  document.write("<div id=\"ssPagination\"><h2>page " + page.value + " of " + pages.value + "</h2></div>");
  
//  <div id="ssPagination"><< Previous page | <a href="kewgardens_group_p2.shtml">Next page >></a></div>
