$(document).ready(function() {
  $("div.zoomable img").each(function(){
    var src = $(this).attr("src");
    var ext = src.substr(src.lastIndexOf("."), 4);
    var path = src.substr(0, src.lastIndexOf("_"))
    $(this).wrap('<a href="' + path + ext + '" class="fzoom"></a>');
  });

  // Classe css fzoom
  if ($("a.fzoom").length) {
    $("a.fzoom").fancybox({
      overlayShow: false,
      overlayOpacity: 0.5,
      padding: 0,
      /*zoomOpacity: true,*/
      zoomSpeedIn: 500,
      zoomSpeedOut: 500
    });
  }

  // Slideshow
  if ($("#slideshow").length) {
    $("#slideshow").slideshow({
      width: 762,
      height: 440,
      time: 5000,
      effecttime: 2500,
      title: false,
      panel: false,
      effect: "fade",
      playframe: false
    }).playSlide();
  }
});

