var $j = jQuery.noConflict();
$j().ready(function() {
  $j('a.lightbox-youtube').fancybox( { 
  'type' : 'iframe', 
  'autoScale' : false, 
'titlePosition': 'inside', 
'titleFormat' : function() { 
 return '<span id="fancybox-title-inside">'+this.title+'&nbsp;</span>';  
} ,
  'onStart' : function(selectedArray, selectedIndex, selectedOpts) 
{ selectedOpts.href = selectedArray[selectedIndex].href.replace(new 
RegExp('youtu.be', 'i'), 'www.youtube.com/embed').replace(new 
RegExp('watch\\?v=([a-z0-9]+)(&|\\?)?(.*)', 'i'), 'embed/$1?$3') } 
  } ); 
$j("a.lightbox").fancybox({
'titlePosition': 'inside', 
'titleFormat' : function() { 
 return '<span id="fancybox-title-inside">'+this.title+'&nbsp;</span>';  
} 
});
$j("a.lightbox-iframe").fancybox({
			'autoScale'		: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'			: 'iframe',
			'titlePosition': 'inside', 
			'titleFormat' : function() { 
 return '<span id="fancybox-title-inside">'+this.title+'&nbsp;</span>';  
} 
});
  $j(".linklist").css({'cursor':'pointer'});
  $j(".image-view").css({'opacity':'0','display':'block'});
  $j('a').hover(
    function() {
      $j(this).find('.image-view').fadeTo(300, .85);
    },
    function() {
       $j(this).find('.image-view').fadeTo(300, 0.00);
    }
  );
   $j(window).load(function () {
               $j("#example_6_content,#example_7_frame,.example_7_item").fadeIn('slow');
   });
   
   $j(function () {
        $j('.bubbleInfo').each(function () {
            var distance = 10;
            var time = 250;
            var hideDelay = 500;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $j('.linklist', this);
            var info = $j('.popup', this).css('opacity', 0);


            $j([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;

                    info.css({
                        top: 44,
                        left: 205,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '+=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });
    });

});
jQuery(function($) {
    $j(".refresh-button").click(function(){
        $$ = $j(".random-facts li");
        $$.fadeOut('slow').eq(Math.floor(Math.random() * $$.length)).delay('slow').fadeIn('slow');
    }).click();
});

