function KontrolaFaktury(dodani) {
  chyba = "";

  if (dodani != 0) {
    if (document.getElementById('fo_fakturace').uz_do_jmeno.value == "") chyba += "jméno, ";
    if (document.getElementById('fo_fakturace').uz_do_ulice.value == "") chyba += "ulice, ";
    if (document.getElementById('fo_fakturace').uz_do_mesto.value == "") chyba += "město, ";
    if (document.getElementById('fo_fakturace').uz_do_psc.value == "") chyba += "PSČ, ";
    if (document.getElementById('fo_fakturace').uz_do_telefon.value == "") chyba += "telefon.";
  }

  if (chyba != "") {
    alert("Vložte prosím následující údaje: "+chyba);
    return false;
  }
  else document.getElementById('fo_fakturace').submit();
}


function TestEmailu(adresa) {
  re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;
  return adresa.search(re) == 0;
}

function ZkontrolujEmail(adresa) {
  var pozice_zavinace = adresa.indexOf("@");
  if (pozice_zavinace < 0) return false;

  var cast_pred_zavinacem = adresa.substring(0,pozice_zavinace);
  var cast_po_zavinaci = adresa.substring(pozice_zavinace+1,adresa.length);

  if (cast_po_zavinaci.indexOf("@") >= 0) return false;
  if (cast_pred_zavinacem.length <= 0) return false;
  if (cast_po_zavinaci.length <= 0) return false;

  return true;
}


function KontrolaHledej() {
  if (document.fo_vyhledej.hledej_text.value != "" || document.fo_vyhledej.hledej_text.value != "hledaný výraz...") document.fo_vyhledej.submit();
  else alert("Nevyplnili jste pole s textem!");

}


function KontrolaNaemail() {
  if (document.fo_odeslat.uz_email.value != "") {
    document.fo_odeslat.uz_odeslatheslo.value = 1;
    document.fo_odeslat.submit();
  }
  else alert("Nevyplnili jste povinné údaje!");
}


function KontrolaPrihlaseni() {
  if (document.fo_prihlaseni1.uz_login.value != "" && document.fo_prihlaseni1.uz_heslo.value != "") document.fo_prihlaseni1.submit();
  else alert("Vyplňte prosím přihlašovací jméno a heslo!");
}


function KontrolaPrihlaseniPokladna() {
  if (document.fo_prihlaseni_pokladna.uz_login.value != "" && document.fo_prihlaseni_pokladna.uz_heslo.value != "") document.fo_prihlaseni_pokladna.submit();
  else alert("Vyplňte prosím přihlašovací jméno a heslo!");
}


function KontrolaPokladnaPrihlaseni() {
  if (document.fo_prihlaseni.uz_login.value != "" && document.fo_prihlaseni.uz_heslo.value != "") document.fo_prihlaseni.submit();
  else alert("Vyplňte prosím přihlašovací jméno a heslo!");
}


function KontrolaVelkoobchod() {
  if (document.fo_prihlaseni.uz_login.value != "" && document.fo_prihlaseni.uz_heslo.value != "") {
    document.fo_prihlaseni.submit();
  }
  else alert("Vyplňte prosím přihlašovací jméno a heslo!");
}


function OtevriObrazek(soubor) {
  okno = window.open("../obr_files/"+soubor, "Zobrazeni", "left=100, top=50, width=640, height=480, toolbar=no, statusbar=no, resizable=no, scrollbars=no");
  with (okno.document) {
    open();
    writeln("<html>\n<head><title>Detail obrázku: " +soubor+ "</title></head>");
    writeln("<body style='margin: 0; padding: 0' onLoad='pre()'>");
    writeln("<scri"+"pt language='javascript'>function pre() \n{\n imgwidth=obr.width;\n imgheight=obr.height;\n window.resizeTo(imgwidth+10, imgheight+30)\n }\n</sc"+"ript>")
    writeln("<img src='../obr_files/" +soubor+ ".jpg' border=0 onClick='window.close()' id=obr alt='kliknutím zavřete okno'>");
    writeln("");
    close();
  }
  return false;
}


