function overeni_registrace() {
	var login = $('input[name=reg_login]').val();
	var password = $('input[name=reg_password]').val();
	var password_overeni = $('input[name=password_overeni]').val();
	
	var jmeno = $('input[name=jmeno]').val();
	var prijmeni = $('input[name=prijmeni]').val();
	var ulice = $('input[name=ulice]').val();
	var cislo_popisne = $('input[name=cislo_popisne]').val();
	var mesto = $('input[name=mesto]').val();
	var zeme = $('input[name=zeme]').val();
	var psc = $('input[name=psc]').val();
	
	var firma_jmeno = $('input[name=firma_jmeno]').val();
	var firma_ico = $('input[name=firma_ico]').val();
	var firma_dic = $('input[name=firma_dic]').val();
	var firma_ulice = $('input[name=firma_ulice]').val();
	var firma_cislo_popisne = $('input[name=firma_cislo_popisne]').val();
	var firma_mesto = $('input[name=firma_mesto]').val();
	var firma_zeme = $('input[name=firma_zeme]').val();
	var firma_psc = $('input[name=firma_psc]').val();
	
	var email = $('input[name=email]').val();
	var mobil = $('input[name=mobil]').val();
	
	var chyba = false;
	var chyby_text = '';
	
	if (login == '') {		
		chyba = true;
		chyby_text = 'Nevyplnil(a) jste <strong>Přihlašovací jméno</strong>!<br>';
	}
	
	if (password == '') {		
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Heslo</strong>!<br>';
	} else if (password.length <= 5) {
		chyba = true;
		chyby_text = chyby_text+'<strong>Heslo</strong> je příliš krátké (minimálně 6 znaků)!<br>';
	} else if (password != password_overeni) {
		chyba = true;
		chyby_text = chyby_text+'<strong>Heslo</strong> se nepodařilo ověřit!<br>';			
	}	
	
	var chyba_osobni = false;
	var chyby_osobni_text = '';
	var pocet_chyb_osobni = 0;
	if (jmeno == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Jméno</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (prijmeni == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje >  Příjmení</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (ulice == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Ulice</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (cislo_popisne == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Číslo popisné</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (mesto == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Město</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (zeme == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Země</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (psc == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > PSČ</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	
	var chyba_firemni = false;
	var chyby_firemni_text = '';
	var pocet_chyb_firemni = 0;
	if (firma_jmeno == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Jméno</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_ico == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje >  Příjmení</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_dic == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje >  Příjmení</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_ulice == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Ulice</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_cislo_popisne == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Číslo popisné</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_mesto == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Město</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_zeme == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Země</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_psc == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > PSČ</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	
	if (pocet_chyb_osobni == 7 && pocet_chyb_firemni == 8) {
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Fakturační údaje</strong>!<br>';
	} else if (pocet_chyb_osobni <= pocet_chyb_firemni-1) {
		chyby_text = chyby_text+chyby_osobni_text;
	} else if (pocet_chyb_osobni > pocet_chyb_firemni-1) {
		chyby_text = chyby_text+chyby_firemni_text;
	}	
	
	if (email == '') {		
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Kontaktní údaje > E-mail</strong>!<br>';
	}
	if (mobil == '') {		
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Kontaktní údaje > Mobil</strong>!<br>';
	}
	
	if (chyba == true) {
		$('#chyba_prihlaseni').html(chyby_text);	
		window.alert('Chyba při odesílání formuláře, zkontrolujte prosím zadané údaje.');
		return false;
	} else return true;
}



function objednavkaZakaznik() {
	var jmeno = $('input[name=jmeno]').val();
	var prijmeni = $('input[name=prijmeni]').val();
	var ulice = $('input[name=ulice]').val();
	var cislo_popisne = $('input[name=cislo_popisne]').val();
	var mesto = $('input[name=mesto]').val();
	var zeme = $('input[name=zeme]').val();
	var psc = $('input[name=psc]').val();
	
	var firma_jmeno = $('input[name=firma_jmeno]').val();
	var firma_ico = $('input[name=firma_ico]').val();
	var firma_dic = $('input[name=firma_dic]').val();
	var firma_ulice = $('input[name=firma_ulice]').val();
	var firma_cislo_popisne = $('input[name=firma_cislo_popisne]').val();
	var firma_mesto = $('input[name=firma_mesto]').val();
	var firma_zeme = $('input[name=firma_zeme]').val();
	var firma_psc = $('input[name=firma_psc]').val();
	
	var email = $('input[name=email]').val();
	var mobil = $('input[name=mobil]').val();
	
	var chyba = false;
	var chyby_text = '';	
	
	var chyba_osobni = false;
	var chyby_osobni_text = '';
	var pocet_chyb_osobni = 0;
	if (jmeno == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Jméno</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (prijmeni == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje >  Příjmení</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (ulice == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Ulice</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (cislo_popisne == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Číslo popisné</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (mesto == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Město</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (zeme == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > Země</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	if (psc == '') {
		chyba_osobni = true;
		chyby_osobni_text = chyby_osobni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Osobní údaje > PSČ</strong>!<br>';
		pocet_chyb_osobni = pocet_chyb_osobni+1;
	}
	
	var chyba_firemni = false;
	var chyby_firemni_text = '';
	var pocet_chyb_firemni = 0;
	if (firma_jmeno == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Jméno</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_ico == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje >  Příjmení</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_dic == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje >  Příjmení</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_ulice == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Ulice</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_cislo_popisne == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Číslo popisné</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_mesto == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Město</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_zeme == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > Země</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	if (firma_psc == '') {
		chyba_firemni = true;
		chyby_firemni_text = chyby_firemni_text+'Nevyplnil(a) jste <strong>Fakturační údaje > Firemní údaje > PSČ</strong>!<br>';
		pocet_chyb_firemni = pocet_chyb_firemni+1;
	}
	
	if (pocet_chyb_osobni == 7 && pocet_chyb_firemni == 8) {
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Fakturační údaje</strong>!<br>';
	} else if (pocet_chyb_osobni <= pocet_chyb_firemni-1) {
		chyby_text = chyby_text+chyby_osobni_text;
	} else if (pocet_chyb_osobni > pocet_chyb_firemni-1) {
		chyby_text = chyby_text+chyby_firemni_text;
	}	
	
	if (email == '') {		
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Kontaktní údaje > E-mail</strong>!<br>';
	}
	if (mobil == '') {		
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Kontaktní údaje > Mobil</strong>!<br>';
	}
	
	if (chyba == true) {
		$('#zakaznik_osobni_udaje').append('<p>'+chyby_text+'</p>');	
		window.alert('Chyba při odesílání formuláře, zkontrolujte prosím zadané údaje.');
		return false;
	} else return true;
}


function dopravaPlatba() {
	var doprava = $('input[name=doprava]:checked').val();
	var platba = $('input[name=platba]:checked').val();
	
	var chyby_text = '';
	var chyba = false;
	
	if (doprava == undefined) {	
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Doprava</strong>!<br>';
	}
	if (platba == undefined) {
		chyba = true;
		chyby_text = chyby_text+'Nevyplnil(a) jste <strong>Platba</strong>!<br>';
	}
	
	if (chyba == true) {
		$('#objednavka').append('<p>'+chyby_text+'</p>');	
		window.alert('Chyba při odesílání formuláře, zkontrolujte prosím zadané údaje.');
		return false;
	} else return true;
}
