// getXML.js

function loadXMLDoc(fname)
{
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('Your browser cannot handle this script');
  }
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}

function displayXMLWeather()
{
//xml=loadXMLDoc("weather.xml");
xml=loadXMLDoc("xml/feeds/weather.xml");			/* Default = xml/weather/louisville.xml */
xsl=loadXMLDoc("xml/weather/weather.xsl");				/* weather.xsl */
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("weather").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("weather").appendChild(resultDocument);
  }
}

function displayXMLDeals()
{
xml=loadXMLDoc("xml/feeds/deals.xml");			
xsl=loadXMLDoc("xml/feeds/deals.xsl");
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("content").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  //document.getElementById("content").appendChild(resultDocument);			// Default Action
  
  document.getElementById("content").innerHTML = "";			// Clear DIV Contents
  document.getElementById("content").appendChild(resultDocument);
  }
}

function displayXMLContent(inputXML)
{	/*xml=loadXMLDoc("xml/feeds/weather.xml");*/			/* XML to Load --- Default = xml/weather/louisville.xml */
	xml=loadXMLDoc(inputXML);								/* XML to Load */
	xsl=loadXMLDoc("xml/serendipity/template.xsl");			/* XSL StyleSheet to Load --- Default = weather.xsl */
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("content").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("content").innerHTML = "";			// Clear DIV Contents
  document.getElementById("content").appendChild(resultDocument);
  }
}

function displayMainContent()
{	document.getElementById("content").innerHTML = "";
}