function addBookmark(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}

function okno(soubor,sirka,vyska)  {
	window.open(soubor,'','toolbar=no,scrollbars=yes,location=no,status=no,width='+sirka+',height='+vyska+',resizable=1')
}

// ------------------------------------------ zmena tridy
function Aktivni(id) {
  document.getElementById(id).className = "aktivni";
}

function Deaktivni(id)  {
  document.getElementById(id).className = "";
}

// ------------------------------------------ funkce pro rozbalovaci menu
var PocetMenu = 5;

function Show(CisMenu)    {
  var submenu = document.getElementById('submenu'+CisMenu);
  submenu.style.visibility="visible";
}

function Hide() {
  var menu, i;
  for(i=1; i<=PocetMenu; i++) {
    var submenu = document.getElementById('submenu'+i);
    submenu.style.visibility="hidden";
  }
}

// ------------------------------------------ nove okno
function popupOdkazy() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("popup")) {
      links[i].onclick = function() { return !window.open(this.href); }
    }
  }
  return true;
}
window.onload = popupOdkazy;

// ------------------------------------------ zvalidovat maly kontaktni formular
function validate_01(formular)  {
	if (formular.jmeno.value=="")   {
		alert ("CHYBA: prosím vyplňte položku 'Jméno'");
		formular.jmeno.focus();
		return false;
  }

	if (formular.mail.value=="") {
		alert ("CHYBA: prosím vyplňte položku 'E-mail'");
		formular.mail.focus();
		return false;
  }

	if (formular.telefon.value=="") {
		alert ("CHYBA: prosím vyplňte položku 'Telefon'");
		formular.telefon.focus();
		return false;
  }
}

function mezery(prvek,keyCode) {
    c = "";
    cislo = document.getElementById(prvek).value;
    delka = cislo.length;
    for (i=0;i<delka;i++) {
      pom = cislo[i];
      asc = pom.charCodeAt(0);
      if ((asc >= 48) && (asc <= 57)) c = c + pom;
    }
    
    //if ((keyCode == 9) || (keyCode == 46)) d = c.length - 1; //backspace a del
    //else
    d = c.length + 1;
    cislo = "";
    if (c > 99999) {
      m = Math.floor(c/100000);
      c = c - (m * 100000);
//      if (c < 1000) m = "00" + m;
//      else if (c < 10000) m = "0" + m;
      cislo = cislo + m + " ";
    }

    if (c > 99) {
      m = Math.floor(c/100);
      c = c - (m * 100);
      if (c < 1) m = "000" + m;
      else if (c < 10) m = "00" + m;
      cislo = cislo + m + " ";
    }

    cislo = cislo + c;



    document.getElementById(prvek).value = cislo;

}

function mezery2(prvek) {
    c = "";
    cislo = document.getElementById(prvek).value;
    delka = cislo.length;
    for (i=0;i<delka;i++) {
      pom = cislo[i];
      asc = pom.charCodeAt(0);
      if ((asc >= 48) && (asc <= 57)) c = c + pom;
    }
    
    c2 = "";
    delkac = c.length;
    j = 1;
    for (i=(delkac-1);i>=0;i--) {
      pom = c[i];
      c2 = c2 + pom;
      
      pom2 = Math.floor(j/3);
      pom3 = j/3;
      
      if (pom2 == pom3) c2 = c2 + " ";
      j++;
    }

    c3 = "";
    delkac2 = c2.length;
    for (i=(delkac2-1);i>=0;i--) {
      pom = c2[i];
      c3 = c3 + pom;
    }

    document.getElementById(prvek).value = c3;
}


