function display_countdown(start) {
  window.start = parseFloat(start);
  var end = 0; // Change this to stop the counter at a higher value
  var refresh = 1000; // Refresh rate in milli seconds
  if(window.start >= end ) {
    mytime = setTimeout('display_ct()',refresh);
  } else {
    $('#headercountdown').text("New Offer Coming Soon");
  }
}


function display_ct() {
  // Calculate the number of days left
  var days = Math.floor(window.start / 86400);

  // After deducting the days calculate the number of hours left
  var hours = Math.floor((window.start - (days * 86400 )) / 3600);
  var totalhours = Math.floor((window.start) / 3600);

  // After days and hours , how many minutes are left
  var minutes = Math.floor((window.start - (days * 86400 ) - (hours *3600 ))/60);

  // Finally how many seconds left after removing days, hours and minutes
  var secs = Math.floor((window.start - (days * 86400 ) - (hours *3600 ) - (minutes*60)));

  var x = padZeros(totalhours,2) + " hr "  + padZeros(minutes,2) + " min "  + padZeros(secs,2) + " sec</span>";

  $('#headercountdown').html('Time Remaining: <span id="countdowntimer">' + x + '</span>');
  window.start = window.start- 1;
  tt = display_countdown(window.start);
}


function padZeros(Num, Zs) {
  // Pad a number with zeroes
  return(("00000000000000000000"+Num).slice(-Zs));
}
