// // This file contains functions for a server based // new year counter witch client side second counts. // This file is based on many other counters. // The counter is copyrighted 2005. // Feel free to hack it for urself. // // Date Name Description // 01.12.2005 A.B. pOo@feuerwerk.net created // // // global var defines. initialized 0 values. var nTDWeek0 = 0; var nTDWeek1 = 0; var nTDDay0 = 0; var nTDDay1 = 0; var nTDHour0 = 0; var nTDHour1 = 0; var nTDMinute0 = 0; var nTDMinute1 = 0; var nTDSecond0 = 0; var nTDSecond1 = 0; // the ClientBase Date, for counting the seconds datBaseClientDate = new Date(); // mozilla fix. no prob since 2k5. if (document.all) { Tick(); // register the clientside tick handler window.setInterval('Tick()', 1000); } else { // register the clientside tick handler window.setTimeout('Tick()', 1000); } // the function to handle the updating stuff function Tick() { dateDiff(); if (!document.all) { window.setTimeout('Tick()', 1000); } } // function to make the difference ;) function dateDiff() { /* // init the dates 2 compare date1 = new Date(2017, 1, 1, 0, 0, 0); date2 = new Date(2016, 8, 14, 14, 20, 09); */ // init the dates 2 compare date1 = new Date ("January 1 2017 0:00:00"); date2 = new Date ("August 14 2016 14:20:09"); diff = new Date(); // sets difference date to difference of first date and second date datActClientDate = new Date(); nDiffCount = Math.floor((datActClientDate.getTime() - datBaseClientDate.getTime()) /1000); diff.setTime(Math.abs(date1.getTime() - (date2.getTime()+(nDiffCount*1000)))); timediff = diff.getTime(); //weeks = Math.floor(timediff / (1000 * 60 * 60 * 24 * 7)); //timediff -= weeks * (1000 * 60 * 60 * 24 * 7); days = Math.floor(timediff / (1000 * 60 * 60 * 24)); timediff -= days * (1000 * 60 * 60 * 24); hours = Math.floor(timediff / (1000 * 60 * 60)); timediff -= hours * (1000 * 60 * 60); mins = Math.floor(timediff / (1000 * 60)); timediff -= mins * (1000 * 60); secs = Math.floor(timediff / 1000); timediff -= secs * 1000; nValue = 0; // only for week display //nValue = (weeks % 10); //if (nTDWeek1 != nValue || nDiffCount <= 1) //{ //nTDWeek1 = nValue; //document.getElementById('TDWeek1').innerHTML = nValue; //} //Value = Math.floor(weeks / 10); //if (nTDWeek0 != nValue || nDiffCount <= 1) //{ //nTDWeek0 = nValue; //document.getElementById('TDWeek0').innerHTML = nValue; //} nValue = (days % 10); if (nTDDay1 != nValue || nDiffCount <= 1) { nTDDay1 = nValue; document.getElementById('TDDay1').innerHTML = nValue; } nValue = Math.floor(days / 10); if (nTDDay0 != nValue || nDiffCount <= 1) { nTDDay0 = nValue; document.getElementById('TDDay0').innerHTML = nValue; } nValue = (hours % 10); if (nTDHour1 != nValue || nDiffCount <= 1) { nTDHour1 = nValue; document.getElementById('TDHour1').innerHTML = nValue; } nValue = Math.floor(hours / 10); if (nTDHour0 != nValue || nDiffCount <= 1) { nTDHour0 = nValue; document.getElementById('TDHour0').innerHTML = nValue; } nValue = (mins % 10); if (nTDMinute1 != nValue || nDiffCount <= 1) { nTDMinute1 = nValue; document.getElementById('TDMinute1').innerHTML = nValue; } nValue = Math.floor(mins / 10); if (nTDMinute0 != nValue || nDiffCount <= 1) { nTDMinute0 = nValue; document.getElementById('TDMinute0').innerHTML = nValue; } nValue = (secs % 10); if (nTDSecond1 != nValue || nDiffCount <= 1) { nTDSecond1 = nValue; document.getElementById('TDSecond1').innerHTML = nValue; } nValue = Math.floor(secs / 10); if (nTDSecond0 != nValue || nDiffCount <= 1) { nTDSecond0 = nValue; document.getElementById('TDSecond0').innerHTML = nValue; } return false; // form should never submit, returns false }