$(document).ready(function() {
  //$(function() {
    $('.fotogalerie a').lightBox({fixedNavigation:true});
    $('a.lightbox').lightBox();
    $('a.thickbox').lightBox();
    //$('.tool').ToolTip(); // inicializace tooltipu
    /*$('.tool').tooltip({// inicializace tooltipu
      relative: false,
  
  		// use div.tooltip as our tooltip
  		tip: '.tooltip',
  
  		// use the fade effect instead of the default
  		effect: 'fade',
  
  		// make fadeOutSpeed similar to the browser's default
  		fadeOutSpeed: 100,
  
  		// the time before the tooltip is shown
  		predelay: 0,
  
  		// tweak the position
  		position: "top left",
  		offset: [-150, -120]
  	});*/
    
    

  $('.tooltip-whole').each(function () {
    // options
    var distance = 0;
    var time = 0;
    var hideDelay = 0;

    var hideDelayTimer = null;

    // tracker
    var beingShown = false;
    var shown = false;
    
    var trigger = $('.trigger', this);
    var popup = $('.tooltip', this).css('opacity', 0);

    // set the mouseover and mouseout on both element
    $([trigger.get(0), popup.get(0)]).mouseover(function () {
      // stops the hide event if we move from the trigger to the popup element
      if (hideDelayTimer) clearTimeout(hideDelayTimer);

      // don't trigger the animation again if we're being shown, or already visible
      if (beingShown || shown) {
        return;
      } else {
        beingShown = true;

        // reset position of popup box
        popup.css({
          top: -200,
          left: 50,
          display: 'block' // brings the popup back in to view
        })

        // (we're using chaining on the popup) now animate it's opacity and position
        .animate({
          top: '-=' + distance + 'px',
          opacity: 1
        }, time, 'swing', function() {
          // once the animation is complete, set the tracker variables
          beingShown = false;
          shown = true;
        });
      }
    }).mouseout(function () {
      // reset the timer if we get fired again - avoids double animations
      if (hideDelayTimer) clearTimeout(hideDelayTimer);
      
      // store the timer so that it can be cleared in the mouseover if required
      hideDelayTimer = setTimeout(function () {
        hideDelayTimer = null;
        popup.animate({
          top: '-=' + distance + 'px',
          opacity: 0
        }, time, 'swing', function () {
          // once the animate is complete, set the tracker variables
          shown = false;
          // hide the popup entirely after the effect (opacity alone doesn't do the job)
          popup.css('display', 'none');
        });
      }, hideDelay);
    });
  }); // konec funkce pro zobrazeni nahledu detailu (tooltip)
    
});

  // tisk dle ID
  function printIt(target) { 
   winId=window.open('','printwin','width=580,height=430'); 
   winId.document.write(target); 
   winId.document.close(); 
   winId.focus(); 
   if (window.print) winId.print(); 
  }

  // zobrazí/skryje dle id
  function showblock(id, stav) {
    var show = (!stav) ? 'none' : 'block';
    document.getElementById(id).style.display = show;
  }

/*
  
  // tooltip vyskakovaci, hlavne u zbozi nahled
  jQuery.fn.ToolTip = function() {
    $(this).hover(function() {
      var tooltip = $(this).parent('.tooltip-whole').find('.tooltip');
      //tooltip.fadeIn('fast');
      tooltip.css('display', 'block');      
    });
    $(this).mouseleave(function() {
      var tooltip = $(this).parent('.tooltip-whole').find('.tooltip');
      //tooltip.fadeOut('fast');
      $('.tooltip').hover(
        function () {
        }, 
        function () {
          tooltip.css('display', 'none');
        }
      );
      //tooltip.css('display', 'none');
    });
  };
  
  
  
//Inline HTML Tooltip script: By JavaScript Kit: http://www.javascriptkit.com
//Created: July 10th, 08'
var htmltooltip={
	tipclass: 'htmltooltip',
	fadeeffect: [true, 500],
	anchors: [],
	tooltips: [], //array to contain references to all tooltip DIVs on the page

	positiontip:function($, tipindex, e){
		var anchor=this.anchors[tipindex]
		var tooltip=this.tooltips[tipindex]
		var scrollLeft=window.pageXOffset? window.pageXOffset : this.iebody.scrollLeft
		var scrollTop=window.pageYOffset? window.pageYOffset : this.iebody.scrollTop
		var docwidth=(window.innerWidth)? window.innerWidth-15 : htmltooltip.iebody.clientWidth-15
		var docheight=(window.innerHeight)? window.innerHeight-18 : htmltooltip.iebody.clientHeight-15
		var tipx=anchor.dimensions.offsetx+100
		var tipy=anchor.dimensions.offsety+anchor.dimensions.h-100
		tipx=(tipx+tooltip.dimensions.w-scrollLeft>docwidth)? tipx-tooltip.dimensions.w : tipx //account for right edge
		tipy=(tipy+tooltip.dimensions.h-scrollTop>docheight)? tipy-tooltip.dimensions.h-anchor.dimensions.h : tipy //account for bottom edge
		$(tooltip).css({left: tipx, top: tipy})
	},

	showtip:function($, tipindex, e){
		var tooltip=this.tooltips[tipindex]
		if (this.fadeeffect[0])
			$(tooltip).hide().fadeIn(this.fadeeffect[1])
		else
			$(tooltip).show()
	},

	hidetip:function($, tipindex, e){
		var tooltip=this.tooltips[tipindex]
		if (this.fadeeffect[0])
			$(tooltip).fadeOut(this.fadeeffect[1])
		else
			$(tooltip).hide()	
	},

	updateanchordimensions:function($){
		var $anchors=$('*[rel="'+htmltooltip.tipclass+'"]')
		$anchors.each(function(index){
			this.dimensions={w:this.offsetWidth, h:this.offsetHeight, offsetx:$(this).offset().left, offsety:$(this).offset().top}
		})
	},

	render:function(){
		jQuery(document).ready(function($){
			htmltooltip.iebody=(document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
			var $anchors=$('*[rel="'+htmltooltip.tipclass+'"]')
			var $tooltips=$('div.'+htmltooltip.tipclass+'')
			$anchors.each(function(index){ //find all links with "title=htmltooltip" declaration
				this.dimensions={w:this.offsetWidth, h:this.offsetHeight, offsetx:$(this).offset().left, offsety:$(this).offset().top} //store anchor dimensions
				this.tippos=index+' pos' //store index of corresponding tooltip
				var tooltip=$tooltips.eq(index).get(0) //ref corresponding tooltip
				if (tooltip==null) //if no corresponding tooltip found
					return //exist
				tooltip.dimensions={w:tooltip.offsetWidth, h:tooltip.offsetHeight}
				$(tooltip).remove().appendTo('body') //add tooltip to end of BODY for easier positioning
				htmltooltip.tooltips.push(tooltip) //store reference to each tooltip
				htmltooltip.anchors.push(this) //store reference to each anchor
				var $anchor=$(this)
				$anchor.hover(
					function(e){ //onMouseover element
						htmltooltip.positiontip($, parseInt(this.tippos), e)
						htmltooltip.showtip($, parseInt(this.tippos), e)
					},
					function(e){ //onMouseout element
						htmltooltip.hidetip($, parseInt(this.tippos), e)
					}
				)
				$(window).bind("resize", function(){htmltooltip.updateanchordimensions($)})
			})
		})
	}
}

htmltooltip.render()
*/

