
$(document).ready(function(){
//Prehazuje obrazek u souboru na pravo
    $("a[href$='.pdf']").css({ 
      'background-position' : 'right top',
      'padding' : '0px 23px 4px 0px'
    });

    $("p a.external").addClass("popup");



    $('.lightbox').lightBox({
       fixedNavigation:true,
       imageLoading: 'http://www.web360.cz/js/lightbox-jquery/images/lightbox-ico-loading2.gif',
       imageBtnClose: 'http://www.web360.cz/js/lightbox-jquery/images/lightbox-btn-close.gif',
       imageBtnPrev: 'http://www.web360.cz/js/lightbox-jquery/images/lightbox-btn-prev.gif',
       imageBtnNext: 'http://www.web360.cz/js/lightbox-jquery/images/lightbox-btn-next.gif',
       overlayBgColor: '#EBEBEB',
       overlayOpacity: 0.9
    });

	$("div.video a").append("<span></span>"); // overlays the image with png play image

   if((pos = window.location.href.search(/\#lightbox-/)) >= 0)
		{
 			anchor = window.location.href.substring(pos + 10);
			setTimeout(function() {
				$("div.video a[rel=#"+anchor+"]:first").click();
			}, 20);
			//alert(anchor);
		} else {
//			alert('jupi neni tam');
		}


});

$(function() {

    /**
     *  kontrola noveho flashe
     *  pokud je verze flashe vetsi nez 9.115 prehraje se soubor mp4
     */
    if(flashembed.isSupported([9, 115])){
        $('a.player').each(function(i,el){
            var $a = $(el);
            $a.attr('href', $a.attr('href').replace('.flv', '.mp4'));
        });
    }

	// setup overlay actions to buttons
	$("a[rel]").overlay({

		// use the Apple effect for overlay
		effect: 'apple',

		expose: '#789',

		mask: {
			color: '#ffffff',
			loadSpeed: 200,
			opacity: 0.8
		},

		onLoad: function(content) {
			// find the player contained inside this overlay and load it
			this.getOverlay().find("a.player").flowplayer(0).load();
		},

		onClose: function(content) {
			$f().unload();
		},
		onError: function(errorCode, errorMessage) {
		  alert('error: ' + errorCode + ' : ' + errorMessage);
	   }
	});

	// install flowplayers
 	$("a.player").flowplayer("http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf");

});


