function KontrolaS ()
{


if (document.studna.volba.checked == true)
{
} else
{

 if (isNaN(document.studna.gps_n_v.value))
 	{
        document.studna.gps_n_v.focus();
		alert("Zadejte číselnou hodnotu do pole vteřiny v zeměpisné šířce.");
		return false;
	}
	
 if (isNaN(document.studna.gps_e_v.value))
 	{
        document.studna.gps_e_v.focus();
		alert("Zadejte číselnou hodnotu do pole vteřiny v zeměpisné délce.");
		return false;
	}


 if (isNaN(document.studna.gps_nv.value))
 	{
        document.studna.gps_nv.focus();
		alert("Zadejte číselnou hodnotu do pole nadmořská výška.");
		return false;
	}


	if (document.studna.gps_n_s.value == "")
   {
      document.studna.gps_n_s.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_n_m.value == "")
   {
      document.studna.gps_n_m.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_n_v.value == "")
   {
      document.studna.gps_n_v.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_e_s.value == "")
   {
      document.studna.gps_e_s.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_e_m.value == "")
   {
      document.studna.gps_e_m.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   
   if (document.studna.gps_e_v.value == "")
   {
      document.studna.gps_e_v.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }

gpsns=eval(document.studna.gps_n_s.value);
gpsnm=eval(document.studna.gps_n_m.value);
gpsnv=document.studna.gps_n_v.value;
gpses=eval(document.studna.gps_e_s.value);
gpsem=eval(document.studna.gps_e_m.value);
gpsev=document.studna.gps_e_v.value;
gps_nv=document.studna.gps_nv.value;

n=eval(gpsns) + eval(gpsnm/60);
e=eval(gpses) + eval(gpsem/60);

fotka=document.studna.foto.value;
delka=fotka.length;
test_foto=fotka.substring(eval(delka)-3,eval(delka))

	if (gpsns < 0 || gpsns > 90)
   {
      document.studna.gps_n_s.focus();
      alert ("Hodnota zeměpisné šířky - stupně, je mimo rozsah.");
      return false;
   }
	if (gpsnm < 0 || gpsnm > 60)
   {
      document.studna.gps_n_m.focus();
      alert ("Hodnota zeměpisné šířky - minuty, je mimo rozsah");
      return false;
   }
	if (gpsnv < 0 || gpsnv > 60)
   {
      document.studna.gps_n_v.focus();
      alert ("Hodnota zeměpisné šířky - vteřiny, je mimo rozsah.");
      return false;
   }
if (gpses < 0 || gpses > 90)
   {
      document.studna.gps_e_s.focus();
      alert ("Hodnota zeměpisné délky - stupně, je mimo rozsah.");
      return false;
   }
	if (gpsem < 0 || gpsem > 60)
   {
      document.studna.gps_e_m.focus();
      alert ("Hodnota zeměpisné délky - minuty, je mimo rozsah");
      return false;
   }
	if (gpsev < 0 || gpsev > 60)
   {
      document.studna.gps_e_v.focus();
      alert ("Hodnota zeměpisné délky - vteřiny, je mimo rozsah.");
      return false;
   }

if (n > 51.083 || n < 48.54)
   {
      document.studna.gps_n_s.focus();
      alert ("Zeměpisná šířka je mimo ČR. Evidujeme pouze studánky v rámci ČR.");
      return false;
   }

if (e > 18.883 || e < 12.05)
   {
      document.studna.gps_e_s.focus();
      alert ("Zeměpisná délka je mimo ČR. Evidujeme pouze studánky v rámci ČR.");
      return false;
   }
}

if (document.studna.foto.value == "")
   {
      document.studna.foto.focus();
      alert ("Není přiloženo foto studánky.");
      return false;
   }

}

function KontrolaM ()
{


if (document.studna.volba.checked == true)
{
} else
{

	if (document.studna.gps_n_s.value == "")
   {
      document.studna.gps_n_s.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_n_m.value == "")
   {
      document.studna.gps_n_m.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_e_s.value == "")
   {
      document.studna.gps_e_s.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   if (document.studna.gps_e_m.value == "")
   {
      document.studna.gps_e_m.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }
   
    if (isNaN(document.studna.gps_n_m.value))
 	{
        document.studna.gps_n_m.focus();
		alert("Zadejte číselnou hodnotu do pole minuty a vteřiny v zeměpisné šířce.");
		return false;
	}
	
 if (isNaN(document.studna.gps_e_m.value))
 	{
        document.studna.gps_e_m.focus();
		alert("Zadejte číselnou hodnotu do pole minuty a vteřiny v zeměpisné délce.");
		return false;
	}


 if (isNaN(document.studna.gps_nv.value))
 	{
        document.studna.gps_nv.focus();
		alert("Zadejte číselnou hodnotu do pole nadmořská výška.");
		return false;
	}

gpsns=document.studna.gps_n_s.value;
gpsnm=document.studna.gps_n_m.value;
nm=Math.floor(gpsnm);
gpsnv=(gpsnm-nm)*60;

gpses=document.studna.gps_e_s.value;
gpsem=document.studna.gps_e_m.value;
em=Math.floor(gpsem);
gpsev=(gpsem-em)*60;

gps_nv=document.studna.gps_nv.value;

n=eval(gpsns) + eval(nm/60);
e=eval(gpses) + eval(em/60);

fotka=document.studna.foto.value;
delka=fotka.length;
test_foto=fotka.substring(eval(delka)-3,eval(delka))

	if (gpsns < 0 || gpsns > 90)
   {
      document.studna.gps_n_s.focus();
      alert ("Hodnota zeměpisné šířky - stupně, je mimo rozsah.");
      return false;
   }
	if (gpsnm < 0 || gpsnm > 60)
   {
      document.studna.gps_n_m.focus();
      alert ("Hodnota zeměpisné šířky - minuty, je mimo rozsah");
      return false;
   }

if (gpses < 0 || gpses > 90)
   {
      document.studna.gps_e_s.focus();
      alert ("Hodnota zeměpisné délky - stupně, je mimo rozsah.");
      return false;
   }
	if (gpsem < 0 || gpsem > 60)
   {
      document.studna.gps_e_m.focus();
      alert ("Hodnota zeměpisné délky - minuty, je mimo rozsah");
      return false;
   }

if (n > 51.083 || n < 48.54)
   {
      document.studna.gps_n_s.focus();
      alert ("Zeměpisná šířka je mimo ČR. Evidujeme pouze studánky v rámci ČR.");
      return false;
   }

if (e > 18.883 || e < 12.05)
   {
      document.studna.gps_e_s.focus();
      alert ("Zeměpisná délka je mimo ČR. Evidujeme pouze studánky v rámci ČR.");
      return false;
   }
}

if (document.studna.foto.value == "")
   {
      document.studna.foto.focus();
      alert ("Není přiloženo foto studánky.");
      return false;
   }

}


function KontrolaD ()
{


if (document.studna.volba.checked == true)
{
} else
{

	if (document.studna.gps_n_s.value == "")
   {
      document.studna.gps_n_s.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }

	if (document.studna.gps_e_s.value == "")
   {
      document.studna.gps_e_s.focus();
      alert ("Nezadali jste souřadnici GPS.");
      return false;
   }

	if (isNaN(document.studna.gps_n_s.value))
 	{
        document.studna.gps_n_s.focus();
		alert("Zadejte číselnou hodnotu do pole zeměpisná šířka.");
		return false;
	}
	
   if (isNaN(document.studna.gps_e_s.value))
 	{
        document.studna.gps_e_s.focus();
		alert("Zadejte číselnou hodnotu do pole zeměpisná délka.");
		return false;
	}

 if (isNaN(document.studna.gps_nv.value))
 	{
        document.studna.gps_nv.focus();
		alert("Zadejte číselnou hodnotu do pole nadmořská výška.");
		return false;
	}
	
gpsns=eval(document.studna.gps_n_s.value);
ns=Math.floor(gpsns);
nm=Math.floor((gpsns-ns)*60);
nv=(gpsns-(ns+nm/60))*3600;

gpses=eval(document.studna.gps_e_s.value);
es=Math.floor(gpses);
em=Math.floor((gpses-es)*60);
ev=(gpses-(es+em/60))*3600;

gps_nv=document.studna.gps_nv.value;

fotka=document.studna.foto.value;
delka=fotka.length;
test_foto=fotka.substring(eval(delka)-3,eval(delka))

n = ns + nm/60;
e = es + em/60;

	if (gpsns < 0 || gpsns > 90)
   {
      document.studna.gps_n_s.focus();
      alert ("Hodnota zeměpisné šířky je mimo rozsah.");
      return false;
   }

if (gpses < 0 || gpses > 90)
   {
      document.studna.gps_e_s.focus();
      alert ("Hodnota zeměpisné délky je mimo rozsah.");
      return false;
   }

if (n > 51.083 || n < 48.54)
   {
      document.studna.gps_n_s.focus();
      alert ("Zeměpisná šířka je mimo ČR. Evidujeme pouze studánky v rámci ČR.");
      return false;
   }

if (e > 18.883 || e < 12.05)
   {
      document.studna.gps_e_s.focus();
      alert ("Zeměpisná délka je mimo ČR. Evidujeme pouze studánky v rámci ČR.");
      return false;
   }
}

if (document.studna.foto.value == "")
   {
      document.studna.foto.focus();
      alert ("Není přiloženo foto studánky.");
      return false;
   }

}

function Check ()
{

if (document.chyba.error.value == "")
   {
      document.chyba.error.focus();
      alert ("Nepopsali jste žádnou chybu, těžko pak lze něco opravovat.");
      return false;
   }

soucet = document.chyba.k1.value/439 + document.chyba.k2.value/439;

if (document.chyba.kontr.value != soucet)
   {
      document.chyba.kontr.focus();
      alert ("Kontrolní výpočet nesouhlasí, zkuste to znovu.");
      return false;
   }


popis = document.chyba.error.value;
delka = popis.length;
if (delka < 10)
   {
      document.chyba.error.focus();
      alert ("Celkem krátký popis chyby nezdá se vám?");
      return false;
   }
	
}

function MKont ()
{
t = document.mereni.t.value;
tvrd = document.mereni.tvrd.value;
ph = document.mereni.ph.value;
no3 = document.mereni.no3.value;
ec = document.mereni.ec.value;
no2 = document.mereni.no2.value;
tds = document.mereni.tds.value;
nh = document.mereni.nh.value;
po4 = document.mereni.po4.value;

if (t != "")
	{
	if (isNaN(t))
 		{
        document.mereni.t.focus();
		alert("Zadejte číselnou hodnotu do pole teplota.");
		return false;
		}

	if (t < -3 || t > 100)
	   {
      document.mereni.t.focus();
      alert ("Teplota mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (tvrd != "")
	{
	if (isNaN(tvrd))
 		{
        document.mereni.tvrd.focus();
		alert("Zadejte číselnou hodnotu do pole tvrdost vody.");
		return false;
		}

	if (tvrd < 0 || tvrd > 7)
	   {
      document.mereni.tvrd.focus();
      alert ("Tvrdost vody mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (ph != "")
	{
	if (isNaN(ph))
 		{
        document.mereni.ph.focus();
		alert("Zadejte číselnou hodnotu do pole pH.");
		return false;
		}

	if (ph < 0 || ph > 14)
	   {
      document.mereni.ph.focus();
      alert ("pH mimo rozsah který je 0 až 14");
      return false;
	   }
	}

if (no3 != "")
	{
	if (isNaN(no3))
 		{
        document.mereni.no3.focus();
		alert("Zadejte číselnou hodnotu do pole dusičnany.");
		return false;
		}

	if (no3 < 0 || no3 > 200)
	   {
      document.mereni.no3.focus();
      alert ("Dusičnany mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (no2 != "")
	{
	if (isNaN(no2))
 		{
        document.mereni.no2.focus();
		alert("Zadejte číselnou hodnotu do pole dusitany.");
		return false;
		}

	if (no2 < 0 || no2 > 2)
	   {
      document.mereni.no2.focus();
      alert ("Dusitany mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (ec != "")
	{
	if (isNaN(ec))
 		{
        document.mereni.ec.focus();
		alert("Zadejte číselnou hodnotu do pole konduktivita.");
		return false;
		}

	if (ec < 0 || ec > 20000)
	   {
      document.mereni.ec.focus();
      alert ("Konduktivita mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (tds != "")
	{
	if (isNaN(tds))
 		{
        document.mereni.tds.focus();
		alert("Zadejte číselnou hodnotu do pole TDS.");
		return false;
		}

	if (tds < 0 || tds > 2000)
	   {
      document.mereni.tds.focus();
      alert ("TDS mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (nh != "")
	{
	if (isNaN(nh))
 		{
        document.mereni.nh.focus();
		alert("Zadejte číselnou hodnotu do pole amonium/amoniak.");
		return false;
		}

	if (nh < 0 || nh > 10)
	   {
      document.mereni.nh.focus();
      alert ("Amonium/amoniak mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

if (po4 != "")
	{
	if (isNaN(po4))
 		{
        document.mereni.po4.focus();
		alert("Zadejte číselnou hodnotu do pole fosfát.");
		return false;
		}

	if (po4 < 0 || po4 > 20)
	   {
      document.mereni.po4.focus();
      alert ("Fosfát mimo rozsah, zkuste lepší číslo.");
      return false;
	   }
	}

}
