if ($('#produkt').length) 
{
  $("#tab-2").hide();
  $("#tab-3").hide();
  $('#produkt .tabs2 li:first-child').addClass('active');
  
  $('a[href="#tab-1"]').mouseover(function() { 
    $('#produkt .tabs2 li').removeClass('active');
    $(this).parent().addClass('active');
    $('#tab-1').show();
    $('#tab-2').hide();
    $('#tab-3').hide();
    return false;
  });
  $('a[href="#tab-2"]').mouseover(function() { 
    $('#produkt .tabs2 li').removeClass('active');
    $(this).parent().addClass('active');
    $('#tab-1').hide();
    $('#tab-2').show();
    $('#tab-3').hide();
    return false;
  });
  $('a[href="#tab-3"]').mouseover(function() { 
    $('#produkt .tabs2 li').removeClass('active');
    $(this).parent().addClass('active');
    $('#tab-1').hide();
    $('#tab-2').hide();
    $('#tab-3').show();
    return false;
  });
}


$(function () {
    var tabs = [];
    var tabContainers = [];
    $('div.tab').hide();
    $('div.tab:first').show();
    $('ul.tabs a').each(function () 
    {
      // note that this only compares the pathname, not the entire url
      // which actually may be required for a more terse solution.
      tabs.push(this);
      tabContainers.push($(this.hash).get(0));
    });    
    $(tabs).click(function () {
        // hide all tabs
        $(tabContainers).hide().filter(this.hash).show();        
        // set up the selected class
        $(tabs).removeClass('selected');
        $(this).addClass('selected');
        //window.location.replace(this.hash);        
        //window.location.hash = this.hash;
        //window.location = this.hash;
        return false;
    });

    
});
      
  
$('#side_kontakt').hover(
	function () {
		t=setTimeout(function(){
			if ($('#side_kontakt').css('right')=='-210px')
			{
				$('#side_kontakt').animate({
					right: '+=210'
				}, 500, function() {});
			}
		}, 0);
		$.get("/pomoc_stat");
	},
	function () {
		clearTimeout(t);
		if ($('#side_kontakt').css('right')=='0px')
		{
			$('#side_kontakt').animate({
				right: '-=210'
			}, 500, function() {});
		}
	}
);

/* TA Slideshow v.1.0 */
(function($){
  $.fn.ta_slideshow = function() 
  {    
    var settings = {
      'interval' : 5000,
      'speed'    : 'slow'
    };
    
    var id = this;
    var els = id.children();

    var count = id.children().length;
    var current = 0;

    els.hide();
    els.eq(0).show();
    
    setInterval(function(){
    
        next = current + 1 >= count ? 0 : current + 1;

        els.eq(current).fadeOut(settings['speed'])
        els.eq(next).fadeIn(settings['speed']);
        current = current + 1 >= count ? 0 : current + 1;
        
      }, settings['interval']
    );

  };
})(jQuery);
$('#home-news').ta_slideshow();
