var HideSelectBox=false;

function JeInt(tnum){
//Otestuje zda je tnum celé číslo - testuje int číslo
	var zpet=false;
	if(tnum!="" && tnum!=null){
		if(parseInt(tnum).toString()==tnum.toString()){
			zpet=true;
		}
	}
	return zpet;
}

function JeFloat(tnum){
//Otestuje zda je tnum číslo - testuje float číslo
	var zpet=false;
	if(tnum!="" && tnum!=null){
		if(parseFloat(NaJSFloat(tnum)).toString()==NaJSFloat(tnum).toString()){
			zpet=true;
		}
	}
	return zpet;
}

function NaJSFloat(tnum){
//Převede v tnum "," na "."
	re=/,/g;
	return tnum.toString().replace(re, ".");
}

function NaCZFloat(tnum){
//Převede v tnum "." na ","
	re=/\./g;
	return tnum.toString().replace(re, ",");
}

function BezEntit(tstr){
//Převede tstr řetězec bez entit
//převádí tyto entity &quot &lt &qt
	re=/&quot/g;
	nstr=tstr.toString().replace(re, "\"");
	re=/&lt/g;
	nstr=nstr.toString().replace(re, "<");
	re=/&gt/g;
	return nstr.toString().replace(re, ">");
}

function JeOddo(tnum,tmin,tmax){
//Otestuje zda je tnum číslo větší nebo rovno tmin a současně menší než tmax
	var zpet=false;
	if(parseFloat(tnum)>=tmin && parseFloat(tnum)<tmax) zpet=true;
	return zpet;
}

function JeZadano(tstr){
//Otestuje zda je tstr hodnota různá od "" a null
	var zpet=false;
	if(tstr!="" && tstr!=null && tstr!=false) zpet=true;
	return zpet;
}

function JeDelka(tstr,dmin,dmax){
//Otestuje zda je tstr řetězec delší nebo rovno dmin a současně kratší než dmax
	var zpet=false;
	if(JeZadano(tstr)){
		if(tstr.length>=dmin && tstr.length<dmax) zpet=true;
	}
	return zpet;
}

function JeEmail(tstr){
//Otestuje zda je tstr platná E-mailová adresa
	var zpet=false;
  	if(JeZadano(tstr)){
	  	regv = /^[a-zA-Z\d\._-]+\@[a-zA-Z\d\._-]+\.[a-z]+$/;
		rtest=regv.test(tstr);
  		if(!rtest){
  			zpet=false;
		}
		else{
  			zpet=true;
		}
  	}
	return zpet;
}

function isTaN(tstr){
//Otestuje zda je tstr řetězec pouze písmen a číslic
	var zpet=false;
  	if(JeZadano(tstr)){
	  	regv = /^[a-zA-Z\děščřžťďňýáíéóúůĚŠČŘŽŤĎŇÝÁÍÉÓÚŮ ]+$/;
		rtest=regv.test(tstr);
  		if(!rtest){
  			zpet=false;
		}
		else{
  			zpet=true;
		}
  	}
	return zpet;
}

function JeDatum(tpol){
	var zpet=false;
	if(JeZadano(tpol)){
		regv = /^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}$/;
		rtest=regv.test(tpol);
  		if(rtest){
  			var adat=tpol.split(".");
  			adat[1]=parseInt(adat[1])-1;
  			var tdat=new Date(adat[2],adat[1],adat[0]);
  			if(parseInt(tdat.getYear())<1900){
  				rokzd=parseInt(tdat.getYear())+1900;
  			}
  			else{
  				rokzd=parseInt(tdat.getYear());
  			}
  			if(!(rokzd!=parseInt(adat[2]) || parseInt(tdat.getMonth())!=parseInt(adat[1]) || parseInt(tdat.getDate())!=parseInt(adat[0]))){
				zpet=true;
			}
  		}
	}
	return zpet;
}

function TestVetsiDovnoDat(tpo2,tpo1){
	var zpet=false;
	var adat=tpo2.split(".");
	var tdat2=new Date(adat[2],adat[1],adat[0]);
	var adat=tpo1.split(".");
	var tdat1=new Date(adat[2],adat[1],adat[0]);
	if(tdat2.valueOf()>=tdat1.valueOf()){
		zpet=true;
	}
	return zpet;
}

function SelR(IDf){
	document.getElementById("Row" + IDf).style.background=colorSelectRow;
	selclick="0";
}
function UnSelR(IDf){
	if(parseInt(pointRow)!=parseInt(IDf)){
		document.getElementById("Row" + IDf).style.background=colorUnSelectRow;
	}
}
function GoDetail(IDw,IDf,ActSc){
	if(parseInt(pointRow)!=-1) document.getElementById("Row" + pointRow).style.background=colorUnSelectRow;
	pointRow=IDw;
	frm=document.FormDetail;
	frm.action=ActSc;
	frm.idp.value=IDf;
	frm.submit();
}
