function zmen_pozadi(id_top,id_bottom) {
  var myDate=new Date()
  var day=myDate.getDate()
  var month=myDate.getMonth()
  var obdobi = 0 // zima

    // Zmena dle obdobi:   
    // Nejprve vypocet obdobi...
    if( (month>2) || ( (month==2) && (day>=21) ) )obdobi = 1;
    if( (month>5) || ( (month==5) && (day>=21) ) )obdobi = 2;
    if( (month>8) || ( (month==8) && (day>=23) ) )obdobi = 3;
    if( (month>11) || ( (month==11) && (day>=21) ) )obdobi = 0;

    // ...pote zmena obrazku dle vypocteneho obdobi
    switch( obdobi) {
        case 0: document.getElementById(id_bottom).style.background='url(\'./obrazky/ckbabicka_10z.jpg\') no-repeat'; 
                document.getElementById(id_top).style.background='url(\'./obrazky/ckbabicka_03z.jpg\') no-repeat';
                break;
        case 1: document.getElementById(id_bottom).style.background='url(\'./obrazky/ckbabicka_10.jpg\') no-repeat'; 
                document.getElementById(id_top).style.background='url(\'./obrazky/ckbabicka_03.jpg\') no-repeat';
                break;
        case 2: document.getElementById(id_bottom).style.background='url(\'./obrazky/ckbabicka_10.jpg\') no-repeat'; 
                document.getElementById(id_top).style.background='url(\'./obrazky/ckbabicka_03.jpg\') no-repeat';
                break;
        case 3: document.getElementById(id_bottom).style.background='url(\'./obrazky/ckbabicka_10p.jpg\') no-repeat'; 
                document.getElementById(id_top).style.background='url(\'./obrazky/ckbabicka_03p.jpg\') no-repeat';
                break;
    }
}

function switch_help(blok){
    if (document.getElementById(blok).style.display=="none") {
      document.getElementById(blok).style.display="block";
      }
    else {
      document.getElementById(blok).style.display="none";
      };
}

function Menu(n)
{
  if(n!=""){
    if (document.getElementById("menu_skryte_"+n).style.display=="none") {
      document.getElementById("menu_skryte_"+n).style.display="block";
      }
    else {
      document.getElementById("menu_skryte_"+n).style.display="none";
      };
  }
}

function CheckOznac(n)
{
	inp=document.getElementById("input"+n).value;
	mail=/^[0-9]+\.?[0-9]*$/
	if (mail.test(inp)==true){
	  	document.getElementById("check"+n).checked=true;
	  	document.getElementById("input"+n).style.background='#8abf8e';
	  	document.getElementById("check"+n).disabled=false;	
  	}
  	else{
		document.getElementById("input"+n).style.background='#ff9494';
		document.getElementById("check"+n).disabled=true;	
	}

}



function switchClasses(class1, class2) {
  elements = (document.all) ? document.all : document.getElementsByTagName("*");
  for (i=0; i<elements.length; i++) {
    if (elements[i].getAttribute('class') == class1) {
      elements[i].setAttribute('class', class2);
    }
    else if (elements[i].getAttribute('class') == class2) {
      elements[i].setAttribute('class', class1);
    }
  }
}


function phover(){
  if (!document.getElementById) return

  var p = document.getElementsByTagName('p');
  for(var i = 0; i < p.length; i++){
   p[i].onmouseover = function(){
    this.className = 'hover';
   }
   p[i].onmouseout  = function(){
    this.className = '';
   }
  }
}

function clear_box(hodnota){
	document.forms[0].email.value=hodnota;
}

function validate_reg(formular)
{
	if (formular.email.value=="")
	{
		alert("Musíte zadat email");
		formular.email.focus();
		return false;
	}
	else if (window.RegExp)
	{
		re = new RegExp("^[^@]+@[^.]+\..+$");
		if (!re.test(formular.email.value))
		{
			alert("Zadaný email není platný");
			formular.email.focus();
			return false;
		}
	}
	else
	return true;
}

function Menu(n)
{
if (document.getElementById("menu_skryte_"+n).style.display=="none") {
  document.getElementById("menu_skryte_"+n).style.display="block";
  document.getElementById("obr_"+n).src="./obrazky/kuzdas_11.gif";}
else {
  document.getElementById("menu_skryte_"+n).style.display="none";
  document.getElementById("obr_"+n).src="./obrazky/kuzdas_10.gif";};
}

function Zobraz_Menu(){
document.getElementById("menu").style.visibility="visible";
document.getElementById("leftcol").style.visibility="visible";
}

function Kontrola()
{
   if (document.dotaznik.jmeno.value == "")
   {
      document.dotaznik.jmeno.focus();
      alert ("Nezadali jste váše jméno");
      return false;
   }
   if (document.dotaznik.prijmeni.value == "")
   {
      document.dotaznik.prijmeni.focus();
      alert ("Nezadali jste váše příjmení");
      return false;
   }   
   if (document.dotaznik.telefon.value == "")
   {
      document.dotaznik.telefon.focus();
      alert ("Nezadali jste váš telefón");
      return false;
   }   
   if (document.dotaznik.kod.value != "7795")
   {
      document.dotaznik.kod.focus();
      alert ("Byl špatně opsán kód z obrázku");
      return false;
   }     
}

