
// ****  Time Zone Count Down Javascript  **** //
/*
Visit http://rainbow.arch.scriptmania.com/scripts/
 for this script and many more
*/

////////// CONFIGURE THE COUNTDOWN SCRIPT HERE //////////////////

var monthup = '0';     //  '*' for next month, '0' for this month or 1 through 12 for the month 
var dayup = '+1';        //  Offset for day of month day or + day  
var hourup = 22;        //  0 through 23 for the hours of the day
var tzup = -4;          //  Offset for your timezone in hours from UTC
var labup = 'upcd';      //  The id of the page entry where the timezone countdown is to show

//function startup() {displayTZCountDownup(setTZCountDownup(monthup,dayup,hourup,tzup),labup);}

    // **    The start function can be changed if required   **
//window.onload = start();startup();

////////// DO NOT EDIT PAST THIS LINE //////////////////

function setTZCountDownup(monthup,dayup,hourup,tzup) 
{
var toDateup = new Date();
if (monthup == '*')toDateup.setMonth(toDateup.getMonth() + 1);
else if (monthup > 0) 
{ 
if (monthup <= toDateup.getMonth())toDateup.setYear(toDateup.getYear() + 1);
toDateup.setMonth(monthup-1);
}
if (dayup.substr(0,1) == '+') 
{var day1up = parseInt(dayup.substr(1));
toDateup.setDate(toDateup.getDate()+day1up);
} 
else{toDateup.setDate(dayup);
}
toDateup.setHours(hourup);
toDateup.setMinutes(0-(tzup*60));
toDateup.setSeconds(0);
var fromDateup = new Date();
fromDateup.setMinutes(fromDateup.getMinutes() + fromDateup.getTimezoneOffset());
var diffDateup = new Date(0);
diffDateup.setMilliseconds(toDateup - fromDateup);
return Math.floor(diffDateup.valueOf()/1000);
}
function displayTZCountDownup(countdownup,upcd) 
{
if (countdownup < 0) document.getElementById(upcd).innerHTML = ""; 
else {var secsup = countdownup % 60; 
if (secsup < 10) secsup = '0'+secsup;
var countdown1up = (countdownup - secsup) / 60;
var minsup = countdown1up % 60; 
if (minsup < 10) minsup = '0'+minsup;
countdown1up = (countdown1up - minsup) / 60;
var hoursup = countdown1up % 24;
var daysup = (countdown1up - hoursup) / 24;
document.getElementById(upcd).innerHTML = +hoursup+ 'hours : ' +minsup+ 'min : '+secsup+'sec';
setTimeout('displayTZCountDownup('+(countdownup-1)+',\''+upcd+'\');',999);
}
}