function Zobraz(cislo) {
  if (cislo == 3) {
    document.getElementById('tab-osoba').className = 'videt';
    document.getElementById('tab-firma').className = 'nevidet';

    document.getElementById('zakaznik_osoba').checked = true;
    document.getElementById('zakaznik_firma').checked = false;
  }
  else {
    document.getElementById('tab-firma').className = 'videt';
    document.getElementById('tab-osoba').className = 'nevidet';

    document.getElementById('zakaznik_osoba').checked = false;
    document.getElementById('zakaznik_firma').checked = true;
  }
}


function RegKontrolaOsoba() {
  text="";
  var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

  if (document.fo_reg_osoba.os_heslo.value != document.fo_reg_osoba.os_heslo2.value) alert("Hesla neodpovídají!");
  else if (document.fo_reg_osoba.sc1.value != 4) alert("Antispam není v pořádku! Kontaktujte prosím správce eshopu.");
  else {
    if (!TestEmailu(document.fo_reg_osoba.os_email.value) || !ZkontrolujEmail(document.fo_reg_osoba.os_email.value) || (document.fo_reg_osoba.os_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_reg_osoba.os_email.focus();
    }
    else {
      if (document.fo_reg_osoba.os_heslo.value == '') text += "heslo, ";
      if (document.fo_reg_osoba.os_heslo2.value == '') text += "heslo - potvrzení, ";
      if (document.fo_reg_osoba.os_jmeno.value == '') text += "jméno, ";
      if (document.fo_reg_osoba.os_prijmeni.value == '') text += "příjmení, ";
      if (document.fo_reg_osoba.os_ulice.value == '') text += "ulice, ";
      if (document.fo_reg_osoba.os_mesto.value == '') text += "město, ";
      if (document.fo_reg_osoba.os_psc.value  =='') text += "psč, ";
      if (document.fo_reg_osoba.os_telefon.value=='') text += "telefon.";

      if (text=="") document.fo_reg_osoba.submit();
      else {
        alert("Vložte prosím údaje:\n"+text);
      }
    }
  }

  return false;
}


function KontrolaPokladnaRegOsoba() {
  text="";
  var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

  if (document.fo_reg_osoba.os_heslo.value != document.fo_reg_osoba.os_heslo2.value) alert("Hesla neodpovídají!");
  else {
    if (!TestEmailu(document.fo_reg_osoba.os_email.value) || !ZkontrolujEmail(document.fo_reg_osoba.os_email.value) || (document.fo_reg_osoba.os_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_reg_osoba.os_email.focus();
    }
    else {
      if (document.fo_reg_osoba.os_email.value == '') text += "email, ";
      if (document.fo_reg_osoba.os_heslo.value == '') text += "heslo, ";
      if (document.fo_reg_osoba.os_heslo2.value == '') text += "heslo - potvrzení, ";
      if (document.fo_reg_osoba.os_jmeno.value == '') text += "jméno, ";
      if (document.fo_reg_osoba.os_prijmeni.value == '') text += "příjmení, ";
      if (document.fo_reg_osoba.os_ulice.value == '') text += "ulice, ";
      if (document.fo_reg_osoba.os_mesto.value == '') text += "město, ";
      if (document.fo_reg_osoba.os_psc.value  =='') text += "psč, ";
      if (document.fo_reg_osoba.os_telefon.value=='') text += "telefon.";

      if (text=="") document.fo_reg_osoba.submit();
      else {
        alert("Vložte prosím údaje:\n"+text);
      }
    }
  }

  return false;
}



function RegKontrolaFirma() {
  text = "";
  var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

  if (document.fo_reg_firma.fi_heslo.value != document.fo_reg_firma.fi_heslo2.value) alert("Hesla neodpovídají!");
  else if (document.fo_reg_firma.sc2.value != 4) alert("Antispam není v pořádku! Kontaktujte prosím správce eshopu.");
  else {
    if (!TestEmailu(document.fo_reg_firma.fi_email.value) || !ZkontrolujEmail(document.fo_reg_firma.fi_email.value) || (document.fo_reg_firma.fi_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_reg_firma.fi_email.focus();
    }
    else {
      if (document.fo_reg_firma.fi_heslo.value == '') text += "heslo, ";
      if (document.fo_reg_firma.fi_heslo2.value == '') text += "heslo - potvrzení, ";
      if (document.fo_reg_firma.fi_jmeno.value == '') text += "jméno, ";
      if (document.fo_reg_firma.fi_prijmeni.value == '') text += "příjmení, ";
      if (document.fo_reg_firma.fi_ulice.value == '') text += "ulice, ";
      if (document.fo_reg_firma.fi_mesto.value == '') text += "město, ";
      if (document.fo_reg_firma.fi_psc.value  =='') text += "psč, ";
      if (document.fo_reg_firma.fi_telefon.value=='') text += "telefon, ";
      if (document.fo_reg_firma.fi_firma.value == '') text += "město, ";
      if (document.fo_reg_firma.fi_ico.value == '') text += "IČ, ";
      if (document.fo_reg_firma.fi_dic.value == '') text += "DIČ.";

      if (text=="") document.fo_reg_firma.submit();
      else {
        alert("Vložte prosím údaje:\n"+text);
      }
    }
  }

  return false;
}


function KontrolaPokladnaRegFirma() {
  text = "";
  var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

  if (document.fo_reg_firma.fi_heslo.value != document.fo_reg_firma.fi_heslo2.value) alert("Hesla neodpovídají!");
  else {
    if (!TestEmailu(document.fo_reg_firma.fi_email.value) || !ZkontrolujEmail(document.fo_reg_firma.fi_email.value) || (document.fo_reg_firma.fi_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_reg_firma.fi_email.focus();
    }
    else {
      if (document.fo_reg_firma.fi_email.value == '') text += "email, ";
      if (document.fo_reg_firma.fi_heslo.value == '') text += "heslo, ";
      if (document.fo_reg_firma.fi_heslo2.value == '') text += "heslo - potvrzení, ";
      if (document.fo_reg_firma.fi_jmeno.value == '') text += "jméno, ";
      if (document.fo_reg_firma.fi_prijmeni.value == '') text += "příjmení, ";
      if (document.fo_reg_firma.fi_ulice.value == '') text += "ulice, ";
      if (document.fo_reg_firma.fi_mesto.value == '') text += "město, ";
      if (document.fo_reg_firma.fi_psc.value  =='') text += "psč, ";
      if (document.fo_reg_firma.fi_telefon.value=='') text += "telefon, ";
      if (document.fo_reg_firma.fi_firma.value == '') text += "město, ";
      if (document.fo_reg_firma.fi_ico.value == '') text += "IČ, ";
      if (document.fo_reg_firma.fi_dic.value == '') text += "DIČ.";

      if (text=="") document.fo_reg_firma.submit();
      else {
        alert("Vložte prosím údaje:\n"+text);
      }
    }
  }

  return false;
}


function OtevriTisk(obrazek) {
 window.open(obrazek, "zoom", "left=150, top=90, width=400, height=400, toolbar=no, statusbar=no, resizable=yes, scrollbars=yes");
}


function KontrolaMujucetOsoba() {
  chyba = "";
  var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

  if (document.fo_osoba.uz_heslo.value != document.fo_osoba.uz_heslo2.value) alert("Heslo se neshodují!");
  else {
    if (!TestEmailu(document.fo_osoba.uz_email.value) || !ZkontrolujEmail(document.fo_osoba.uz_email.value) || (document.fo_osoba.uz_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_osoba.uz_email.focus();
    }
    else {
      if (document.fo_osoba.uz_jmeno.value == "") chyba += "jméno, ";
      if (document.fo_osoba.uz_prijmeni.value == "") chyba += "příjmení, ";
      if (document.fo_osoba.uz_ulice.value == "") chyba += "ulice, ";
      if (document.fo_osoba.uz_mesto.value == "") chyba += "město, ";
      if (document.fo_osoba.uz_psc.value == "") chyba += "PSČ, ";
      if (document.fo_osoba.uz_stat.value == "") chyba += "stát, ";
      if (document.fo_osoba.uz_email.value == "") chyba += "email, ";
      if (document.fo_osoba.uz_telefon.value == "") chyba += "telefon.";

      if (chyba != "") {
        alert("Vložte prosím následující údaje: "+chyba);
        return false;
      }
      else document.fo_osoba.submit();
    }
  }
}


function KontrolaMujucetFirma() {
  chyba = "";
  var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

  if (document.fo_firma.uz_heslo.value != document.fo_firma.uz_heslo2.value) alert("Heslo se neshodují!");
  else {
    if (!TestEmailu(document.fo_firma.uz_email.value) || !ZkontrolujEmail(document.fo_firma.uz_email.value) || (document.fo_firma.uz_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_firma.uz_email.focus();
    }
    else {
      if (document.fo_firma.uz_jmeno.value == "") chyba += "jméno, ";
      if (document.fo_firma.uz_prijmeni.value == "") chyba += "příjmení, ";
      if (document.fo_firma.uz_ulice.value == "") chyba += "ulice, ";
      if (document.fo_firma.uz_mesto.value == "") chyba += "město, ";
      if (document.fo_firma.uz_psc.value == "") chyba += "PSČ, ";
      if (document.fo_firma.uz_stat.value == "") chyba += "stát, ";
      if (document.fo_firma.uz_email.value == "") chyba += "email, ";
      if (document.fo_firma.uz_firma.value == "") chyba += "firma, ";
      if (document.fo_firma.uz_ico.value == "") chyba += "IČ, ";
      if (document.fo_firma.uz_dic.value == "") chyba += "DIČ, ";
      if (document.fo_firma.uz_telefon.value == "") chyba += "telefon.";

      if (chyba != "") {
        alert("Vložte prosím následující údaje: "+chyba);
        return false;
      }
      else document.fo_firma.submit();
    }
  }
}





function ZobrazDodaci() {
  if (document.getElementById('dodaciadresa').className == "nevidet") document.getElementById('dodaciadresa').className = 'videt';
  else document.getElementById('dodaciadresa').className = 'nevidet';

  if (document.getElementById('dodaciadresa_checkbox').checked == true) document.getElementById('dodaciadresa_checkbox').checked = false;
  else document.getElementById('dodaciadresa_checkbox').checked = true;
}


function ZmenAdresu(cislo) {
  if (cislo == 1) {
    document.getElementById('oh_afakt').className = "videt";
    document.getElementById('oh-ajina').className = "nevidet";

    document.getElementById('oh_fakt').checked = true;
    document.getElementById('oh_jina').checked = false;
  }
  else {
    document.getElementById('oh_afakt').className = "nevidet";
    document.getElementById('oh-ajina').className = "videt";

    document.getElementById('oh_jina').checked = true;
    document.getElementById('oh_fakt').checked = false;
  }
}

function KontrolaDodaniCZK() {
  if (document.fo_dodani.oh_platba[6].checked == 1) {
    document.fo_dodani.uz_varianta.value = 0;
    document.fo_dodani.submit();
  }
  else {
    if ((document.getElementById('oh_fakt').checked != 1) && (document.getElementById('oh_jina').checked != 1)) alert("Zvolte prosím jednu z variant dodací adresy.");
    else {
      if (document.getElementById('oh_fakt').checked == 1) {
        document.fo_dodani.uz_varianta.value = 1;
        document.fo_dodani.submit();
      }
      else {
        if (document.getElementById('oh_jina').checked == 1) {
          chyba = "";

          if (document.fo_dodani.uz_do_jmeno.value == "") chyba += "jméno, ";
          if (document.fo_dodani.uz_do_ulice.value == "") chyba += "ulice, ";
          if (document.fo_dodani.uz_do_mesto.value == "") chyba += "mesto, ";
          if (document.fo_dodani.uz_do_psc.value == "") chyba += "psc, ";
          if (document.fo_dodani.uz_do_telefon.value == "") chyba += "telefon, ";

          if (chyba != "") {
            alert("Vložte prosím následující údaje: "+chyba);
            return false;
          }
          else {
            document.fo_dodani.uz_varianta.value = 2;
            document.fo_dodani.submit();
          }
        }
        else alert("Zvolte prosím jednu z variant dodací adresy.");
      }
    }
  }
}

function KontrolaDodaniEUR() {
  if ((document.getElementById('oh_fakt').checked != 1) && (document.getElementById('oh_jina').checked != 1)) alert("Zvolte prosím jednu z variant dodací adresy.");
  else {
    if (document.getElementById('oh_fakt').checked == 1) {
      document.fo_dodani.uz_varianta.value = 1;
      document.fo_dodani.submit();
    }
    else {
      if (document.getElementById('oh_jina').checked == 1) {
        chyba = "";

        if (document.fo_dodani.uz_do_jmeno.value == "") chyba += "jméno, ";
        if (document.fo_dodani.uz_do_ulice.value == "") chyba += "ulice, ";
        if (document.fo_dodani.uz_do_mesto.value == "") chyba += "mesto, ";
        if (document.fo_dodani.uz_do_psc.value == "") chyba += "psc, ";
        if (document.fo_dodani.uz_do_telefon.value == "") chyba += "telefon, ";

        if (chyba != "") {
          alert("Vložte prosím následující údaje: "+chyba);
          return false;
        }
        else {
          document.fo_dodani.uz_varianta.value = 2;
          document.fo_dodani.submit();
        }
      }
      else alert("Zvolte prosím jednu z variant dodací adresy.");
    }
  }
}


function KontrolaInzeratu() {
  chyba = "";
  document.fo_inzerat.ez_novy.value = 0;

  if (document.fo_inzerat.ez_nazev.value == "") chyba += "název, ";
  if (document.fo_inzerat.ez_text.value == "") chyba += "text, ";
  if (document.fo_inzerat.ez_typ.value == "") chyba += "typ, ";
  if (document.fo_inzerat.ez_skupina.value == "") chyba += "skupina, ";
  if (document.fo_inzerat.ez_cena.value == "") chyba += "cena, ";
  if (document.fo_inzerat.ez_jmeno.value == "") chyba += "jméno, ";
  if (document.fo_inzerat.ez_telefon.value == "") chyba += "telefon, ";
  if (document.fo_inzerat.ez_email.value == "") chyba += "email, ";
  if (document.fo_inzerat.ez_heslo.value == "") chyba += "heslo.";

  if (chyba != "") {
    alert("Vložte prosím následující údaje: "+chyba);
    return false;
  }
  else {
    document.fo_inzerat.ez_novy.value = 1;
    document.fo_inzerat.submit();
  }
}


function KontrolaOdstraneni() {
  if ((document.fo_inzerat.ez_kod.value != "") && (document.fo_inzerat.ez_heslo.value != "")) document.fo_inzerat.submit();
  else alert("Nejsou vloženy všechny povinné údaje!");
}


function KontrolaHledani() {
  if (document.fo_filtr.eb_slovo.value != "") document.fo_filtr.submit();
  else alert("Zadejte prosím hledané slovo!");
}


function KontrolaHledaniAdmin() {
  if (document.getElementById('fo_hledat').hl_slovo.value != "") document.getElementById('fo_hledat').submit();
  else alert("Zadejte prosím hledaný výraz!");
}


function KontrolaSmazUstajeni() {
}


function ZmenDodaniCZK(cislo) {
  if (cislo == 3) {
    document.getElementById('oh-jinaadresa').className = "nevidet";
  }
  else {
    document.getElementById('oh-jinaadresa').className = "videt";
  }
}


function ZmenDodaniEUR(cislo) {
  if (cislo == 3) {
    document.getElementById('oh-jinaadresa').className = "nevidet";
  }
  else {
    document.getElementById('oh-jinaadresa').className = "videt";
  }
}


function PocitadloTextu(textarea, countdown, maxlimit)
{
  textareaid = document.getElementById(textarea);
  if (textareaid.value.length > maxlimit) textareaid.value = textareaid.value.substring(0, maxlimit);
  else document.getElementById(countdown).value = maxlimit-textareaid.value.length;
}


function KontrolaUstajeni() {
  chyba = "";
  document.fo_ustajeni.us_odeslat.value = 0;

  if (document.fo_ustajeni.us_heslo.value == "") chyba += "heslo, ";
  if (document.fo_ustajeni.us_nazevstaje.value == "") chyba += "název stáje, ";
  if (document.fo_ustajeni.us_kontaktniosoba.value == "") chyba += "kontaktní osoba, ";
  if (document.fo_ustajeni.us_telefon.value == "") chyba += "telefon, ";
  if (document.fo_ustajeni.us_email.value == "") chyba += "email, ";
  if (document.fo_ustajeni.us_kraj.value == "") chyba += "kraj, ";
  if (document.fo_ustajeni.us_okres.value == "") chyba += "okres, ";
  if (document.fo_ustajeni.us_ulice.value == "") chyba += "ulice, ";
  if (document.fo_ustajeni.us_mesto.value == "") chyba += "mesto, ";
  if (document.fo_ustajeni.us_psc.value == "") chyba += "PSČ, ";
  if (document.fo_ustajeni.us_cena.value == "") chyba += "cena.";

  if (chyba != "") {
    alert("Vložte prosím následující údaje: "+chyba);
    return false;
  }
  else {
    document.fo_ustajeni.us_odeslat.value = 1;
    document.fo_ustajeni.submit();
  }
}


function KontrolaHledaniUstajeni() {
  if (document.fo_hledejustajeni.us_slovo.value != "") document.fo_hledejustajeni.submit();
  else alert("Zadejte prosím hledaný výraz!");
}

function KontrolaDotaz() {
  if (document.fo_dotaz.rd_email.value != "" && document.fo_dotaz.rd_telefon.value != "" && document.fo_dotaz.rd_dotaz.value != "") {
    if (document.fo_dotaz.rd_typ.value == 0) {
      alert("Vyberte prosím typ dotazu!");
    }
    else if (!TestEmailu(document.fo_dotaz.rd_email.value) || !ZkontrolujEmail(document.fo_dotaz.rd_email.value) || (document.fo_dotaz.rd_email.value.search(emailRegEx) == -1)) {
      alert("Zadaná emailová adresa není ve správném formátu!!");
      document.fo_dotaz.rd_email.focus();
    }
    else if (document.fo_dotaz.rd_nevyplneno.value == "") {
      document.fo_dotaz.submit();
    }
    else {
      alert("Nastala chyba v odesílání formuláře!");
    }
  }
  else alert("Zadejte prosím všechny informace!");
}

function KontrolaKontaktniFormular() {
  if (document.fo_kf.kf_email.value != "") document.fo_kf.submit();
  else alert("Zadejte prosím Váš email!");
}

function KontrolaSmazUstajeni() {
  if ((document.fo_smazustajeni.us_kod.value != "") && (document.fo_smazustajeni.us_heslo.value != "")) document.fo_smazustajeni.submit();
  else alert("Zadejte prosím kód a heslo inzerátu!");
}

function KontrolaNewsletter() {
  if (document.fo_news.on_email.value != "") document.fo_news.submit();
  else alert("Zadejte prosím email!");
}


function KontrolaInzeratEditace() {
  chyba = "";

  if (document.fo_inzerat.ez_nazev.value == "") chyba += "název, ";
  if (document.fo_inzerat.ez_text.value == "") chyba += "text, ";
  if (document.fo_inzerat.ez_typ.value == "") chyba += "typ, ";
  if (document.fo_inzerat.ez_skupina.value == "") chyba += "skupina, ";
  if (document.fo_inzerat.ez_cena.value == "") chyba += "cena, ";
  if (document.fo_inzerat.ez_jmeno.value == "") chyba += "jméno, ";
  if (document.fo_inzerat.ez_telefon.value == "") chyba += "telefon, ";
  if (document.fo_inzerat.ez_email.value == "") chyba += "email, ";
  if (document.fo_inzerat.ez_heslo.value == "") chyba += "heslo.";

  if (chyba != "") {
    alert("Vložte prosím následující údaje: "+chyba);
    return false;
  }
  else {
    document.fo_inzerat.ez_odeslat.value = 1;
    document.fo_inzerat.submit();
  }
}


function KontrolaDealer() {
  if ((document.fo_dealer.de_firma.value != "") && (document.fo_dealer.de_adresa.value != "") && (document.fo_dealer.de_telefon.value != "") && (document.fo_dealer.de_email.value != "")) {
    document.fo_dealer.de_odeslat.value = 1;
    document.fo_dealer.submit();
  }
  else alert("Zadejte prosím všechny povinné údaje!");
}


function BannerVloz() {
  if (document.getElementById("form-banner").ba_popis.value != "") {
    document.getElementById("form-banner").ba_odeslat.value = 1;
    document.getElementById("form-banner").submit();
  }
  else alert("Zadejte prosím povinné údaje.");
}

function BannerWesternVloz() {
  if (document.getElementById("form-banner").ba_popis.value != "") {
    document.getElementById("form-banner").ba_odeslat.value = 1;
    document.getElementById("form-banner").submit();
  }
  else alert("Zadejte prosím povinné údaje.");
}


function Detail(obrazek) {
  okno=window.open("", "Detail", "left=100, top=50, width=640, height=480, toolbar=no, statusbar=no, resizable=yes, scrollbars=yes");
  with (okno.document) {
    open();
    writeln("<html>\n<head><title>Detail obrázku: " +obrazek+ "</title></head>");
    writeln("<body style='margin: 0; padding: 0' onLoad='pre()'>");
    writeln("<scri"+"pt language='javascript'>function pre() \n{\n imgwidth=obr.width;\n imgheight=obr.height;\n window.resizeTo(imgwidth+30, imgheight+40)\n }\n</sc"+"ript>")
    writeln("<img src='" +obrazek+ "' border=0 onClick='window.close()' id=obr alt='kliknutím zavřete okno'>");
    writeln("");
    close();
  }
}


function KontrolaOdeslani(typ) {
  if (typ == 1) document.getElementById("form_kosik").a.value = "o";
  else document.getElementById("form_kosik").a.value = "p";
}


function KontrolaObrazek(typ) {
  if (typ == 1) {
    if (document.getElementById('fo_obrazek').zb_kod.value != "" && document.getElementById('fo_obrazek').zb_varianta.value != "" && document.getElementById('fo_obrazek').so_nazev.value != "" && document.getElementById('fo_obrazek').so_soubor.value != "") {
      document.getElementById('fo_obrazek').a.value = "o1";
      document.getElementById('fo_obrazek').so_odeslat.value = "1";
      document.getElementById('fo_obrazek').submit();
    }
    else alert("Vložte povinné údaje!");
  }
  else {
    if (document.getElementById('fo_obrazek').zb_kod2.value != "" && document.getElementById('fo_obrazek').zb_varianta2.value != "" && document.getElementById('fo_obrazek').so_id.value != 0) {
      document.getElementById('fo_obrazek').a.value = "o2";
      document.getElementById('fo_obrazek').so_odeslat.value = "1";
      document.getElementById('fo_obrazek').submit();
    }
    else alert("Vložte povinné údaje!");
  }
}


function KontrolaOdstranit(sid, zid) {
  if (confirm("Opravdu chcete odstranit zboží?!")) {
    location.href="zbozi.php?a=s&sid="+sid+"&zid="+zid;
  }
  else alert("Zboží nebylo odstraněno.");
}


function KontrolaKosik(typ) {
  if (typ == 1) {
    if (document.getElementById('fo_kosik').zb_varianta.value != 0) {
      document.getElementById('fo_kosik').submit();
    }
    else alert("Vyberte prosím barvu a velikost zboží!");
  }
  else {
    document.getElementById('fo_kosik').submit();
  }
}


function Visible() {
  document.getElementById('iddostupnost').className = "popis-dostupnost";
}


function KontrolaKuponu(typ) {
  if (typ == 1) {
    if (document.getElementById('fo_kupon').zb_kod1.value != "") {
      document.getElementById('fo_kupon').ku_odeslat.value = 1;
      document.getElementById('fo_kupon').submit();
    }
    else alert("Zadejte prosím kód zboží!");
  }
  else {
    if (document.getElementById('fo_kupon').zb_kod2.value != "") {
      document.getElementById('fo_kupon').ku_odeslat.value = 1;
      document.getElementById('fo_kupon').submit();
    }
    else alert("Zadejte prosím kód zboží!");
  }
}


function OpenPopUp(web) {
  mywindow = window.open(web, "mywindow", "location=1, status=1, scrollbars=1, width=700, height=500");
  mywindow.moveTo(200, 100);
}


function KontrolaSlevaKod() {
  var kod = document.getElementById('fo_fakturace').ku_kod.value;
  var letterNumber = /^[0-9a-zA-Z]+$/;

  if (kod != "") {
    if (kod.substring(0, 4).match(letterNumber) &&
  	kod.substring(5, 9).match(letterNumber) &&
 	kod.length == 9 &&
	kod.charAt(4) == "-") {
      // alert("Slevový kód je v pořádku! Kód: "+kod+" | 0-4: "+kod.substring(0, 4)+" | 5-9: "+kod.substring(5, 9)+" | délka: "+kod.length+" | charat(5): "+kod.charAt(4));

      // alert("Slevový kód je v pořádku.");
     
      if (confirm('Opravdu chcete kód použít?')) document.location = '/kosik-pokladna.php?a=ak&kupon='+kod;
      return true;
    }
    else {
      alert("Slevový kód není správný!");
      return false;
    }
  }
  else alert("Slevový kód není vyplněn!");
}


function disableEnterKey(e) {
 var key;

 if (window.event) key = window.event.keyCode;     //IE
 else key = e.which;     //firefox

 if (key == 13) return false;
 else return true;
}






