<?xml version="1.0" encoding="UTF-8"?>
<Module>
	<ModulePrefs title="__MSG_gadgetname__" width="313" height="110" author="Opel" author_email="webmaster@opel.de" description="__MSG_gadgetdescription__" thumbnail="http://www.opel-europe.com/agila2008/gadgets/Countdown/images/THUMB.png" screenshot="http://www.opel-europe.com/agila2008/gadgets/Countdown/images/SCREENSHOT.png">  
		<Require feature="setprefs" />
		<Require feature="analytics" /> 
		<Locale lang="de" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/de_ALL.xml"/>
		<Locale lang="en" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/en_ALL.xml"/>
		<Locale lang="es" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/es_ALL.xml"/>
		<Locale lang="fr" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/fr_ALL.xml"/>
		<Locale lang="it" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/it_ALL.xml"/>
		<Locale lang="nl" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/nl_ALL.xml"/>
		<Locale lang="pt-PT" messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/pt_ALL.xml"/>
		<Locale messages="http://www.opel-europe.com/agila2008/gadgets/Countdown/messages/ALL_ALL.xml"/>
	</ModulePrefs>
	<UserPref name="countdown" datatype="hidden" default_value="__MSG_defaultdate__"/>
	<UserPref name="name" datatype="hidden" default_value="__MSG_defaultname__"/>
	<Content type="html"><![CDATA[
		<style type="text/css">
			div, input, textarea, td,a {
				font-family:Arial,Helvetica,sans-serif;
				font-size:10px;
				color:#ffffff;
				text-align:left;
			}
			input {
				 border:1px solid #ccddee;
				 background-color:#ffffff;
				 height:14px;
				 color:#435164;
			}
			.digit {
				float:left;
				width:29px;
				height:42px;
				background-image:url(http://www.opel-europe.com/agila2008/gadgets/Countdown/images/digits.gif);
				background-position:0px 0px;
			}
		</style>
		<center>
		<div style="margin:auto; width:313px; height:99px; background-image:url(http://www.opel-europe.com/agila2008/gadgets/Countdown/images/background.gif); overflow:hidden;">
			<div style="position:absolute;">
				<div id="countdownname" style="position:absolute; left:10px; top:6px; font-size:18px; font-weight:bold; color:#ffffff; width:250px; overflow:hidden; height:20px;">
				</div>
				<div style="position:absolute; top:39px; left:7px; width:300px; font-size:11px; color:#ffffff;">
					<div style="float:left; width:91px; margin-right:9px; text-align:center; overflow:hidden; color:#ffffff;">
						<div id="d1" class="digit" style="margin-right:2px;"></div>
						<div id="d2" class="digit" style="margin-right:2px;"></div>
						<div id="d3" class="digit"></div>
						__MSG_days__
					</div>
					<div style="float:left; width:60px; margin-right:9px; text-align:center; overflow:hidden; color:#ffffff;">
						<div id="h1" class="digit" style="margin-right:2px;"></div>
						<div id="h2" class="digit"></div>
						__MSG_hours__
					</div>
					<div style="float:left; width:60px; margin-right:9px; text-align:center; overflow:hidden; color:#ffffff;">
						<div id="m1" class="digit" style="margin-right:2px;"></div>
						<div id="m2" class="digit"></div>
						__MSG_minutes__
					</div>
					<div style="float:left; width:60px; margin-right:0px; text-align:center; overflow:hidden; color:#ffffff;">
						<div id="s1" class="digit" style="margin-right:2px;"></div>
						<div id="s2" class="digit"></div>
						__MSG_seconds__
					</div>
				</div>
				<div id="countdownend" style="position:absolute; top:32px; left:0px; width:313px; height:67px; background-image:url(http://www.opel-europe.com/agila2008/gadgets/Countdown/images/background.gif); background-position:bottom; display:none;">
					<div style="padding:10px; padding-top:15px; font-size:24px; font-weight:bold; text-align:center" id="countdownendtext">
					</div>
				</div>
				<div style="position:absolute; left:105px; top:13px; width:200px; text-align:right;">
					<a href="javascript:ShowInput()" style="color:#ffffff; font-size:10px;">__MSG_setcountdown__</a>
				</div>
				<div id="inputcountdown" style="position:absolute; top:0px; left:0px; width:313px; height:99px; background-image:url(http://www.opel-europe.com/agila2008/gadgets/Countdown/images/background.gif); display:none;">
					<div style="position:absolute; left:10px; top:6px; font-size:18px; font-weight:bold; color:#ffffff;">
						__MSG_settings__
					</div>
					<div style="position:absolute; left:10px; top:37px;">
						<table border="0" cellpadding="0" cellspacing="2">
							<tr>
								<td>
									__MSG_name__:		
								</td>
								<td colspan="2">
									<input name="inputname" id="inputname" style="width:150px;" maxlength="25"><br>
								</td>
							</tr>
							<tr>
								<td>
									__MSG_date__:		
								</td>
								<td>
									<input name="inputday" id="inputday" style="width:20px;" maxlength="2">.<input name="inputmonth" id="inputmonth" style="width:20px;" maxlength="2">.<input name="inputyear" id="inputyear" style="width:40px;" maxlength="4"><br>
								</td>
							</tr>
							<tr>
								<td>
									__MSG_time__:	
								</td>
								<td>
									<input name="inputhour" id="inputhour" style="width:20px;" maxlength="2">:<input name="inputminute" id="inputminute" style="width:20px;" maxlength="2"><br>
								</td>
								<td>
									<table border="0" cellpadding="0" cellspacing="0" width="150">
										<tr>
											<td>
												<a href="javascript:SetCountdown()" style="color:#ffffff; font-size:10px;">
													__MSG_save__
												</a>
											</td>
											<td align="right">
												<a href="javascript:HideInput()" style="color:#ffffff; font-size:10px;">
													__MSG_abort__
												</a>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</div>
				</div>
			</div>
		</div>	
		<div style="margin:auto; width:300px; font-size:10px;">
			<a href="http://www.google.com/ig/directory?hl=de&url=hosting.gmodules.com/ig/gadgets/file/107652442397233876139/AgilaCountdown.xml" style="color:#435164;" target="_top">
				__MSG_addcountdown__<br>
			</a>								
		</div>
		</center>
		
			
		<script type="text/javascript">
			// Get user preferences
			var prefs = new _IG_Prefs(__MODULE_ID__);
			var countdowndate;
			var year, month, day, hour, minute, name;
			
			function GetCountdowndate ()
			{
				countdown = prefs.getString("countdown");
				daytime = countdown.split(" ");
				daymonthyear = daytime[0].split(".");
				hourminute = daytime[1].split(":"); 
								
				day = daymonthyear[0];
				month = daymonthyear[1]; 
				year = daymonthyear[2];
				
				hour = hourminute[0];
				minute = hourminute[1];
				
				name = prefs.getString("name");
				document.getElementById("countdownname").innerHTML = name;
				
		    	countdowndate = new Date(year,month-1,day,hour,minute,0);
			}
			
			function SetDigit (id, value)
			{
				document.getElementById(id).style.backgroundPosition = "0px -" + (value*43) + "px";
			}
			
			function Countdown ()
			{
		        var diff = Math.floor((countdowndate.getTime() - (new Date()).getTime())/1000);
		        
				if (diff > 0)
				{
            		var seconds = diff%60;
            		
            		var s2 = seconds%10;
					var s1 = (Math.floor(seconds/10))%6;

            		diff = Math.floor(diff/60);
            		
            		var minutes = diff%60;
            		var m2 = minutes%10;
					var m1 = (Math.floor(minutes/10))%6;
            
            		diff = Math.floor(diff/60);
            		
            		hours = diff%24;
            		var h2 = hours%10;
            		var h1 = (Math.floor(hours/10))%3;
            		
            		diff = Math.floor(diff/24);
            		
            		var days = diff%1000;
            		var d3 = days%10;
            		days = Math.floor(days/10);
            		var d2 = days%10;
            		days = Math.floor(days/10);
            		var d1 = days%10;

		
					SetDigit ("s2",s2);
					SetDigit ("s1",s1);
					SetDigit ("m2",m2);
					SetDigit ("m1",m1);
					SetDigit ("h2",h2);
					SetDigit ("h1",h1);
					SetDigit ("d3",d3);
					SetDigit ("d2",d2);
					SetDigit ("d1",d1);
				}				
				else
				{
					document.getElementById("countdownendtext").innerHTML = prefs.getString("countdown") + "!";
					document.getElementById('countdownend').style.display='block';
				}
			}
			
			function ShowInput ()
			{
				document.getElementById("inputcountdown").style.display="block";
				document.getElementById("inputday").value=day;
				document.getElementById("inputmonth").value=month;
				document.getElementById("inputyear").value=year;
				document.getElementById("inputhour").value=hour;
				document.getElementById("inputminute").value=minute;
				document.getElementById("inputname").value=name;
			}
			
			function HideInput ()
			{
				document.getElementById('inputcountdown').style.display='none';
				document.getElementById('countdownend').style.display='none';
			}
			
			function SetCountdown ()
			{
				day = document.getElementById("inputday").value;
				month = document.getElementById("inputmonth").value;
				year = document.getElementById("inputyear").value;
				hour = document.getElementById("inputhour").value;
				minute = document.getElementById("inputminute").value;
				name = document.getElementById("inputname").value;
				
		    	countdowndate = new Date(year,month-1,day,hour,minute,0);

		    	minutes2digits = countdowndate.getMinutes();
		    	if (minutes2digits<10)
		    	{
		    		minutes2digits = "0" + minutes2digits;
		    	}
		    	
		    	var countdown = countdowndate.getDate() + "." + (countdowndate.getMonth()+1) + "." + countdowndate.getFullYear() + " " + countdowndate.getHours() + ":" + minutes2digits;
				prefs.set("name", name);
				prefs.set("countdown", countdown);
				HideInput ();
				GetCountdowndate();
			}
			
			GetCountdowndate();
			setInterval("Countdown()",1000);

			_IG_Analytics("UA-4220844-1", "/AgilaCountdown");
			
		</script>
	]]></Content>
</Module>



