var diaporama_timeout;

var diaporama_time=2000;

// function stop_diaporama () {
//   clearTimeout(diaporama_timeout);
// }
// 
// function play_diaporama () {
//   diaporama_timeout=setTimeout('changeImage("next")',diaporama_time);
// }

function changeImage (slideshow_name) {
  
  actual=$(slideshow_name+' .slide.active');
  
  
    next=actual.next();
    if (next.size()==0) {
      next=$(actual.siblings().get(0));
    }

  if ($(slideshow_name+' .slide').size()>1) {
    actual.removeClass("active").fadeOut();
    next.addClass("active").fadeIn();

    diaporama_timeout=setTimeout('changeImage("'+slideshow_name+'")',4000);
  };
}

$(document).ready(function(){
  

 $('a.fancybox').fancybox({'frameWidth':400,'frameHeight':550,'hideOnContentClick':false});
 
 $('.slideshow').css("height","370px");
 $('.slideshow2').css("height","82px");
 $('.slide').css("position","absolute");
 // $('.slide:not(.active)').addClass("hide");
 
 // $('.place').hover(function() {
 //   place_name=$(this).attr("class").split(" ")[0];
 //   stop_diaporama();
 //   changeImage(place_name);
 //   stop_diaporama();
 //   $('.'+place_name).addClass("current");
 //   $('.place.to_hide:not(.current)').addClass("hide");
 // }, function() {
 //   $('.place:not(.current)').removeClass("hide");
 //   $('.current').removeClass("current");
 //   play_diaporama();
 // }); 

  diaporama_timeout=setTimeout('changeImage(".slideshow2")',diaporama_time);
  diaporama_timeout=setTimeout('changeImage(".slideshow")',diaporama_time);
});

