$(document).ready(function(){

	/* Fancybox Propriétés */
  $("a.fancy").fancybox({
     'zoomOpacity'           : true,
     'zoomSpeedIn'           : 500,
     'zoomSpeedOut'          : 500,
		 'transitionIn'		       : 'fade',
		 'transitionOut'		     : 'fade',     
     'overlayOpacity'        : 0.85,
     'hideOnContentClick'    : false
  });

  /* PNG pour ie 5.5+ */
  $(document).pngFix(); 

  /* Remplacement titre Cufon */
	Cufon.replace('h3');

	/* Comportement Rollover avec class="rollover" */
	$("img.rollover").each(function(){
		attachRollOverEvent(this);
	});
	
	/* Remplacement image actif avec class="actif" */
	$("img.actif").each( function(){
		attachActif(this);
	});	  

  
}); /* fin doc ready */


/* ======== Fonctions ========================================================================== */ 
/* Comportement Rollover avec class="rollover" */
attachRollOverEvent = function(imageId){
	$(imageId).mouseover( function(){ $(this).attr("src", $(this).attr("src").replace('.','_roll.')) } );
	$(imageId).mouseout( function(){ $(this).attr("src", $(this).attr("src").replace('_roll','')) } );
}

/* Change image pour les "actif" */
attachActif = function(imageId){
	$(imageId).attr("src", $(imageId).attr("src").replace('.','_actif.'));
}

/* Recommander le site a un ami */
url = window.location;
titre = document.title;
sujet = "Je pense que ce site web peut vous intéresser";
function recommander(){ 
  window.location = "mailto:"+prompt('Entrez l\'adresse email de la personne a qui vous désirez recommander ce site','')+"?subject="+sujet+"&body="+titre+" : "+url;
} 

/* Imprime la page */
function impression(str) {
	window.print();
}

/* Ajouter aux favoris */ 
function favoris() {
    if ((navigator.appName.indexOf("Microsoft",0)>=0) && (parseInt(navigator.appVersion)>=4)) {
        window.external.AddFavorite("http://www.lemoulindethuboeuf.com/","Moulin Thuboeuf" );
    } else {
        alert("La fonction \"Ajouter aux favoris\" n'est proposée que par Internet Explorer 4 et versions supérieures")
    }
}

/* Appel de la fancy via flash (parc auto) */
function  callFancy(my_href) {
  var j1 = document.getElementById("liencache");
  j1.href = my_href;
  $('#liencache').trigger('click');
}



