
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 (place_name) {
  
  actual=$('.slide.active');
  next=$('.slide.'+place_name);
  
  
  if (place_name=="next") {
    next=actual.next();
    if (next.size()==0) {
      next=$(actual.siblings().get(0));
    }
  }


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


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


$(document).ready(function(){
  

 
 $('a.fancybox').fancybox();


 $('.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("next")',diaporama_time);




  
  if ($('textarea.tiny_mce').size()>0) {
  	$('textarea.tiny_mce').tinymce({
			script_url : '/javascripts/tinymce/jscripts/tiny_mce/tiny_mce.js',

			// General options
			theme : "advanced",
			plugins : "style,paste",
      // paste_preprocess:"",

			// Theme options
			theme_advanced_buttons1 : "bold,undo,redo,|,preview|,link,unlink",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			theme_advanced_buttons4 : "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "center",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,
      theme_advanced_styles : "",
			// Example content CSS (should be your site CSS)
			content_css : "/stylesheets/tiny_mce.css"

			// Drop lists for link/image/media/template dialogs
		});
};


});











