<?php
/**
* @author Tobias Riefer
* @copyright 2009
*/
echo '
<script type="text/javascript">
var countdown_year = 2009;
var countdown_month = 12;
var countdown_day = 11;
var countdown_hour = 17;
var countdown_minute = 30;
var countdown_secound = 0;
var countdown_finishtext = "Ich habe Urlaub, und Ihr? ;p";
function display_countdown() {
var now = new Date();
var finish = new Date(countdown_year, countdown_month-1, countdown_day, countdown_hour, countdown_minute, countdown_secound);
var millisecoundsFinish = finish.getTime()-now.getTime();
var temp = Math.floor(millisecoundsFinish/1000);
var text = "";
var days = 0;
var hours = 0;
var minutes = 0;
var secounds = 0;
if(temp >= 86400) {
days = Math.floor(temp/86400);
temp = temp-days*86400;
}
if(temp >= 3600) {
hours = Math.floor(temp/3600);
temp = temp-hours*3600;
}
if(temp >= 60) {
minutes = Math.floor(temp/60);
temp = temp-minutes*60;
}
if(temp >=0) {
secounds = temp;
}
days = (days<10 ? "0"+days : days);
hours = (hours<10 ? "0"+hours : hours);
minutes = (minutes<10 ? "0"+minutes : minutes);
secounds = (secounds<10 ? "0"+secounds : secounds);
if(days != "01") {
text += days + " Tagen ";
} else {
text += days + " Tag ";
}
text+="<br>";
if(hours != "01") {
text += hours + " Stunden ";
} else {
text += hours + " Stunde ";
}
text+="<br>";
if(minutes != "01") {
text += minutes + " Minuten ";
} else {
text += minutes + " Minute ";
}
text+="<br>";
if(secounds != "01") {
text += secounds + " Sekunden ";
} else {
text += secounds + " Sekunde ";
}
if(days>0 || hours>0 || minutes>0 || secounds>0) {
document.getElementById(\'countdown_timefield\').innerHTML = text;
window.setTimeout("display_countdown()", 1000);
} else {
document.getElementById(\'countdown_timefield\').innerHTML = countdown_finishtext;
}
}
</script>
<div id=\'countdown_timefield\' ></div>
<script type="text/javascript">
display_countdown();
</script>
';
?>
|