$(document).ready(function(){

	Cufon.replace('.cufon', {
		fontFamily: 'Eurostile T OT',
    hover: true
	});
		
	var o = $("#leftmenu ul:first");
	$('li:first',o).addClass('first');
	$('li ul',o).each( function( i, e) {
		if ( $( e ).parent().hasClass('close') ) {
			$( e ).hide();				
		}			
	});
	
	var sli = 0;
	var slimax = $('.slogan_h').size();
	$('.slogan_h').not(':first').hide();	
	$('.pagination a').eq( 0 ).addClass('active');
	if ($('.slogan_h').eq( 0 ).find('.headconthrefsource').html() == '') {
		$('.headconthref').hide();
	}
	if ($('.slogan_h').eq( 0 ).find('.headcontsrcsource').html() == '') {
		$('#teaser_image').hide();
	}
		
	showSlogan = function() {		
		$('.slogan_h').eq( sli ).fadeOut('slow', function() {
			sli++;
			if (sli >= slimax) sli = 0;
			$('.slogan_h').eq( sli ).fadeIn('slow');			
			$('.pagination a').removeClass('active');
			$('.pagination a').eq( sli ).addClass('active');
			if ($('.slogan_h').eq( sli ).find('.headconthrefsource').html() == '') {
				$('.headconthref').hide();
			} else {
				$('.headconthref').show();
				$('.headconthref').attr('href', $('.slogan_h').eq( sli ).find('.headconthrefsource').html() );
			}
			
			if ($('.slogan_h').eq( sli ).find('.headcontsrcsource').html() == '') {
				$('#teaser_image').fadeOut();
			} else {
				$('#teaser_image').attr('src', $('.slogan_h').eq( sli ).find('.headcontsrcsource').html() );
				$('#teaser_image').fadeIn();
			}
			
			setTimeout( 'showSlogan()', 5000 );
		});				
	};
	
	setTimeout( 'showSlogan()', 3000 );
	$('.lightbox').lightBox({
		txtImage : 'Obrázek',
		txtOf	: 'z',
		overlayBgColor : '#0177BF',
		imageLoading:			'/public/images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
		imageBtnPrev:			'/public/images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
		imageBtnNext:			'/public/images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
		imageBtnClose:			'/public/images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
		imageBlank:				'/public/images/lightbox-blank.gif'
	});
	
});
