//######################################################################################
// Author: ricocheting.com
// For: public release (freeware)
// Date: 4/24/2003 (update: 5/15/2009)
// Description: displays the amount of time until the "dateFuture" entered below.

// TESTING: comment out the line below to print out the "dateFuture" for testing purposes
//document.write(dateFuture +"<br />");
dateNow = new Date();
dateFuture = dateNow.getTime() + 11000;
delete dateNow;

//###################################
//nothing beyond this point
function GetCount(){

    dateNow = new Date();           //grab current time
    amount = dateFuture - dateNow.getTime();		//calc milliseconds
    delete dateNow;

    // time is already past
    if(amount < 0){
        document.getElementById('refreshcountdown').innerHTML="You will now be redirected to the new page.";
    }
    // date is still good
    else{
        secs=0;out="";

        amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs
        ammount = amount + 5; //add 5 seconds
        amount=amount%86400;
        amount=amount%3600;
        amount=amount%60;
        secs=Math.floor(amount);//seconds

        out += "You will be redirected to the new page in " + secs + " seconds.";
        document.getElementById('refreshcountdown').innerHTML=out;

        setTimeout("GetCount()", 1000);
    }
}

window.onload=GetCount;//call when everything has loaded