function tiah_Create() {
	try { //Internet Explorer
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	} catch(e) {
		try { //Firefox, Mozilla, Opera, etc.
			xmlDoc = document.implementation.createDocument( "", "", null );
		} catch(e) {
			alert(e.message);
			return;
		}
	}
	xmlDoc.async = false;
	xmlDoc.load("http://www.derekclayton.com/tiah/rss/tiah_rss.xml");

	document.write( "\n<!-- BEGIN: TODAY IN AMUSEMENT HISTORY -->\n" );
	document.write( "<!-- (c)2010 DerekClayton.com  www.derekclayton.com -->\n" );
	tiah_clientSideInclude("http://www.derekclayton.com/tiah/tiah_user_styles.css");
	document.write( "<div class='tiah'>\n" );

	var d = new Date();
	var month=new Array(12);
	month[0]="January";
	month[1]="February";
	month[2]="March";
	month[3]="April";
	month[4]="May";
	month[5]="June";
	month[6]="July";
	month[7]="August";
	month[8]="September";
	month[9]="October";
	month[10]="November";
	month[11]="December";

	document.write( "	<div class='tiah_title'>Today in Amusement History - " + month[d.getMonth()] +" "+ d.getDate() + "</div>\n" );

	// Get a list of the <item> element nodes in the file.
	var itemList = xmlDoc.getElementsByTagName("item");
	// Loop through all <item> nodes.
	var paging = "";
	var style = "";
	var itemCount = 0;
	var itemTotal = itemList.length;
	if (itemTotal>0) {
		while (itemCount<itemTotal) {
			// For each <item> node, get child nodes.
			var nodeList = itemList.item(itemCount).childNodes;

			// Create CSS.
			if (itemCount==0) {
				style = " style='visibility:visible; display:block;'";
			} else {
				style = " style='visibility:hidden; display:none;'";
			}

			document.write( "	<div class='tiah_row'" + style + " id='fact" + itemCount + "'>\n" );
			var i = 0;
			var year = "";
			var blurb = "";
			var detail = "";
			var loc = "";
			while (i<nodeList.length) {
				var node = nodeList.item(i);

				if (node.nodeName == "title") {
					year = node.firstChild.nodeValue;
					year = tiah_htmlspecialchars_decode(year);
				}
				if (node.nodeName == "description") {
					blurb = node.firstChild.nodeValue;
					blurb = tiah_htmlspecialchars_decode(blurb);
				}
				if (node.nodeName == "detail") {
					detail = node.firstChild.nodeValue;
					detail = tiah_htmlspecialchars_decode(detail);
				}
				if (node.nodeName == "location") {
					loc = node.firstChild.nodeValue;
					loc = tiah_htmlspecialchars_decode(loc);
				}
				//if (node.nodeName == "link") { var link = node.firstChild.nodeValue; }
				i++;
			}
			document.write( "		<div class='tiah_year'>" + year + "</div>\n" );
			document.write( "		<div class='tiah_fact'>" + blurb );
			if (detail!="") { document.write( " " + detail ); }
			if (loc!="") { document.write( " ("+ loc + ")" ); }
			document.write( "</div>\n" );
			document.write( "	</div>\n" );

			// Create Paging.
			paging += "<b><a href='#' onmousedown='tiah_showFact(\"fact" + itemCount + "\", "+itemTotal+")'>" + year + "</a></b> &nbsp; ";

			itemCount++;
		}
		// Output Paging.
		if (itemTotal>1) {
			document.write( "	<div class='tiah_row'>More: &nbsp; " + paging + "</div>\n" );
		}

	}

	document.write( "	<div class='tiah_footer'>\n" );
	document.write( "		<div class='tiah_acknowledgements'>&copy;2010 <a href='http://www.DerekClayton.com' target='_blank'>DerekClayton.com</a>" );
	document.write( " &bull; <a href='http://capital2.capital.edu/admin-staff/dalthoff/' target='_blank'>Dave Althoff</a> editor" );
	document.write( " &bull; <a href='http://www.derekclayton.com/tiah/rss/tiah_rss.xml' target='_blank'>RSS</a>" );
	document.write( " &bull; <a href='http://twitter.com/AmusementPark' target='_blank'>Twitter</a></div>\n" );
	document.write( "	</div>\n" );
	document.write( "</div>\n" );
	document.write( "<!-- END: TODAY IN AMUSEMENT HISTORY -->\n\n" );
}


function tiah_clientSideInclude(url) {
	var req = false;
	// For Safari, Firefox, and other non-MS browsers
	if (window.XMLHttpRequest) {
		try {
			req = new XMLHttpRequest();
		} catch (e) {
			req = false;
		}
	} else if (window.ActiveXObject) {
		// For Internet Explorer on Windows
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				req = false;
			}
		}
	}
	if (req) {
		// Synchronous request, wait till we have it all
		req.open('GET', url, false);
		req.send(null);
		document.write( "\n<style type='text/css'>\n" );
		document.write( req.responseText );
		document.write( "\n</style>\n" );
	}
}


function tiah_showFact(factId, factTotal) {
	for (count=0; count<factTotal; count=count+1) {
		var temp = "fact" + count;
		if (temp==factId) {
			document.getElementById(temp).style.visibility = "visible";
			document.getElementById(temp).style.display = "block";
		} else {
			document.getElementById(temp).style.visibility = "hidden";
			document.getElementById(temp).style.display = "none";
		}
	}
}

function tiah_htmlspecialchars_decode(str) {
	str = str.replace(/^\s+|\s+$/g,"");
	str = str.replace(/&lt\;i&gt\;/gi,   "<i>");
	str = str.replace(/&lt\;\/i&gt\;/gi, "</i>");
	str = str.replace(/&lt\;b&gt\;/gi,   "<b>");
	str = str.replace(/&lt\;\/b&gt\;/gi, "</b>");
	str = str.replace(/&lt\;u&gt\;/gi,   "<u>");
	str = str.replace(/&lt\;\/u&gt\;/gi, "</u>");
	return( str );
}