$.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";
    }
  }
});


$(document).ready(function() {
    $("a.jdkImageUrl, a.lightbox, , a[href$='jpg'], a[href$='gif'], a[href$='jpeg'], a[href$='png'] ").fancybox({
        'transitionIn'  :   'elastic',
        'transitionOut' :   'elastic',
        'speedIn'       :   600,
        'speedOut'      :   200,
        'overlayShow'   :   true,
        'hideOnOverlayClick' : true,
        'hideOnContentClick' : true
    });
    
    $(".playVideo").click(function() {
      
      $.fancybox({
        'padding'		: 0,
        'autoScale'		: false,
              'speedIn'       : 600,
              'speedOut'      : 200,
        'title'			: this.title,
        'width'		    : 680,
        'height'		: 495,
        'href'			: this.href,
        'type'			: 'iframe'
      });

    return false;
    });
    
    
    var img = $.jYoutube('wW6RcsN-MLs');
    $('#vidImg').attr('src', img);
    
    
});




