jQuery(document).ready(function(){
    yq_externalLinks_init();
    yq_smallImgList_init();
    yq_feedbackHumanControl_init();
    yq_hiddenHolderControl_init();
	
    jQuery("#detailtabs").tabs();
    jQuery(".lightbox").lightbox({fitToScreen: true,
        fileLoadingImage : '/js/lightbox/images/loading.gif',
	fileBottomNavCloseImage : '/js/lightbox/images/close.gif',
        strings : {
            help: ' \u2190 / P - předchozí\u00a0\u00a0\u00a0\u00a0\u2192 / N - další\u00a0\u00a0\u00a0\u00a0ESC / X - zavřít',
            prevLinkTitle: 'předchozí obrázek',                                                                                                     
            nextLinkTitle: 'další obrázek',                                                                                                         
            prevLinkText:  '&laquo;',                                                                                                   
            nextLinkText:  '&raquo;',                                                                                                       
            closeTitle: 'zavřít',                                                                                                   
            image: 'obrázek ',                                                                                                                     
            of: ' z '                                                                                                                           
            }
    });
 
	jQuery(document).ready(function() {
		jQuery('#mycarousel').jcarousel({
		    scroll: 1,
		    auto: 6,
		    wrap: 'last',
		    initCallback: mycarousel_initCallback
		});
	});
});

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function yq_smallImgList_init()
{
    jQuery("#small-img-list").find("img").each(function(i) {
	jQuery(this).hover(
	function(){jQuery(this).addClass('current');},
	function(){jQuery(this).removeClass('current');}
    );
    });
}

function yq_externalLinks_init()
{
	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.onclick=yq_externalLinks_open;
	    anchor.onkeypress=yq_externalLinks_open;
    	}
    }
}
function yq_externalLinks_open( a )
{
	window.open(this.href);
	return false;
}

function yq_feedbackHumanControl_init()
{
	var feedback_hc=document.getElementById('feedback_human_control');

	if( feedback_hc ){
		feedback_hc.value='23';
		feedback_hc.parentNode.style.visibility='hidden';
		feedback_hc.parentNode.style.height='1px';
	}
}
function yq_hiddenHolderControl_init()
{
    jQuery(".hidden-holder").click(function(){
        jQuery(this).toggleClass('visible');
    });
}
