function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } function i18n(text) { return text; } function FormatDigit(digit) { if(digit.length == 0) { return "00"; } if(digit.length == 1) { return "0" + digit; } return digit; } function GetTimeStr() { var dt=new Date() var h = dt.getHours().toString(); var m = dt.getMinutes().toString(); var s = dt.getSeconds().toString(); return FormatDigit(h) + ":" + FormatDigit(m) + ":" + FormatDigit(s); } function ClockInTitle() { document.title = i18n("Bonne Année ") + GetTimeStr(); //setTimeout("ClockInTitle()",1000); } ClockInTitle(); function Pause(time) { var d=new Date(); while(1) { var n = new Date(); var diff = n-d; if (diff > time) break; } } /*Get controls*/ var new_year_text = $("#new_year_text"); var new_year_count = $("#new_year_count"); var next_year_val; var next_year; var coef=1000; var colors; function resetcolors() { colors = [ "#3B0B17", "#610B21", "#8A0829", "#B40431", "#DF013A", "#FF0040", "#FE2E64", "#FA5882", "#F7819F", "#F5A9BC" ]; } resetcolors(); function calcNextYear() { next_year_val = new Date().getFullYear() + 1; next_year = new Date("01/01/" + next_year_val + " 00:00:00"); } var loop = 0; var phase = 1; function CountDown() { /*Init years*/ var now = new Date(); var countdown = Math.round((next_year.getTime() - now.getTime()) / coef); /*remove divs*/ if(countdown < 1 ) { new_year_count.text("YOUPI !! Bonne Année !!"); setTimeout(calcNextYear, 60000); } else { var displayunit = (gup("unit") == "1") || (gup("unit") == ""); var count_S = countdown+""; var count_T = count_S.split(""); $(".t_css").text("0"); for(var j=0;j<8;j++) { $("#t"+j).css("color", colors[j]); } new_year_text.css("color", colors[0]); if(loop < 7 && phase > 0) { loop++; colors.unshift(colors.pop()); } else { phase = 1; resetcolors(); loop = 0; //loop--; //colors.push(colors.shift()); } if(phase < 0 && loop < 0) { phase = 1; } for(var i=count_T.length;i>=0;i--) { $("#t"+(8-(count_T.length-i))).text(count_T[i]); } var formatedCounter = "Nouvel an dans: " + FormatDigit(""+(parseInt(countdown/60/60/24))+" jours "+(parseInt(countdown/60/60))%24) + " heures " +FormatDigit(""+(parseInt(countdown/60))%60)+ " minutes " + FormatDigit(""+countdown%60) + " secondes"; document.title = formatedCounter; $("#tsimple").text(formatedCounter); } setTimeout("CountDown()",1000/8); } calcNextYear(); CountDown();