function Kontrola2()
{
   if (document.formular.mail_odesilatele.value == "")
   {
      document.formular.mail_odesilatele.focus();
      alert ("Nezadali jste váš e-mail");
      return false;
   }
   if (document.formular.mail_odesilatele.value.indexOf("@") == -1)
   {
      document.formular.mail_odesilatele.focus();
      alert ("Chybný formát e-mailu");
      return false;
   }
   if (document.formular.predmet.value == "")
   {
      document.formular.predmet.focus();
      alert ("Nezadali jste předmět");
      return false;
   }
   if (document.formular.zprava.value == "")
   {
      document.formular.zprava.focus();
      alert ("Nezadali jste žádnou zprávu");
      return false;
   }
     
}

function Kontrola3()
{

   if (document.formular.jmeno.value == "")
   {
      document.formular.jmeno.focus();
      alert ("Nezadali jste Vaše jméno");
      return false;
   }    

   if (document.formular.telefon.value == "")
   {
      document.formular.telefon.focus();
      alert ("Nezadali jste Váš telefon");
      return false;
   }
   
  if (document.formular.adresa.value == "")
   {
      document.formular.adresa.focus();
      alert ("Nezadali jste Vaši adresu");
      return false;
   }
}

function Kontrola_en()
{
   if (document.formular.mail_odesilatele.value == "")
   {
      document.formular.mail_odesilatele.focus();
      alert ("Fill your e-mail");
      return false;
   }
   if (document.formular.mail_odesilatele.value.indexOf("@") == -1)
   {
      document.formular.mail_odesilatele.focus();
      alert ("E-mail pattern is wrong");
      return false;
   }
   if (document.formular.zprava.value == "")
   {
      document.formular.zprava.focus();
      alert ("Fill your message");
      return false;
   }
   if (document.formular.predmet.value == "")
   {
      document.formular.predmet.focus();
      alert ("Fill your subject");
      return false;
   }
   if (document.formular.kod.value != "7795")
   {
      document.formular.kod.focus();
      alert ("Antispam code is wrong");
      return false;
   }     
}

function Kontrola_de()
{
   if (document.formular.mail_odesilatele.value == "")
   {
      document.formular.mail_odesilatele.focus();
      alert ("Füllen Sie Ihre E-mail");
      return false;
   }
   if (document.formular.mail_odesilatele.value.indexOf("@") == -1)
   {
      document.formular.mail_odesilatele.focus();
      alert ("E-mail Muster ist falsch");
      return false;
   }
   if (document.formular.zprava.value == "")
   {
      document.formular.zprava.focus();
      alert ("Füllen Sie Ihre Anzeige");
      return false;
   }
   if (document.formular.predmet.value == "")
   {
      document.formular.predmet.focus();
      alert ("Füllen Sie Ihr Thema");
      return false;
   }
   if (document.formular.kod.value != "7795")
   {
      document.formular.kod.focus();
      alert ("Antispam Code ist falsch");
      return false;
   }     
}

  function showDetail(adresa)
  {
    if (!(iD = document.getElementById('product_detail')))
    {
      iD = document.createElement('div');
      iD.setAttribute('id', 'product_detail');
      document.getElementById('page').appendChild(iD);
      aHref = document.createElement('a');
      aHref.setAttribute('href', 'javascript:hideDetail()');
      iD.appendChild(aHref);
      img = document.createElement('img');
      img.setAttribute('src', adresa);
      img.setAttribute('width', 380);
      img.setAttribute('height', 540);
      aHref.appendChild(img);
    }
    iD.getElementsByTagName('img')[0].setAttribute('src', adresa);
    iD.className = 'show';
    alert(adresa);
  }

  function hideDetail()
  {
    if (document.getElementById('product_detail'))
      document.getElementById('product_detail').className = '';
  }


function ShowFoto (Img, W, H){
var Browser = navigator.appName;
var Version = parseInt(navigator.appVersion);
if ((Browser == "Netscape" & Version >= 4) ||
(Browser == "Microsoft Internet Explorer" & Version >= 4)){
ScrH = screen.height;
ScrW = screen.width;
} else {
ScrH = 0;
ScrW = 0;
}

var BorderW = 1;
W += 2*BorderW;
H += 2*BorderW;

var Position;
if ((ScrH > 0) && (ScrW > 0)) Position = ",left="+(ScrW - W)/2+",top="+(ScrH-H)/2;
else Position = "";

var TmpName= new Date();
var NewName = "Name_"+TmpName.getTime();
var Scrollbars = ",scrollbars=no";
if ((ShowFoto.arguments.length>3) && (ShowFoto.arguments[3]== true)) Scrollbars = ",scrollbars=yes";

var NewWin = window.open('', NewName, "toolbar=no,location=no,width="+W+",height="+H+",directories=no,status =no,menubar=no,resizable=no"+Scrollbars+Position);


if (NewWin && NewWin.document){
with (NewWin.document) {
open();
write('<html><head><title>Velká fotografie</title></head><body style="margin:0px;padding:0px;background-color:#000000;">');
write('<A href="javascript:close();" title="Kliknutím zavřete"><IMG src="'+
Img+'" hspace="'+BorderW+'" vspace="'+
BorderW+'" border="0"></a>');
write('</body></html>');
close();
}
return (false)
} else return (true)
} 

