/****************************************************************************/
/*                                                                          */
/*         Name: funkce pro práci s datem a časem                           */
/*         File: dattim.js                                                  */
/*      Version: 1.0                                                        */
/*      Project: MujKlub                                                    */
/* Dependent on: -                                                          */
/*      Related: -                                                          */
/*     Encoding: windows-1250                                               */
/*  Tested with: IE5.01                                                     */
/*       Author: David Hůlka                                                */
/*         Date: 2000-10-16                                                 */
/*     Updaters: Jan Makovička                                              */
/*  Last Update: 2001-04-01                                                 */
/*   Integrator: Marcel Kurka                                               */
/*                                                                          */
/****************************************************************************/
/*                                                                          */
/* Description:                                                             */
/*                                                                          */
/*   Možné použití této knihovny je např. v souboru uvitani.php.            */
/*                                                                          */
/*                                                                          */
/* Usage:                                                                   */
/*                                                                          */
/*   -                                                                      */
/*                                                                          */
/*                                                                          */
/* Warnings:                                                                */
/*                                                                          */
/*   -                                                                      */
/*                                                                          */
/*                                                                          */
/* ToDo:                                                                    */
/*                                                                          */
/*   -                                                                      */
/*                                                                          */
/****************************************************************************/



// Zjisti, zda je prohlizec alesponi MSIE4
function isIE4()
{
  var MS = navigator.appVersion.indexOf("MSIE");
  return (MS > 0) && (parseInt(navigator.appVersion.substring(MS + 5, MS + 6)) >= 4);
}

function leadZero(val)
{
  // Pridame leading zero, je-li to nutne
  return (val < 10) ? "0" + val.toString() : val;
}

function buildTime(diff)
{
   var t = new Date();
   var sharp = (Date.parse(t.toString())+ diff);
   var time = new Date(sharp);

   return leadZero(time.getHours()) + ":" + leadZero(time.getMinutes()) + ":" +
	  leadZero(time.getSeconds());
}

function buildDate(diff)
{
   var t = new Date();
   var sharp = (Date.parse(t.toString())+ diff);
   var time = new Date(sharp);

   return leadZero(time.getFullYear()) + "-" + 
          leadZero(time.getMonth()+1) + "- " +
          leadZero(time.getDate());

/*
   return leadZero(time.getDate()) + ". " + leadZero(time.getMonth()+1) + ". " +
	  leadZero(time.getFullYear());
*/
}

function buildDay(diff)
{
   var t = new Date();
   var sharp = (Date.parse(t.toString())+ diff);
   var time = new Date(sharp);

   if (time.getDay() == 0) return "Sunday";
   if (time.getDay() == 1) return "Monday";
   if (time.getDay() == 2) return "Tuesday";
   if (time.getDay() == 3) return "Wednesday"
   if (time.getDay() == 4) return "Thursday";
   if (time.getDay() == 5) return "Friday";
   if (time.getDay() == 6) return "Saturday";
}

function dateFormat(diff)
{
  return buildDay(diff) + ", " + buildDate(diff) + ", " + buildTime(diff);
}

function ticker(diff) 
{
  this.info.innerText = dateFormat(diff);
}



/* End of file. */
