<?xml version="1.0" encoding="UTF-8" ?>
<Module>
	<ModulePrefs
		title="Wikipedia POD"
		title_url="http://en.wikipedia.org/wiki/Wikipedia:Picture_of_the_day"
		directory_title="Wikipedia Photo of the Day"
		description="Wikipedia Photo of the Day"
		author="Cameron Hall"
		author_email="drbeagledotcom+modulefeedback@gmail.com"
    author_affiliation="Cornell University Student"
		author_location="Ithaca, NY, USA"
		screenshot="http://drbeagledotcom.googlepages.com/wppod.png"
		thumbnail="http://drbeagledotcom.googlepages.com/wppodtb.png"
    scaling="false"
		render_inline="optional"
    author_photo="http://drbeagledotcom.googlepages.com/profile.png"
    author_aboutme="2008 Information Science student at Cornell University. Enjoy doing work, but love getting distracted by google modules."
    author_link="http://drbeagle.com/"
    author_quote="So long, and thanks for all the fish"
		>
		<Require feature="dynamic-height" />
		<Require feature="analytics" />
	</ModulePrefs>
	<UserPref name="FSZ" 
		display_name="Font Size" 
		datatype="string" 
		default_value="8" 
		required="true" />
	<UserPref name="MXH" 
		display_name="Max Height" 
		datatype="string" 
		default_value="300" 
		required="true" />
	<Content type="html">
		<![CDATA[
<div
	id="WikipediaPOD"
	style="
		margin: 0px auto;
		text-align: center;
	">
</div>
<p
	id="theWidth"
	style="
		font-size: 8px;
		font-weight: bold;
		margin: 0 auto;
		text-align: center;
	">
</p>
	<script type="text/javascript">
		var pod = 'http://en.wikipedia.org/wiki/Wikipedia:Picture_of_the_day';
		var base = 'http://upload.wikimedia.org';
		var html = "";
		var htmlp = "";
		var maxHeight = 0;
		
		function getPOD(maxH, fontSize) {
			maxHeight = maxH;
			_gel('theWidth').style.fontSize = fontSize;
			htmlp += '<a href="'+pod+'/Archive" style="font-size: '+fontSize * .75+'; font-weight: normal;" ';
			htmlp += ' text-decoration: none; target="_blank">POD Archive</a> - ';
			_IG_FetchContent(pod, function (responseText) {
				if (responseText == "") {
					html += '<a href="'+pod+'" target="_blank">';
					html += '<img id="wppodimg" src="http://drbeagledotcom.googlepages.com/wppoderror.png" onload="reSize();" border="0"></a><br />';
					htmlp += 'Gadget Error, check back later'
					_gel('WikipediaPOD').innerHTML = html;
					return;
				} else {
					var c = responseText;
					RegExp.multiline = true;
					var regExp = /\/wikipedia\/[a-zA-Z]+\/thumb\/[a-zA-Z0-9]\/[a-zA-Z0-9]+\/[a-zA-Z0-9._%\-]*\/[a-zA-Z0-9._%\-]*/;
					var imgA = regExp.exec(c);
					var imgL = base+imgA[0];
					html += '<a href="'+pod+'" target="_blank">';
					html += '<img id="wppodimg" src="'+imgL+'" onload="reSize();" border="0"></a><br />';
					_gel('WikipediaPOD').innerHTML = html;
					RegExp.multiline = true;
					var regExpb = /class="image" title="[a-zA-Z0-9._%\-,\s]+">/;
					var info = regExpb.exec(responseText);
					var end = info[0].length - 2;
					htmlp += info[0].substring(21, end);
				}
			});
		}
		function reSize(){
				var x = _gel('wppodimg');
	      var p = _gel('theWidth');
				var maxWidth = p.offsetWidth;
				var pWidth = maxWidth/x.width;
				var pHeight = maxHeight/x.height;
				var w = 10;
				var h = 10;
				if(pWidth <= pHeight){
					var w = parseInt(x.width * pWidth);
					var h = parseInt(x.height * pWidth);
				}else{
					var w = parseInt(x.width * pHeight);
					var h = parseInt(x.height * pHeight);
				}
				x.width = w;
				x.height = h;
				_gel('theWidth').innerHTML = htmlp;
				_IG_AdjustIFrameHeight();
		}
		
		_IG_RegisterOnloadHandler(getPOD("__UP_MXH__", "__UP_FSZ__"));
		_IG_Analytics("UA-1238140-3", "/wppod");
		_IG_AdjustIFrameHeight();
	</script>
		]]>
	</Content>
</Module>