//  ------------------------------------------------------------------------ //
//              HCTCommerce - HardCoreTec E-Commerce System                  //
//                     Copyright (c) 2004 HardCoreTec                        //
//                 Developer and Creator Nicolas P�lmann                    //
//                     <http://www.hardcoretec.com/>                         //
//  ------------------------------------------------------------------------ //
//  This file is a component of the HardCoreTec E-Commerce System.           //
//                                                                           //
//  You may not change or alter any portion of this document and it's        //
//  system without having the creators acknowledgement and agreement.        //
//                                                                           //
//  ------------------------------------------------------------------------ //

function startTime() {

  for (var i = 0; i < tfTime.length; i++) {

    if (document.getElementById(tfTime[i]["id"])) {
      showTime(tfTime[i]["id"], tfTime[i]["time"], tfTime[i]["finishes"], tfTime[i]["datetime"]);
    }

  }

}

function showTime(id, time, finishes, datetime) {

  if (time > 0) {

    var hours = Math.floor(time / 3600);
    var minutes = Math.floor(time / 60);
    var seconds = time - (hours * 3600) - (minutes * 60);

    if (hours < 10) {
      hours = '0' + hours;
    }

    if (minutes < 10) {
      minutes = '0' + minutes;
    }

    if (seconds < 10) {
      seconds = '0' + seconds;
    }

    document.getElementById(id).innerHTML = hours + ':' + minutes + ':' + seconds + '<br>' + datetime;

    window.setTimeout('showTime("' + id + '", ' + (time - 1) + ', ' + finishes + ', "' + datetime + '")', 1000);

  } else {

    document.location.reload();

  }

}
