function headSlide(prev)
{
  headSlide_timeout = window.clearTimeout(headSlide_timeout);
  for(i = 1; i <= 3; i++)
  {
    var cont = $('#headSlide div.slide' + i);
    var imgCount = cont.find('img').length;
	  if (imgCount > 1)
	  {
	    var lastImg = cont.find('img:last');
	    if (prev)
	    {
	      var firstImg = cont.find('img:first');
	      firstImg.insertBefore(lastImg);
	      lastImg.fadeOut(700, function()
		  	{
			    var img = $(this);
	  		  img.insertBefore(img.prev());
		  	  img.css('display', 'block');
			  });
			}
			else
			{
	  	  lastImg.fadeOut(700, function()
		  	{
			    var img = $(this);
			    var cont = img.parent();
	  		  cont.prepend(img);
		  	  img.css('display', 'block');
			  });
			}
		}
	}
	
	headSlide_timeout = window.setTimeout('headSlide()', 5000);
}

function openHeadSlide(id)
{
  var src = $('#headSlide div.slide' + id + ' img:visible:last').attr('src');
  var pos = src.indexOf('&');
  src = src.substring(0, pos) + '&w=800&h=600&zc=2';
  
  $.colorbox({
    photo: true,
	  href: src 
	});
}

var headSlide_timeout = window.setTimeout('headSlide()', 5000);

Loader.load();

$(document).ready(function()
{
  Cufon.replace('#logo h1 a, #logo h2 a',
	{
	  fontFamily: 'Dobra',
	  textShadow: '#4A550B 1px 1px',
	  color: '-linear-gradient(#FFFFFF, #E7E7E7)'
	});
	Cufon.replace('#logo p',
	{
	  fontFamily: 'Dobra',
	  textShadow: '#558A11 1px 1px'
	});
	Cufon.replace('#cont h1, #cont h2, #cont h3',
	{
	  fontFamily: 'Dobra',
	  hover: true
	});
	Cufon.now();
	
  $('a.homePhoto, a.colorbox').colorbox({
		photo: true,
		current: 'Fotografie {current} z {total}',
		previous: 'předchozí',
		next: 'další'
	});
});
