//утф-8
//show element by id
function show(id){
  var o = document.getElementById(id);
  if (o) o.style.display="";
}
function hide(id){
  var o = document.getElementById(id);
  if (o) o.style.display="none";
}

function change_location (o) {
 if(o.firstChild){if(o.firstChild.href){document.location=o.firstChild.href;};}
}

function new_search() {
  f.fulltext_an.value = '';
  f.keyword_id.value = '';
  f.submit();
}

function change_L() {
  f.L.value = (f.L.value == 'EN')?'FR':'EN';
  f.submit();
  return false;
}

//window popup - obrazek
function img(obj, title)
{
	var titlebody = "height=300,width=300,resizable=1,scrollbars=1";
	newwindow=window.open('','name',titlebody);
	newwindow.document.write('<html><head><meta http-equiv="imagetoolbar" content="no"/><title>'+title+'</title></head><body text="#000000" style="background-color:white; margin: 0px; padding: 0px;">');
	newwindow.document.write('<div align="center">');
	if (obj.href){
	newwindow.document.write('<img title="click to close window" onclick="window.close()"  border=0 src="');
	newwindow.document.write(obj.href);
	newwindow.document.write('"');
	newwindow.document.write(' alt="');
	newwindow.document.write('"');
	newwindow.document.write(' style="cursor:hand;">');
	}else{
	newwindow.document.write('<p>Omlouváme se, ale obrázek nebyl nalezen.</p>');
	}
	newwindow.document.write('</div>');
	newwindow.document.write('</body></HTML>');
	switch (navigator.appName)
	{
		case 'Netscape':
		var nav = 'N';
		var w = 8;
		var h = 56;
		break;
		case 'Microsoft Internet Explorer':
		var nav = 'IE';
		var w = 30;
		var h = 38;
		break;
	}

	if(screen.width > newwindow.document.images[0].width && screen.height > newwindow.document.images[0].height)
	{
		if (nav == 'IE')
		{
		newwindow.resizeTo(300,300);
		width=300-(newwindow.document.body.clientWidth - newwindow.document.images[0].width);
		height=300-(newwindow.document.body.clientHeight - newwindow.document.images[0].height);
		newwindow.resizeTo(width,height-15);
		}
		else
		if (nav == 'N')
		{
			newwindow.innerWidth=newwindow.document.images[0].width;
			newwindow.innerHeight=newwindow.document.images[0].height;
		}
		newwindow.moveTo((screen.width - newwindow.document.images[0].width)/2,(screen.height - newwindow.document.images[0].height)/2);
	}
	else if(screen.width < newwindow.document.images[0].width && screen.height > newwindow.document.images[0].height)
	{
		if (nav == 'IE')
		{
		newwindow.resizeTo(300,300);
		width = screen.availWidth;
		height=300-(newwindow.document.body.clientHeight - newwindow.document.images[0].height);
		newwindow.resizeTo(width,height);
		}
		else
		if (nav == 'N')
		{
			newwindow.innerWidth = screen.availWidth;
			newwindow.innerHeight=newwindow.document.images[0].height + 19;
		}
		newwindow.moveTo(0,(screen.height - newwindow.document.images[0].height)/2);
	}
	else if(screen.width > newwindow.document.images[0].width && screen.height < newwindow.document.images[0].height)
	{
		if (nav == 'IE')
		{
		newwindow.resizeTo(300,300);
		width=300-(newwindow.document.body.clientWidth - newwindow.document.images[0].width);
		height = screen.availHeight;
		newwindow.resizeTo(width,height-15);
		}
		else
		if (nav == 'N')
		{
			newwindow.innerWidth=newwindow.document.images[0].width+19;
			newwindow.innerHeight= screen.availHeight;
		}
		newwindow.moveTo((screen.width - newwindow.document.images[0].width)/2, 0);
	}
	else
	{
		newwindow.resizeTo(screen.availWidth, screen.availHeight); newwindow.moveTo(0,0);
	}
	newwindow.focus();
	newwindow.document.close();
	return false;
}
/*
function img(obj,title){
  var titlebody = "height=10,width=10,resizable=1,scrollbars=0";
  newwindow=window.open('','name',titlebody);
  newwindow.document.write('<html><head><meta http-equiv="imagetoolbar" content="no"/><title>' +title +'</title></head><body  onload="window.moveTo((screen.width-document.images[0].width-12)/2,(screen.height-document.images[0].height-51)/2); window.resizeTo(document.images[0].width+12,document.images[0].height+51);" text="#000000" style="background-color:white; margin: 0px; padding: 0px;">');
  newwindow.document.write('<div align="center">');
  if (obj.href){
    newwindow.document.write('<img title="click to close window" onclick="window.close()"  border=0 src="');
    newwindow.document.write(obj.href);
    newwindow.document.write('"');
    newwindow.document.write(' alt="');
    newwindow.document.write(title);
    newwindow.document.write('"');
    newwindow.document.write(' style="cursor:hand;">');
  }else{
    newwindow.document.write('<p>Omlouváme se, ale obrázek nebyl nalezen.</p>');
  }
  newwindow.document.write('</div>');
  newwindow.document.write('</body></HTML>');
  newwindow.focus();
  newwindow.document.close();
  return false;
}
*/

//otevira vrcholy spadajici pod celek na strance Pridej info/foto
function switch_celek(o,uid){ //o... objekt odkazu na ktery se klika, uid ... je uid bez {} celku
  var ul = document.getElementById('c' +uid)
  if (o && ul){
    if (o.className=='plus'){
      o.className='minus';
      ul.className="db";
    }else{
      o.className='plus';
      ul.className="dn";
    }
  }
  return false;
}

//zkontroluje zda je ve formulari zaskrtnuty alespon jeden vrchol
function pridat_foto_info_k_vrcholu_check(chybova_hlaska,chybova_hlaska_text) {
  var f = document.form_1;

  var xml_txt = f.xml_txt;
  if (xml_txt){
    if (xml_txt.value == ''){
      alert(chybova_hlaska_text);
      xml_txt.focus();
      return false;
    }
  }
  var objekt_uids = f.objekt_uids;
  if (objekt_uids){
    for (var i = 0; i < objekt_uids.length; i++) {
      if (objekt_uids[i].checked) return true;
    }
  }
  alert(chybova_hlaska);
  return false;
}