function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 } 
}
window.onload = externalLinks;

function test(what)
{
	return confirm(what);
}

function openwin(url,name,width,height) 
{
	window.open(url,name,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,width="+width+",height="+height);
}

// tato funkce zaskrtne vsechna pole
	function checkall() {
	  cur = document.formular
        for (i = 0; i < cur.length; i++) {
          var el = cur.elements[i];
          if (el.type == "checkbox") {
            el.checked = true;
          }
        }
    }

  // tato funkce zrusi zaskrtnuti vsech poli
    function uncheckall() {
        cur = document.formular
        for (i = 0; i < cur.length; i++) {
          var el = cur.elements[i];
          if (el.type == "checkbox") {
            el.checked = false;
          }
        }
    }
    
function zkontroluj_registraci(theForm){
  if (theForm.jmeno.value == "" || theForm.jmeno.value.length < 2){
		alert("Prosím zadejte jméno.");
		theForm.jmeno.focus();
		return false;
	}
	if (theForm.prijmeni.value == "" || theForm.prijmeni.value.length < 2){
		alert("Prosím zadejte příjmení.");
		theForm.prijmeni.focus();
		return false;
	}
	if (theForm.email.value == "" || theForm.email.value.indexOf('@',1)== -1 || theForm.email.value.indexOf('.',2)==-1){
		alert("Prosím zadejte emailovou adresu.");
		theForm.email.focus();
		return false;
	}
	if (theForm.heslo1.value == ""){
		alert("Zadejte prosím heslo.");
		theForm.heslo1.focus();
		return false;
	}
	if (theForm.heslo2.value == ""){
		alert("Zadejte prosím heslo.");
		theForm.heslo2.focus();
		return false;
	}
	if (theForm.heslo1.value != theForm.heslo2.value){
		alert("Hesla se neshodují, zadejte je prosím znovu.");
		theForm.heslo1.value = "";
		theForm.heslo2.value = "";
		theForm.heslo1.focus();
		return false;
	}
return true;
}
	
function zkontroluj_dotaz(theForm){
  if (theForm.jmeno.value == "" || theForm.jmeno.value.length < 5){
		alert("Prosím zadejte jméno a příjmení.");
		theForm.jmeno.focus();
		return false;
	}
	if (theForm.email.value == "" || theForm.email.value.indexOf('@',1)== -1 || theForm.email.value.indexOf('.',2)==-1){
		alert("Prosím zadejte emailovou adresu.");
		theForm.email.focus();
		return false;
	}
	if (theForm.telefon.value == "" || theForm.telefon.value.length < 5){
		alert("Prosím zadejte telefon.");
		theForm.telefon.focus();
		return false;
	}
	if (theForm.dotaz.value == "" || theForm.dotaz.value.length < 5){
		alert("Prosím zadejte dotaz.");
		theForm.dotaz.focus();
		return false;
	}

return true;
}

function zkontroluj_diskusi(theForm)
{
  if (theForm.jmeno.value == "" || theForm.jmeno.value.length < 2){
	  alert("Prosím zadejte jméno.");
	  theForm.jmeno.focus();
	  return false;
  }
	if (theForm.email.value == "" || theForm.email.value.indexOf('@',1)== -1 || theForm.email.value.indexOf('.',2)==-1){
	  alert("Prosím zadejte emailovou adresu.");
	  theForm.email.focus();
	  return false;
  }
  if (theForm.predmet.value == "" || theForm.predmet.value.length < 2){
	  alert("Prosím zadejte předmět.");
	  theForm.predmet.focus();
	  return false;
  }
  if (theForm.text.value == "" || theForm.text.value.length < 2){
	  alert("Prosím zadejte text příspěvku.");
	  theForm.text.focus();
	  return false;
  }
  if (theForm.kontrola_kodu.value == "" || theForm.kontrola_kodu.value.length < 5){
	  alert("Prosím zadejte kontrolní kod.");
	  theForm.kontrola_kodu.focus();
	  return false;
  }
  return true;
}


function show(object) {
	if (document.getElementById && document.getElementById(object) != null)
	node = document.getElementById(object).style.display='inline';
	else if (document.layers && document.layers[object] != null)
	document.layers[object].display = 'inline';
	else if (document.all)
	document.all[object].style.display = 'inline';
}

function hide(object) {
	if (document.getElementById && document.getElementById(object) != null)
	node = document.getElementById(object).style.display='none';
	else if (document.layers && document.layers[object] != null)
	document.layers[object].display = 'none';
	else if (document.all)
	document.all[object].style.display = 'none';
}

function change_background(where, color) {
	var obj = document.getElementById(where);
	obj.style.background = color;
}	

	
function change_pic(url, where, text) {
	var img = document.getElementById(where);
	img.src = url;
	img.title = text;
	img.alt = text;
	
}	

function empty_pic(where, picture) {
	var img = document.getElementById(where);
	img.src = picture;
}	

function add_text(where, text) {
	var node = document.getElementById(where);
	node = text;
}	
