function zobraz(id)
{
  if(document.getElementById(id))
	document.getElementById(id).style.display="block";
}
function zobraz_in(id)
{
  if(document.getElementById(id))
	 document.getElementById(id).style.display="inline";
}
function odzobraz(id)
{
  if(document.getElementById(id))
	document.getElementById(id).style.display="none";
}
function zobraz_nebo_odzobraz(id) {
  if(document.getElementById(id).style.display == "block")
    document.getElementById(id).style.display="none";
  else
    document.getElementById(id).style.display="block";
}
function zobraz_nebo_odzobraz_in(id) {
  if(document.getElementById(id).style.display == "inline")
    document.getElementById(id).style.display="none";
  else
    document.getElementById(id).style.display="inline";
}
function check_or_uncheck(id) {
  if(document.getElementById(id).checked == true)
    document.getElementById(id).checked = false;
  else
    document.getElementById(id).checked = 'checked';
}
function check(id) {
  if(document.getElementById(id))
    document.getElementById(id).checked = 'checked';
}
function uncheck(id) {
  if(document.getElementById(id))
    document.getElementById(id).checked = false;
}
function podbarvi(id,barva)
{
  if(document.getElementById(id))
	 document.getElementById(id).style.background=barva;
}
function odbarvi(id,barva)
{
  if(document.getElementById(id))
	document.getElementById(id).style.background=barva;
}

function vyber_panel(id,no,pocet) {
  for(i=1;i<=pocet;i++) {
    if(document.getElementById(id + i)){
      if(i != no)
        document.getElementById(id + i).style.display="none";
      else
        document.getElementById(id + i).style.display="block";
    }
  }
}

function zaktivni(id,no,pocet) {
  for(i=1;i<=pocet;i++) {
    if(document.getElementById(id + i)){
      if(i != no)
        document.getElementById(id + i).className="normal";
      else
        document.getElementById(id + i).className="active";
    }
  }
}

function odesli(formular) {
	document.getElementById(formular).submit();
}

function zkontroluj_silu_hesla(heslo) {
  zaklad = /^.*([a-z]+.*[0-9]+)|([0-9]+.*[a-z]+).*$/;
  adv = /^.*[^a-zA-Z0-9].*$/;
  exp = /^.*[^a-zA-Z0-9].*[^a-zA-Z0-9].*[^a-zA-Z0-9].*$/;
  if((heslo.length > 10)&&(zaklad.test(heslo))&&(exp.test(heslo))) {
    sila = '<span style="color: green;">100/100</span>';
  } else if((heslo.length > 8)&&(zaklad.test(heslo))&&(exp.test(heslo))) {
    sila = '<span style="color: green;">90/100</span>';
  } else if((heslo.length > 6)&&(zaklad.test(heslo))&&(adv.test(heslo))) {
    sila = '<span style="color: green;">70/100</span>';
  } else if((heslo.length > 5)&&(zaklad.test(heslo))) {
    sila = '<span style="color: green;">50/100</span>';
  } else if((heslo.length > 4)&&(zaklad.test(heslo))) {
    sila = '<span style="color: green;">40/100</span>';
  } else if(heslo.length > 3) {
    sila = '<span style="color: red;">30/100</span>';
  } else if(heslo.length > 2) {
    sila = '<span style="color: red;">20/100</span>';
  } else if(heslo.length > 1) {
    sila = '<span style="color: red;">10/100</span>';
  } else {
    sila = '<span style="color: red;">0/100</span>';
  }
  return(sila);
}

function zkontroluj_shodu_hesel(heslo1,heslo2) {
  if(heslo1 == heslo2)
    return(true);
  else
    return(false);
}

function omez_pocet_znaku(areaid,znaku,zbyvaid) { 
  area = document.getElementById(areaid); 
  if(area.value.length > znaku) 
    area.value = area.value.substr(0,znaku);
  document.getElementById(zbyvaid).innerHTML = znaku-area.value.length;
}

function posun_pozici_y(id,y,vyska) {
  document.getElementById(id).style.backgroundPosition = "0px -" + (y*vyska) + "px";
}

function posun_pozici_x(id,x,sirka) {
  document.getElementById(id).style.backgroundPosition = (x*sirka) + "px 0px";
}

function posun_zpet(id) {
  document.getElementById(id).style.backgroundPosition = "0px 0px";
}

function zmena_class(id,classa) {
  document.getElementById(id).className = classa;
}

function zmena_class_add(id,classa) {
  if(document.getElementById(id).className != "")
    document.getElementById(id).className = document.getElementById(id).className + " " + classa;
  else
    document.getElementById(id).className = classa;
}

function AddFavorite(linkObj,addUrl,addTitle) 
{ 
  if (document.all && !window.opera) 
  { 
    window.external.AddFavorite(addUrl,addTitle); 
    return false; 
  } 
  else if (window.opera && window.print) 
  { 
    linkObj.title = addTitle; 
    return true; 
  } 
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) 
  { 
    if (window.confirm('Přidat oblíbenou stránku jako nový panel?')) 
    { 
      window.sidebar.addPanel(addTitle,addUrl,''); 
      return false; 
    } 
  } 
  window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.'); 
  return false; 
}
