$(document).ready(function(){

   /* cufon */
   Cufon.replace('body not(.ie_6) .formata', { fontFamily: 'formata' });
   Cufon.replace('body not(.ie_7) .formata', { fontFamily: 'formata' });
   Cufon.replace('.formata1', { fontFamily: 'formata' });

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

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

	/* Fancybox Propriétés */
  $("a.fancy").fancybox({ 'overlayShow': true, 'overlayOpacity': 0.70, 'hideOnContentClick': true });
  $("a#fenetre").fancybox({ 'overlayShow': true, 'zoomSpeedOut':0, 'zoomSpeedIn':0, 'overlayOpacity': 0.70, 'hideOnContentClick': true });
  $("a.fancy360").fancybox({ 'overlayShow': true, 'zoomSpeedOut':0, 'zoomSpeedIn':0, 'overlayOpacity': 0.70, 'hideOnContentClick': false, 'frameWidth': 800, 'frameHeight': 600 });

  /* PNG Fix */
  $(document).pngFix();

  $('#header').cycle({
    fx:    'fade',
    speed:  2500,
    timeout:  6500
	});

	/* Gestion affichage menu */
  	$('ul.menuPrincipal li:not({".geoloc", ".actif"}) a.titre').next().hide();
  	$('ul.menuPrincipal li:not({".geoloc",".clickable"}) a.titre').bind("click",function(e) {
		$(this).next().toggle('slow').prev().toggleClass("actif");
		e.preventDefault();
	});

	/* Gestion affichage menu Droite */
  	$('#menuDroiteB ul li:not({".geoloc", ".actif"}) a.titre').next().hide();
  	$('#menuDroiteB ul li:not({".geoloc",".clickable"}) a.titre').bind("click",function(e) {
		$(this).next().toggle('slow').prev().toggleClass("actif");
		e.preventDefault();
	});
	$('#menuDroiteB ul li:not({".geoloc", ".actif"}) a.titre2').next().hide();
  	$('#menuDroiteB ul li:not({".geoloc",".clickable"}) a.titre2').bind("click",function(e) {
		$(this).next().toggle('slow').prev().toggleClass("actif");
		e.preventDefault();
	});

	$('.inputRecherche').bind('click',function(){
		if($(this).val()=='Rechercher sur le site')$(this).val('');
	}).bind("blur",function() {
	  if($(this).val()=='')$(this).val('Rechercher sur le site');
  });

}); /* 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('.','_roll.'));
}

/* Impression des documents */
function imprimer(){
	if(window.print) window.print();
	else alert("Désolé mais votre navigateur ne supporte pas cette fonctionnalité. Pour la plupart des navigateurs, vous pouvez imprimer cette page  en allant dans le menu 'Fichier' > 'Imprimer'");
}

/* Ajouter aux favoris */

function favoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel("le nom du site","http://www.tonsite.com",""); }
else { window.external.AddFavorite("http://www.tonsite.com","le nom du site"); } }
