/*
 * countdown.js 1.3
 * by Jonas "Veers" Wagner
 * http://www.veers.net
 *
 * Some additional bugfixes were done by
 * Pascal Hartig
 *
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307, USA.
 */
var ctime = 0;
var t = 0;
var element = 0;
var url = false;

function countdown(time, target){
document.write('<span id="countdown">Calculating</span>');
 ctime = time;
if(arguments.length > 1)
url = target;
element = document.getElementById('countdown');
count();
t = window.setInterval('count()',1000);
}
function count(){
var left = ctime;
if(left <= 0){
end();
window.clearInterval(t);
        }
        var days = Math.floor(left/86400);
left -= days*86400;
var hours = Math.floor(left/3600);
left -= hours*3600;
var minutes = Math.floor(left/60);
left -= minutes*60;
var seconds=left;
ctime -= 1;
var out = '';
        if(days>0){
out = out + days + ' Tag';
if(days > 1) out = out + 'e';
out = out + ' ';
}
if(hours>0){
out = out + hours + ' Stunde';
if(hours > 1) out = out + 'n';
out = out + ' ';
 }
if(minutes>0 && days == 0){
out = out + minutes + ' Minute';
if(minutes > 1) out = out + 'n';
out = out + ' ';
}
if(seconds>0 && days == 0 && hours == 0 ){
out = out + seconds;
                // fuer etwas mehr Laufruhe :)
                if(seconds < 10) out = out + '&nbsp;';
                out = out + ' Sekunde';
if(seconds != 1) out = out + 'n';
out = out + ' ';
}
if(seconds>0)
element.innerHTML = out;
}
function end(){
if(url){
element.innerHTML = '<a href="'+url+'" style="color: green; font-weight: bold">bereit</a>';
window.location.href=url;
}
else {
element.style.color = 'green';
element.style.fontWeight = 'bold';
element.innerHTML = 'bereit';
}
}
// @FPWxUCf42X/
