﻿/*
	 ___    ___
	|   \  /   | Michael Buchner
	|    \/    | Kommunikations-Design
	|  |\  /|  |
	|  | \/ |  | (c) 2009
	|__|    |__| www.michael-buchner.de

*/

	var end = new Date("February 1, 2010 00:00:00 GMT+0200");

	document.write('<span id="time"><img src="0.gif" border="0" /><img src="0.gif" border="0" /><img src="_.gif" border="0" /><img src="0.gif" border="0" /><img src="0.gif" border="0" /><img src="_.gif" border="0" /><img src="0.gif" border="0" /><img src="0.gif" border="0" /><img src="_.gif" border="0" /><img src="0.gif" border="0" /><img src="0.gif" border="0" /><img src="_.gif" border="0" /><img src="0.gif" border="0" /><img src="0.gif" border="0" /></span>');

	function ziffern(zahl) {
		s = "";
		if (zahl < 10) {
			s += "0";
		} return (s + zahl).toString();
	}

	function countdown() {
		d = new Date();
		count = Math.floor(end.getTime() - d.getTime());
		if(count > 0) {
			miliseconds = ziffern(count%1000);
			miliseconds = miliseconds.substr(0, 2)
			str_mil = String(miliseconds);
			mil_ausgabe = [];
			for(i = 0; i < str_mil.length; i++) {
				mil_nummern = str_mil.substr(i, 1);
				mil_ausgabe[i] = '' + mil_nummern + '';
			}
			count = Math.floor(count/1000);

			seconds = ziffern(count%60);
			str_s = String(seconds);
			s_ausgabe = [];
			for(i = 0; i < str_s.length; i++) {
				s_nummern = str_s.substr(i, 1);
				s_ausgabe[i] = '' + s_nummern + '';
			}
			count = Math.floor(count/60);

			minutes = ziffern(count%60);
			str_m = String(minutes);
			m_ausgabe = [];
			for(i = 0; i < str_m.length; i++) {
				m_nummern = str_m.substr(i, 1);
				m_ausgabe[i] = '' + m_nummern + '';
			}
			count = Math.floor(count/60);

			hours = ziffern(count%24);
			str_h = String(hours);
			h_ausgabe = [];
			for(i = 0; i < str_h.length; i++) {
				h_nummern = str_h.substr(i, 1);
				h_ausgabe[i] = '' + h_nummern + '';
			}
			count = Math.floor(count/24);

			days = ziffern(count);
			str_d = String(days);
			d_ausgabe = [];
			for(i = 0; i < str_d.length; i++) {
				d_nummern = str_d.substr(i, 1);
				d_ausgabe[i] = '' + d_nummern + '';
			}

			if (str_d.length == 3) {
				days = '<img src="' + d_ausgabe[0] + '.gif" border="0" /><img src="' + d_ausgabe[1] + '.gif" border="0" /><img src="' + d_ausgabe[2] + '.gif" border="0" />';
			}
			if (str_d.length == 2) {
				days = '<img src="' + d_ausgabe[0] + '.gif" border="0" /><img src="' + d_ausgabe[1] + '.gif" border="0" />';
			}
			if (str_d.length < 2) {
				days = '<img src="0.gif" border="0" /><img src="' + d_ausgabe[0] + '.gif" border="0" />';
			}

		} else {
			days = '<img src="0.gif" border="0" /><img src="0.gif" border="0" />';
			h_ausgabe[0] = 0;
			h_ausgabe[1] = 0;
			m_ausgabe[0] = 0;
			m_ausgabe[1] = 0;
			s_ausgabe[0] = 0;
			s_ausgabe[1] = 0;
			mil_ausgabe[0] = 0;
			mil_ausgabe[1] = 0;
		}
		
		document.getElementById('time').innerHTML = days + '<img src="_.gif" border="0" /><img src="' + h_ausgabe[0] + '.gif" border="0" /><img src="' + h_ausgabe[1] + '.gif" border="0" /><img src="_.gif" border="0" /><img src="' + m_ausgabe[0] + '.gif" border="0" /><img src="' + m_ausgabe[1] + '.gif" border="0" /><img src="_.gif" border="0" /><img src="' + s_ausgabe[0] + '.gif" border="0" /><img src="' + s_ausgabe[1] + '.gif" border="0" /><img src="_.gif" border="0" /><img src="' + mil_ausgabe[0] + '.gif" border="0" /><img src="' + mil_ausgabe[1] + '.gif" border="0" />';
		setTimeout("countdown()", 50);
	}

	window.onload=countdown;