function formatageDate(chaine){var resultat;if(chaine<=9)resultat="0"+chaine;else resultat=chaine;return resultat}function calculdiff(idclock,datedeb,datefin,target){var T1=datedeb.split("-"),T2=datefin.split("-"),NewDateDeb=new Date(T1[0]+"/"+T1[1]+"/"+T1[2]+" "+T1[3]+":"+T1[4]+":"+T1[5]),NewDateFin=new Date(T2[0]+"/"+T2[1]+"/"+T2[2]+" "+T2[3]+":"+T2[4]+":"+T2[5]),Diff=Math.floor((NewDateFin-NewDateDeb)/1e3);affReste(idclock,Diff,target)}function affReste(idclock,reste,target){var texte="",id_clock="clock"+idclock,sec_reste=reste-1,j,h,m,s,tps=reste-1;if(tps>3600){h=Math.floor(tps/3600);tps=tps%3600}else h=0;if(tps>60){m=Math.floor(tps/60);tps=tps%60}else m=0;s=Math.floor(tps);if(j>0)texte=j+"j "+formatageDate(h)+":"+formatageDate(m)+":"+formatageDate(s);else if(h>0)texte=texte+formatageDate(h)+"h "+formatageDate(m)+"m "+formatageDate(s)+"s";else if(m>0)texte=texte+formatageDate(m)+"m "+formatageDate(s)+"s";else texte=texte+formatageDate(s)+"s";if(idclock=="nes")if(sec_reste>=0)document.writeln("<b>Plus que"+texte+"</b>");else document.writeln("<b>Trop tard !</b>");else if(sec_reste>=0){if(target=="f")document.all[id_clock].innerHTML="Plus que "+texte+" !";else document.all[id_clock].innerHTML="Plus que<br />"+texte;setTimeout("affReste('"+idclock+"', '"+sec_reste+"', '"+target+"')",1e3)}else document.all[id_clock].innerHTML="Trop tard !"}function disp_clock(idclock,dateact,datefin,target){var currentTime=new Date,currentYear=currentTime.getFullYear()-2e3,currentMounth=currentTime.getMonth()+1;dateact=formatageDate(currentYear)+"-"+formatageDate(currentMounth)+"-"+formatageDate(currentTime.getDate())+"-"+formatageDate(currentTime.getHours())+"-"+formatageDate(currentTime.getMinutes())+"-"+formatageDate(currentTime.getSeconds());if(document.all){document.writeln('<div id="clock'+idclock+'"></div>');setTimeout("calculdiff('"+idclock+"', '"+dateact+"', '"+datefin+"', '"+target+"')",200)}else calculdiff("nes",dateact,datefin,target)};
