$(window).load(function(){

  /* cufon */
	Cufon.replace('.round', { fontFamily: 'round' });
	Cufon.replace('h2.contenu', { fontFamily: 'round' });
	Cufon.replace('h3.medias', { fontFamily: 'round' });

	/* 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#pub").fancybox({ 'overlayShow': true, 'overlayOpacity': 0.70, 'hideOnContentClick': true, 'frameWidth':250, 'frameHeight':250 });
  $("a#actuFancy").fancybox({ 'overlayShow': true, 'overlayOpacity': 0.70, 'hideOnContentClick': true, 'frameWidth':650, 'frameHeight':500 });

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

	/* Tableau 1 sur 2 */
	$("#body table tr:even").addClass("even");
	$("#body table tr:odd").addClass("odd");

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

	/* Tithome */
 $('#defileTithome').cycle({
    fx:    'fade',
    speed:  2500,
    timeout:  6500
	});

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

	$(".actuPageV,.actuPageB").equalHeights();




}); /* 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"); } }

function ecrire_cookie(nom, valeur, expires) {
  document.cookie=nom+"="+escape(valeur)+
  ((expires==null) ? "" : ("; expires="+expires.toGMTString()));
}

function lire_cookie(nom) {
        deb = document.cookie.indexOf(nom + "=")
        if (deb >= 0) {
            deb += nom.length + 1
            fin = document.cookie.indexOf(";",deb)
            if (fin < 0) fin = document.cookie.length
            return unescape(document.cookie.substring(deb,fin))
            }
        return ""
        }


