// JavaScript Document

//---- Nahrazení textu vyhledavacího pole --------------------------------------
function SearchReplaceFocus(input,text) {
	if(input.value==text)input.value = "";
	input.style.color="#333";
}

function SearchReplaceBlur(input,text) {
  if(input.value=="")input.value = text;
  input.style.color="#999";
}

//------------------------------------------------------------------------------
//---- Síla hesla --------------------------------------------------------------

	function sila_hesla(idh){
	  var sila = 0;
    var rv_heslo1=/[a-zA-Z]+/;
    var rv_heslo2=/[0-9]+/;
    var rv_heslo3=/[ ,.;-?:_!§/\(\)@&#{}<>\/\*\-\+]/;

    if(rv_heslo1.test(idh.value)){
			sila++;
		}
		if(rv_heslo2.test(idh.value)){
      sila++;
		}
		if(rv_heslo3.test(idh.value)){
      sila++;
		}
		if(idh.value.length < 6) sila--;
		return sila;
	}


	function zobraz_silu(idhesla, obarvit){//zadává se id pole s heslem a id pole které se má obarvit
	  // onkeyup="zobraz_silu(this, obarvit)"
	  var sila = sila_hesla(idhesla);
		switch (sila) {
		  case 0:
		  	document.getElementById(obarvit).style.backgroundColor="#f00";
		  	break;
		  case 1:
				document.getElementById(obarvit).style.backgroundColor="#f00";
		  	break;
		  case 2:
		    document.getElementById(obarvit).style.backgroundColor="#f90";
		  	break;
      case 3:
		    document.getElementById(obarvit).style.backgroundColor="#0f0";
		  	break;
      case 4:
		    document.getElementById(obarvit).style.backgroundColor="#0f0";
		  	break;
			default:
	      document.getElementById(obarvit).style.backgroundColor="#f00";
				break;
		}
	}

//------------------------------------------------------------------------------
