<?xml version="1.0" encoding="UTF-8" ?>
<Module>
	<ModulePrefs title="Chinese Word of the Day" 
		description="Shows a new Chinese word every day. In Simplifed, Traditional, and Mandarin Pinyin"
		screenshot="http://chinesefirststep.com/files/cw_thumb.png"
		thumbnail="http://chinesefirststep.com/files/cw_thumb2.png"
		height="155" 
		width="185"
		scrolling="false"
		author="Rob Rohan" 
	    author_email="robrohan@gmail.com"
		author_link="http://robrohan.com"
		title_url="http://www.chinesefirststep.com" />
	<Content type="html">
	<![CDATA[
	<style type="text/css">
		<style type="text/css">
		div#content {
			text-align: center;
		}
		div.english,
		div#by {
			background: #963719;
			text-align: right;
			color: white;
height: 20px;			
padding: 3px 5px 3px 3px;
		}
		
		div.english {
			font-size: 10pt;
			margin-bottom: 12px;
		}
		div.simp {
			font-size: 20pt;
			text-align: center;
			color: #963719;
			margin-bottom: 5px;
		}
		div.trad {
			font-size: 12pt;
			text-align: center;
			margin-bottom: 8px;
		}
		div.pinyin {
			font-size: 16pt;
			text-align: center;
			margin-bottom: 10px;
		}
		div#by a,
		div#by a:hover,
		div#by a:visited,
		div#by a:link
		{
			font-size: 8pt;
			color: white;
		}
		</style>
	</style>
	<div id="content_div"></div>

        <div id="by"><a href="http://chinesefirststep.com" target="_blank">ChineseFirstStep.com</a></div>
	
	<script type="text/javascript">
		function displayMenu() {
			// XML breakfast menu data
			var url = "http://cn.robrohan.com/feed";

			var prefs = new _IG_Prefs(__MODULE_ID__);
			
			_IG_FetchXmlContent(url, function (response) {
				if (response == null || typeof(response) != "object" || response.firstChild == null) {
					_gel("content_div").innerHTML = "<i>Invalid data.</i>";
					return;
				}

				var html ="";
				var english = "";
				
				var itemList = response.getElementsByTagName("item");
				
				// Loop through all <item> nodes
				//for (var i = 0; i < itemList.length ; i++) {
					var i=0;
					// For each <item> node, get child nodes.
					var nodeList = itemList.item(i).childNodes;
					
					// Loop through child nodes. Extract data from the text nodes that are
					// the children of the associated name, price, and calories element nodes
					for (var j = 0; j < nodeList.length ; j++) {
						var node = nodeList.item(j);
						
						switch(node.nodeName) {
							case "content:encoded":
								html += node.firstChild.nodeValue;
							break;
							
							case "title":
								english = node.firstChild.nodeValue;
								html += "<div class='english'>" + english + "</div>";
							break;
						}
					}
				//}

				// Display HTML string in <div>
				_gel('content_div').innerHTML = html;
			});
		}
	
	_IG_RegisterOnloadHandler(displayMenu);
	</script>
	]]>
	</Content>
</Module>