$(document).ready(function(){

//  Cufon.replace('#nav',{ hover: true });
  Cufon.replace('#main_page h2, #main_page h3');
  Cufon.replace('#main_page a:not(.nocfn)');

  Galleria.loadTheme('/js/galleria.classic.min.js');
  // Initialize Galleria
  $('#galleria').galleria();

  $(".scrollable").scrollable();
  
  $('#picture_slider img').mouseover(function(){
    var $width=$(this).attr('width');
    var $heigh=$(this).attr('height');
//    $(this).attr('height',$height*2);
//    $(this).attr('width',$width*2);
  });
  
  $('#video_slider').tinycarousel({
    start: 0,
    display: 5,
    interval: false,
    rewind: true
  });

  $('#albumok_side').tinycarousel({
    axis: 'y',
    start: 0,
    display: 2,
    interval: false,
    rewind: true
  });

  $('#video_slider .overview li').click(function(){
    $('#youtube_video').html( $(this).children('.hidden_info').html());
  });


  $('.fancybox_link').fancybox({
    titlePosition : 'over', // 'float', 'outside', 'inside' or 'over'
		changeSpeed : 500,
		changeFade : '500'
  });
  
});


$('.has_event').each(function(){
  var $id = $(this).attr('rel');
  $(this).tooltip({
    tip: '#tip_'+$id,
    position: 'center left'
  }).dynamic();
});


//(function($){
//    $.extend({
//        jYoutube: function( url, size ){
//            if(url === null){ return ""; }

//            size = (size === null) ? "big" : size;
//            var vid;
//            var results;

//            results = url.match("[\\?&]v=([^&#]*)");

//            vid = ( results === null ) ? url : results[1];

//            if(size == "small"){
//                return "http://img.youtube.com/vi/"+vid+"/2.jpg";
//            }else {
//                return "http://img.youtube.com/vi/"+vid+"/0.jpg";
//            }
//        }
//    });
//})(jQuery);

