var bStorno = false;
var bDelete = false;

var captionOpravduSmazat = "Opravdu chcete zrušit registraci?";

function kontrolaDatSamoReg(formular)
{
        if (bDelete)
	{
		bDelete = false;
		if ( !confirm(captionOpravduSmazat))
		        return false;
	}
	else
	if (bStorno == false)
	{	
		hodnota = formular.PravniForma.value;
	        if (trim(hodnota) == '')
	        {
			alert("Není zadána Právní forma!");
			formular.PravniForma.focus();
			return false;
		}
			        
		hodnota = formular.Nazev1.value;
	        if (trim(hodnota) == '')
	        {
			alert("Není zadán Název společnosti!");
			formular.Nazev1.focus();
			return false;
		}
		
		hodnota = formular.IC.value;
	        if (trim(hodnota) == '')
	        {
			alert("Není zadáno IČ!");
			formular.IC.focus();
			return false;
		}
		
		if (!checkInt('IČ', formular.IC.value, 'IC', false))
			return false;

		hodnota = formular.Adresa2.value;
	        if (trim(hodnota) == '')
	        {
			alert("Není zadána Adresa společnosti!");
			formular.Adresa2.focus();
			return false;
		}
		
		
		hodnota = formular._Email1.value;
	        if (trim(hodnota) == '')
	        {
			alert("Není zadán email!");
			formular._Email1.focus();
			return false;
		}
		
		hodnota = formular.ProvozOblasti_Cislo.value;
	        if (trim(hodnota) == '')
	        {
			alert("Není zadáno Město!");
			formular.ProvozOblasti_Cislo.focus();
			return false;
		}
		
		if (!checkEmail('_Email1'))
			return false;
		
		if (!checkEmail('_Email2'))
			return false;
			
		if (!checkInt('PSČ', formular.PSC.value, 'PSC', true))
			return false;
			
		if (!checkInt('Provozovna PSČ', formular.ProvozPSC.value, 'ProvozPSC', true))
			return false;
						
 	}
 	bStorno = false;
 	bDelete = false;
 	
	return true;
}


function kontrolaDatPoptavka(formular)
{
	if (!checkEmail('Email'))
		return false;
		 
        if (trim(formular.Email.value) == '')
        {
		alert("Není zadán email!");
		formular.Email.focus();
		return false;
	}
	
	if ((trim(formular.Telefon.value) == '' || trim(formular.Telefon.value) == '+420'))	
        {
		alert("Není zadán telefon!");
		formular.Telefon.focus();
		return false;
	}
	
	if (trim(formular.Text.value) == '')
	{
		alert("Musíte zadat nějaký text!");
		formular.Text.focus();
		return false;
	}	
	
	if (trim(formular.Priloha1.value) == '' && trim(formular.Priloha2.value) == '')
	{
		if (!confirm("Není vybrána příloha! Odeslat bez přílohy?"))
		{
			formular.Priloha1.focus();
			return false;
		}
	}
	
	if (trim(formular.captcha_code.value) == '')
	{
		alert("Musíte opsat kontrolní kód z obrázku!");
		formular.captcha_code.focus();
		return false;
	}
	
	return true;		
}


function kontrolaDatNapiste(formular)
{
	if (!checkEmail('Email'))
		return false;
		 
 	
	if (trim(formular.Text.value) == '')
	{
		alert("Musíte zadat nějaký text!");
		formular.Text.focus();
		return false;
	}	
	
	if (trim(formular.captcha_code.value) == '')
	{
		alert("Musíte opsat kontrolní kód z obrázku!");
		formular.captcha_code.focus();
		return false;
	}
	
	return true;		
}

function kopie(input1_name, input2_name)
{
	var input1 = document.getElementById(input1_name);
	var input2 = document.getElementById(input2_name);
	
	input2.value = input1.value;
}


function kopiruj_sidlo()
{
	kopie('Adresa1', 'ProvozAdresa1');
	kopie('Adresa2', 'ProvozAdresa2');
	kopie('Cp', 'ProvozCp');
	kopie('PSC', 'ProvozPSC');
	kopie('_Telefon1', '_Telefon2');
	kopie('_Fax1', '_Fax2');
	kopie('_Mobil1', '_Mobil2');
	kopie('_Email1', '_Email2');
}

