if (top.length != self.length) top.location.href = self.location.href;
if (!document.getElementById && document.all) document.getElementById = document.all;

var jeVidet = false;

function prm(d)
{
document.getElementById(d).style.display = (jeVidet ? 'none' : 'block');
jeVidet = (jeVidet ? false : true);
}

function open_new(w,h) {
Okno=window.open("","JSL",'toolbar=0,location=0,scrollbars=0,width='+w+',height='+h+',resizable=0,top=50,left=50');
Okno.focus();
}

function Uvodka(i){
	var e = document.getElementById("formular");
	
	if(i=="i1"){
	e.setAttribute('action', 'vyhledavani.html');
	}
	
	if(i=="i2"){
	// zmena action a zrejme i post dle info z google
	e.setAttribute('action', '');
	}

}

function Zobr(){
	if(document.getElementById('navrh_text').style.display == "none")
	{
  document.getElementById('navrh_text').style.display = "block"
  }
	else
  {
	document.getElementById('t1').style.display = "none";
	}

}


function Oblibene()
{
var detect = navigator.userAgent.toLowerCase();

if(detect.indexOf("opera") >= 0)
{
alert('Pokud používáte skvělý prohlížeč Opera\nstiskněte CTRL+D pro vložení stránky do oblíbených.')
}

else if(detect.indexOf("gecko") >= 0)
{
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))
{
window.sidebar.addPanel ("Ezoterika.cz - katalog www stránek", "http://www.ezoterika.cz","");
}
}

else if(detect.indexOf("konqueror") >= 0)
{
alert('Pokud používáte skvělý prohlížeč Konqueror\nstisknětee CTRL+D pro vložení stránky oblíbených')
}

else if(detect.indexOf("msie") >= 0)
{
window.external.AddFavorite('http://www.ezoterika.cz', 'Ezoterika.cz - katalog www stránek');
}

else
{
alert('Nepodařilo se detekovat typ prohlížeče.\nPro uložení stránky mezi oblíbené zkuste klávesové zkratky CTRL+D nebo CTRL+T')
}

}

function zmena(a)
{
var e = document.getElementById("formular");
e.setAttribute('action', a);
}

/* 
counter functions by Michal Soukup
Modified by Robert Hlobilek 2006
*/
var str;
var maxChars = 300;

function counted(str) {
  var orginal = str.length;
  return  maxChars - orginal;
}

function progresbar (str) {
  var len = str.length;
  var maxWidths = document.getElementById('progres_main').style.width;
  maxWidth =  maxWidths.substr(0,maxWidths.length -2)-2;
  var pBar = document.getElementById('progres_bar');
  
  var newWidth = maxWidth/maxChars*len;
  var procento = Math.round((len/maxChars*100)-0.4)+'%';
  pBar.style.width = newWidth+'px';
  document.getElementById('progres_val').innerHTML=procento;
}

function countChars(){

   var theForm = document.getElementById('np');
   theForm.counter.value = counted(theForm.popis.value);
   progresbar (theForm.popis.value);
   
   if ( theForm.counter.value < 1) {
     alert('NELZE VLOŽIT VÍCE NEŽ '+ maxChars +' ZNAKŮ');
     theForm.popis.value=theForm.popis.value.substr(0,maxChars);
   } else if (theForm.counter.value > 750) {
      theForm.counter.style.color = 'black';
   } else if (theForm.counter.value > 400) {
      theForm.counter.style.color = 'ThreedDarkShadow';
   } else if (theForm.counter.value > 200) {
      theForm.counter.style.color = 'gray';
   } else if (theForm.counter.value > 100) {
      theForm.counter.style.color = '#FF8000';
   } else if (theForm.counter.value > 50) {
      theForm.counter.style.color = 'red';
   } else {
      theForm.counter.style.color = 'red';
   }
}


