function countdown_clock(year, month, day, hour, minute, i, timediff, javaend, textend, textevent, text_day, text_days, text_hour, text_minute, text_second, text_before, text_until, text_since, show, link) { html_code = ''; document.write(html_code); countdown(year, month, day, hour, minute, i, timediff, javaend, textend, textevent, text_day, text_days, text_hour, text_minute, text_second, text_before, text_until, text_since, show, link); } function countdown(year, month, day, hour, minute, i, timediff, javaend, textend, textevent, text_day, text_days, text_hour, text_minute, text_second, text_before, text_until, text_since, show, link) { until_text = text_until; eventtext = textevent; Today = new Date(); pdc_servergmt = -5 pdc_gmt = pdc_servergmt + Today.getTimezoneOffset()/60; Todays_Hour = Today.getHours() + pdc_gmt + timediff; //Convert both today's date and the target date into milliseconds. Todays_Date = (new Date(Today.getFullYear(), Today.getMonth(), Today.getDate(), Todays_Hour, Today.getMinutes(), Today.getSeconds())).getTime(); Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime(); // Find their difference, and convert that into seconds. Time_Left = Math.round((Target_Date - Todays_Date) / 1000); Unmod_Time = Time_Left; if(Time_Left > 0) { days = Math.floor(Time_Left / (60 * 60 * 24)); Time_Left %= (60 * 60 * 24); hours = Math.floor(Time_Left / (60 * 60)); Time_Left %= (60 * 60); minutes = Math.floor(Time_Left / 60); Time_Left %= 60; seconds = Time_Left; } else if(Time_Left < 0) { // Continue counting in negative numbers if (javaend == 2 ) { days = Math.ceil(Time_Left / (60 * 60 * 24)); Time_Left %= (60 * 60 * 24); hours = Math.ceil(Time_Left / (60 * 60)); Time_Left %= (60 * 60); minutes = Math.ceil(Time_Left / 60); Time_Left %= 60; seconds = Time_Left; } // Continue counting in positive numbers and time since else if (javaend == 3 ) { days = Math.abs(Math.ceil(Time_Left / (60 * 60 * 24))); Time_Left %= (60 * 60 * 24); hours = Math.abs(Math.ceil(Time_Left / (60 * 60))); Time_Left %= (60 * 60); minutes = Math.abs(Math.ceil(Time_Left / 60)); Time_Left %= 60; seconds = Math.abs(Time_Left); until_text = text_since; eventtext = textend; } // Simply stop at zero else { days = 0; hours = 0; minutes = 0; seconds = 0; } } sleeps = text_days; // show day or days if(Math.abs(days) == 1) sleeps = text_day; pdc_div = document.getElementById('pdc_item' + i); if (javaend == 0 && Unmod_Time < 0) { pdc_div.innerHTML = ''; } else { if (days < 10) days = '0'+days; if (hours < 10) hours = '0'+hours; if (minutes < 10) minutes = '0'+minutes; if (seconds < 10) seconds = '0'+seconds; if (link) { link1 = ""; link2 = ""; } else { link1 = ""; link2 = ""; } var monthArray = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; part1 = '

'; part2 = ''; part3 = ''; part4 = ''; part5 = '
' + days + ':' + hours + ':' + minutes + ':' + seconds + '
days hours mins secs
'+monthArray[month]+'
'+day+'
' + link1 + eventtext + link2 + '
' +textend + '

'; if (show == 1) { pdc_div.innerHTML = part1 + part2 + part3 + part4 + part5; } else { pdc_div.innerHTML = part1 + part4 + part5; } } // Recursive call, keeps the clock ticking textend = textend.replace(/\'/g,'\\\''); textevent = textevent.replace(/\'/g,'\\\''); setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + i + "," + timediff + ',' + javaend + ',\'' + textend + '\',\'' + textevent + '\',\'' + text_day + '\',\'' + text_days + '\',\'' + text_hour + '\',\'' + text_minute + '\',\'' + text_second + '\',\'' + text_before + '\',\'' + text_until + '\',\'' + text_since + '\',\'' + show + '\',\'' + link + '\');', 1000); }