function home()
{location.href="/"}

function odkaz(adresa)
{location.href="http://"+adresa;}

function nastavCas(objekt,pricist,cas){
co = objekt;
kdy = cas;
pri = pricist;
now = new Date();
zacatek = Date.parse(cas);
timeNow = now.getTime();
if ( (zacatek - timeNow) >= 0) {timeLeft = zacatek - timeNow;}
else {timeLeft = timeNow - zacatek;}
days = parseInt(timeLeft / 86400000);
if (isNaN(days)) days = 0;

timeLeft = parseInt(timeLeft % 86400000);
hours = parseInt(timeLeft / 3600000);
timeLeft = parseInt(timeLeft % 3600000);
mins = parseInt(timeLeft / 60000);
timeLeft = parseInt(timeLeft % 60000);
secs = parseInt(timeLeft / 1000);

d1 = parseInt(days / 10);
if ( isNaN(d1)) d1 = 0;

d2 = parseInt(days % 10);
if ( isNaN(d2)) d2 = 0;

h1 = parseInt(hours / 10);
if ( isNaN(h1)) h1 = 0;

h2 = parseInt(hours % 10);
if ( isNaN(h2)) h2 = 0;

m1 = parseInt(mins / 10);
if ( isNaN(m1)) m1 = 0;

m2 = parseInt(mins % 10);
if ( isNaN(m2)) m2 = 0;

s1 = parseInt(secs / 10);
if ( isNaN(s1)) s1 = 0;

s2 = parseInt(secs % 10);
if ( isNaN(s2)) s2 = 0;

if (days>1 && days<5) {dnove = " dny";}
else if (days==1) {dnove = " den";}
else {dnove = " dní";}

if ((zacatek - timeNow <=0) && (Date.parse(cas)>=timeNow)) {document.getElementById(co+"_dny").value = "právě";document.getElementById(co).value = "probíhá";}
else if ((zacatek - timeNow) <=0 && (Date.parse(cas)<timeNow)) {document.getElementById(co+"_dny").value = "0:00:00";document.getElementById(co).value = "";}
else {document.getElementById(co+"_dny").value = days+dnove;
      document.getElementById(co).value =""+h1+h2+":"+m1+m2+":"+s1+s2;}

setTimeout("nastavCas(co,pri,kdy)", 500);
return;
}

function kontrola(objekty){
id=objekty.split(",");
for(i=0;i<id.length;i++){
 if (document.getElementById(id[i]).value=="") {
   alert ('Musíte vyplnit všechny povinné položky');
   document.getElementById(id[i]).focus();
   return false;}
 if (id[i]=="email"){
 vzor=/^.+@.+\..{2,3}$/;
 adresa=document.getElementById(id[i]).value;
 if (!vzor.test(adresa)) {
   alert ('Musíte zadat správnou emailovou adresu');
   document.getElementById(id[i]).focus();
   return false;
   }
 }
 if (id[i]=="web"){
 vzor=/^http:\/\/\S+/;
 adresa=document.getElementById(id[i]).value;
 if (!vzor.test(adresa)) {
   alert ('Adresa musí začínat "http://"');
   document.getElementById(id[i]).focus();
   return false;
   }
 }
}
}
