function getStories(theCategory) {	// fetch XML data	if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } // code for IE7+, Firefox, Chrome, Opera, Safari	else { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } // code for IE5, IE6	xhttp.open("GET","/xml/stories.xml",false);	xhttp.send(null);	xmlDoc=xhttp.responseXML;		// make sure we have a valid data source to work with	if (xhttp.responseXML.hasChildNodes()) {		theStories = xmlDoc.getElementsByTagName("STORY");		var list = document.createElement("ul");		var listText = document.createTextNode("Related News Stories:");		list.appendChild(listText);		if (theCategory) {			var dest = document.getElementById("TL_STORY");						for (x=0;x<theStories.length;x++) {				if (theStories[x].hasChildNodes()) {					if (theStories[x].attributes.getNamedItem("CAT").value == theCategory) {					    var line = document.createElement("li");					    var link = document.createElement("a");						if (theStories[x].getElementsByTagName("TITLE")[0].hasChildNodes()) {							var linkText = theStories[x].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue;						} else {							var linkText = "ERROR: Title Not Specified";						}						if (theStories[x].getElementsByTagName("LINK")[0].hasChildNodes()) {							var linkTarget = theStories[x].getElementsByTagName("LINK")[0].childNodes[0].nodeValue;						} else {							var linkTarget = "#ERROR: Link Not Specified";						}						link.setAttribute("target","_blank");						link.setAttribute("href",linkTarget);						link.appendChild(document.createTextNode(linkText));						line.appendChild(link);						list.appendChild(line);						list.className = "TL_story";					}				}				dest.appendChild(list);				dest.className = "TL_stories";				dest.setAttribute("id","TL_"+theCategory);			}		} else {			dest.appendChild(document.createTextNode("ERROR: Category Not Specified"));		}	}}
