//######################################################################################
// Author: Amit Deo Panwar
// Date: June/12/2006
// Description: displays the amount of time until the offer is closed

function amTimerTick(){
        amTimerStart -=1 ;
		amount=amTimerStart;
        // time is already past
        if(amTimerStart < 0){
                document.getElementById('countbox').innerHTML="Offer Closed!";

        }
        else{
                days=0;hours=0;mins=0;secs=0;out="";

                days=Math.floor(amount/86400);//days
                amount=amount%86400;

                hours=Math.floor(amount/3600);//hours
                amount=amount%3600;

                mins=Math.floor(amount/60);//minutes
                amount=amount%60;

                secs=Math.floor(amount);//seconds

                if(days != 0){out += days +" day"+((days!=1)?"s":"")+", ";}
                if(days != 0 || hours != 0){out += hours +" hour"+((hours!=1)?"s":"")+", ";}
                if(days != 0 || hours != 0 || mins != 0){out += mins +" minute"+((mins!=1)?"s":"")+", ";}
                out += secs +" seconds";
                document.getElementById('countbox').innerHTML=out;

                setTimeout("amTimerTick()", 1000);
        }
}
var _winOnLoad=window.onload;
window.onload=function(){amTimerTick();if(typeof _winOnLoad == 'function'){_winOnLoad();}}//call when everything has loaded
