var lock = false
var slen = 250;
var maxLen = 250;

function countit() {
  if (!lock) {
	lock=true;
	str= document.forms[0].anotace.value;
	strlength= str.length;
	if (strlength > slen) {
	  document.forms[0].cntr1.value="!!!";
	  alert("Dlouhý text!");
	  document.forms[0].anotace.value=str.substring(0,slen);
	} else
	  document.forms[0].cntr1.value = slen - strlength;
	lock=false;
  }
}

function cleantext() {
  document.forms[0].anotace.value="";
  countit();
}

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"; 
 } 
} 

function f(id) {
	var el=document.getElementById(id)
	if (el.style.display=="none") {
		el.style.display="";
	}
	else {
		el.style.display="none";
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  w = window.open('',winName,features);
  w.document.open();
  w.document.writeln('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">');
  w.document.writeln('<html><head><title>Detail</title><style type=\"text/css\">body{margin:0;padding:0}</style></head>');
  w.document.writeln('<body><img src=\"' + theURL + '\" onclick=\"window.close();\" alt=\"\" title=\"Click to close window\" /></body></html>');
  w.document.close();
}
