$(document).ready(function() {
  // inicializace faceboxu
  $('[rel*=lightbox]').lightBox({fixedNavigation:false});
  // pokud neobsahuje editovatelnou cast, skryji "editacni" tlacitko
  if( $('[name=editable]').length < 1 ) {
    $('#editPage').css('display','none');
  }
})
/*
  funkce skryje, ci zobrazi nejakej objekt, nad kterym je volana
*/
var display = null; // nic neni zobrazeno
var id = null; // nic se nema zobrazovat
function showHide( ) {

  var title = $(this).attr('title');
  id = '#'+title;

  // pokud neni definovan, ci je false
  if( $(id).css('display') == 'none' ) {
  
    if( display != null ) {
      // uz je neco zobrazeno, tak se to zkryje a az pak se zobrazi dalsi
      $(display).fadeOut( "fast", function(){
        $(id).fadeIn( "fast" );
      } );
    } else {
      // nic jeste neni zobrazeno, tak to rovnou zobrazim
      $(id).fadeIn( "slow" );
    }
    
    display = id;
  
  } else {

    // pokud je neco opravdu zobrazeno, tak se to zkryje

    if( display != null ) {
      $(display).fadeOut( "fast" );
      display = null;
    }
  
  }

}


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;
