////////////////////// v priade ze existuje ALERT tak ho po 5 vterinach schovat
function AlertCheck(){
	if ( document.getElementById('alert') ){
		BD=window.setTimeout("AlertOff('100')",5000);
	}
}

function AlertOff(opc){
	clearInterval(BD);
		var ie5=(document.getElementById && document.all);
		var ns6=(document.getElementById && !document.all);
		nPlus = 20   //the % of fading for each step
		speed = 50  //the speed
			
		    if(document.getElementById){
		       imgs = document.getElementById('alert');
				opacity = opc-nPlus;
				opc = opacity;
				
		    	if(opacity>-30){
					if(ie5){
				        imgs.style.filter="alpha(opacity=0)";
						imgs.filters.alpha.opacity = opacity;
					}
					
					if(ns6){
		        		imgs.style.MozOpacity = 0;
						imgs.style.MozOpacity = opacity/100;
		    		}
					tmr=setTimeout('AlertOff('+opc+')',speed);
		    	}else{
					clearInterval(tmr);
				}
		  }
	
	//document.getElementById('alert').style.display='none';
}




function MenuOver(id){
	document.getElementById(id+'1').style.backgroundColor='#ff8000';
}
function MenuOut(id,color){
	document.getElementById(id+'1').style.backgroundColor=color;
}

//////// pro napovedu po kliknuti na ikonku ///////
function ShowHelp(id){
	if (document.getElementById(id).style.display == '' ){
		document.getElementById(id).style.display='none';
	}else{
		document.getElementById(id).style.display='';
	}
}
/////////// kontrola zda je vkladana hodnota cislo ////////////
	function CheckOnNumber(hodnota)					//kontrola zda je hodnota ciselna
	{
		if (hodnota==""){
			return false;
		}
		for (i=0;i<hodnota.length;i++){
			if (hodnota.charAt(i)<'0' && hodnota.charAt(i) != '.'){
			return false;
			}
			if (hodnota.charAt(i)>'9' && hodnota.charAt(i) != '.'){
			return false;
			}
		}
		return true;
	}


//////////////////// kontrola poctu vlozenych znaku /////////////
function CountChars(obj,maxchars,text){
			retezec = document.getElementById(obj).value;
			strlength=retezec.length;
				if (strlength > maxchars ) 
				{
	                alert("Text je pøíliš dlouhý !");           
	                document.getElementById(obj).value=retezec.substring(0,maxchars);
				}
				else{
			document.getElementById(text).innerText =  retezec.length ;
				}
}



////////////////// kontrola emailove adresy ///////////////////
	function CheckOnEmail(email)
	{
		invalidChars='/:,;ìšèøžýáíéúùÌŠÈØŽÝÁÍÉÙÚòÒ#$%^]}{[!?>¨§"`<+=|&*() ';			//vytvoreni promene se znaky ktere se nesmeji v adrese objevit
		for (i=0;i<invalidChars.length;i++){	//smicka proveruje zda se jeden ze znaku nevyskytuje v adrese
			badChar=invalidChars.charAt(i)
				if (email.indexOf(badChar,0)>-1){
				return false;
				}
		}
		atPos = email.indexOf('@',1)
		if (atPos==-1){
		return false;
		}
		if (email.indexOf('@',atPos+1)>-1){		//od mista nalezu prvniho @ se pokousime hledat @ (dva nelze)
		return false;
		}
		periodPos=email.indexOf('.',atPos)
		if (periodPos==-1){
		return false;
		}
		if (periodPos+3>email.length){
		return false;
		}
		return true;
	}



///////////// HTML EDITOR ////////////
function edit_mod_inic(val){
  HTMLEdit1.document.body.innerHTML =  window.edit_form.text_cz.value;
}

function edit_mod_uloz(val){
  window.edit_form.text_cz.value = HTMLEdit1.document.body.innerHTML;
  return true;
}

function nastav_hodnotu(x,y,z) {
  (HTMLEdit1.document.selection.createRange()).execCommand(x,y,z);
}

function ImageButton_MouseDown(q) 
{
  q.style.left = 2;
  q.style.top = 2;
}

function ImageButton_MouseOver(q) 
{
  q.style.left = -1;
  q.style.top = -1;
}

function ImageButton_MouseOut(q) 
{
  q.style.left = 0;
  q.style.top = 0;
}
/////////////////////// KONEC EDITORU /////////////////