// funkce otevření nového okna podle velikosti obrázku
function ObrOkno(x,y,title,obr)
{
  win_size_x=x; //horizontální velikost okna
  win_size_y=y; //vertikální velikost okna
  win_pos_x=(screen.width-win_size_x)/2; //horizontální pozice okna
  win_pos_y=(screen.height-win_size_y)/2; //vertikální pozice okna
  setup='width='+win_size_x+',height='+win_size_y+',top='+win_pos_y+',left='+ win_pos_x+',scrollbars=no,resizable=no,status=no';
  pop = window.open ("","nove",setup);
  pop.document.write('<head>');
  pop.document.write('<Title>');
  pop.document.write(title);
  pop.document.write('</Title>');
  pop.document.write('</head>');
  pop.document.write('<body topmargin="0" leftmargin="0">');
  pop.document.write('<a href="javascript:window.close();"><img src='+obr+' border=0 alt="Kliknutím zavři obrázek" title="Kliknutím zavři obrázek"></a>');
  pop.document.write('</body>');
};

function CentrOkno(x,y,link)
{
  win_size_x=x; //horizontální velikost okna
  win_size_y=y; //vertikální velikost okna
  win_pos_x=(screen.width-win_size_x)/2; //horizontální pozice okna
  win_pos_y=(screen.height-win_size_y)/2; //vertikální pozice okna
  setup='width='+win_size_x+',height='+win_size_y+',top='+win_pos_y+',left='+ win_pos_x+',scrollbars=yes,resizable=yes';
  window.open (link,"okno",setup);
};

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
};

function vytisknoutstranku(popisek)
{
	document.write('<a title="' + popisek + '" href="#" onclick="window.print();return false;">' + popisek + '</a>'); 
};

function confirm_delete($url,$text) {
	var return_value = confirm($text) ;
	if ( return_value == true ) {
		window.location = $url;
	}
};

function SkryjMailPredRoboty() {
  // Použití: 
  // <img src="images/nic.gif" width="1" height="1" onload="SkryjMailPredRoboty();">
  // <span class="hidemail">d.danielcak at bikevary dot cz</span>
  if (!document.getElementsByTagName && !document.createElement &&
    !document.createTextNode) return;
  var nodes = document.getElementsByTagName("span");
  for(var i=nodes.length-1;i>=0;i--) {
    if (nodes[i].className=="hidemail") {
      var at = /at/;
      var dot = /dot/g;
      var address = nodes[i].firstChild.nodeValue.split(" ").join("");
      var node = document.createElement("a");

      address = address.replace(at, "@");
      address = address.replace(dot, ".");
      node.setAttribute("href", "mailto:"+address);
      node.appendChild(document.createTextNode(address));

      var parent = nodes[i].parentNode;
      for(var j=0;j<parent.childNodes.length;j++)
        if (parent.childNodes[j] == nodes[i]) {
          if (!parent.replaceChild) return;
          parent.replaceChild(node, parent.childNodes[j]);
          break;
        }
    }
  }
};

function Ukaz(co)
{
	//co.style.visibility="visible";
	co.style.display="";
};

function Skryj(co)
{
	//co.style.visibility="hidden";
	co.style.display="none";
};

function zobrazSkryj(idecko){
  el=document.getElementById(idecko).style;
  el.display=(el.display == 'block')?'none':'block';
};

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

