//showtime("tu tekst wprowadzajacy ","tu data z godzina feb 28, 2006 22:32")

msPerDay = 24 * 60 * 60 * 1000 ;
function showtime(Prompt,Dzien) {
today = new Date();
BigDay = new Date(Dzien);
if (today >= BigDay) {
return "";    //jak termin minal to nic nie wyswietla
} else {
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
tdays = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
var msg= " "+Liczebnik( daysLeft, "został"," ","y ","o " ) +
daysLeft+Liczebnik( daysLeft, " ","dzień, ","dni, ","dni, " ) +
hrsLeft +Liczebnik( hrsLeft," godzin", "a","y","" ) +" i "+
minsLeft+Liczebnik( minsLeft," minut", "a ","y "," " )+" ";
return Prompt + msg;}
}
function Liczebnik( ile, rdzen, konc1, konc2, konc5 ) { // Autor Romuald Zylla
var N0, N1, N2, R0;
N0 = Math.floor( Math.abs( ile ) ); // funkcja ma sens dla liczb ca^(3)kowitych
N1 = N0 % 10;
N2 = N0 % 100;
R0 = konc1;
if (N0 == 1) R0 = konc1
else if ((N2 > 4) && (N2 < 22)) R0 = konc5
else if ((N1 > 1) && (N1 <= 4)) R0 = konc2
else R0 = konc5;
return rdzen + R0;
}

function showtime_(Prompt,Dzien) {
today = new Date();
BigDay = new Date(Dzien);
if (today < BigDay) {
return "";    //jak termin jeszcze nie nadszedł to nic nie wyswietla
} else {
timeLeft = (today.getTime() - BigDay.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
tdays = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
var msg= " " +
daysLeft+Liczebnik( daysLeft, " ","dzień, ","dni, ","dni, " ) +
hrsLeft +Liczebnik( hrsLeft," godzin", "a","y","" ) +" i "+
minsLeft+Liczebnik( minsLeft," minut", "a ","y "," " )+" ";
return Prompt + msg;}
}

function showdays(Prompt,Dzien) {
today = new Date();
BigDay = new Date(Dzien);
if (today > BigDay) {
return "";    //jak termin jeszcze nie nadszedł to nic nie wyswietla
} else {
timeLeft = ( - today.getTime() + BigDay.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
tdays = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
var msg= "( "+Liczebnik( daysLeft, "pozostał"," ","y ","o " ) + " " +
daysLeft+Liczebnik( daysLeft, " ","dzień ","dni ","dni " ) + ")";
return Prompt + msg;}
}