function sneca() {
	
	metos_setMenuDyn();
	initDefil();
		
	// affiche maison accueil over logo
	$('#maison').hide();
	$('#logo').hover(
		function() {
			$('#maison').show();
		},
		function() {
			$('#maison').hide();
		}
	);
	
	// sommaire : article supp
	$('#affiche_article_supp').click(
		function() {
			$('#article_supp').slideDown(2000);
			$('#affiche_article_supp').hide();
		}
	);
	$('#affiche_article_supp2').click(
		function() {
			$('#article_supp2').slideDown(2000);
			$('#affiche_article_supp2').hide();
		}
	);
	
	$('#aff_popu_30jours').click(
		function() {
			$('#hitparade_debut').hide();
			$('#hitparade_30jours').show();
			$('#aff_popu_30jours').attr('class','onglet_option_on');
			$('#aff_popu_debut').attr('class','onglet_option');
			return false; // nav jump pas
		}
	);
	$('#aff_popu_debut').click(
		function() {
			$('#hitparade_30jours').hide();
			$('#hitparade_debut').show();
			$('#aff_popu_debut').attr('class','onglet_option_on');
			$('#aff_popu_30jours').attr('class','onglet_option');
			return false; // nav jump pas
		}
	);
	
	// active mode exo_admin en montrant les options
	$('#exo_admin_on').click(
		function() {
			$('.exo_admin').show();
			$('#exo_admin_on').removeClass('exo_lien_actif').addClass('exo_lien_inactif');
			$('#exo_admin_off').removeClass('exo_lien_inactif').addClass('exo_lien_actif');
		}
	);
	
	// désactive mode exo_admin en cachant les options
	$('#exo_admin_off').click(
		function() {
			$('.exo_admin').hide();
			$('#exo_admin_info').hide(); // cache le bloc info au cas où
			$('#exo_admin_off').removeClass('exo_lien_actif').addClass('exo_lien_inactif');
			$('#exo_admin_on').removeClass('exo_lien_inactif').addClass('exo_lien_actif');
		}
	);
	
	$('.exo_admin').click(
		function() {
			$('#exo_admin_info_text').html($(this).attr('rel'));
			$('#exo_admin_info_link').attr('href', $(this).attr('href'));
			centerPopup($('#exo_admin_info'));		
			$('#exo_admin_info').show();
			return false;
		}
	);
	
	$('#exo_admin_close').click(
		function() {
			$('#exo_admin_info').hide();
		}
	);

}

//centering popup  
function centerPopup(q){  
	//request data for centering  
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = q.height();  
	var popupWidth = q.width();  
	//centering
	q.css({
	"top": windowHeight/2-popupHeight/2,  
	"left": windowWidth/2-popupWidth/2  
	});
}  

function metos_setMenuDyn() {
		
		metos_menuToggled = 0; // rubrique ouverte
		metos_toggleEnCours = false; // traitement en cours
		metos_toggleTiming = 500;
		
		// liens secteurs
		$("#menugauche a.js_a_menuracine").click(function() {
			// empêcher 2 traitements a la fois
			if (metos_toggleEnCours) return false;
			// traitement toggle
			metos_toggleEnCours = true;
			var id_r = $(this).attr('rel');
			
			var metos_menuClicked = $("#m_r_"+id_r); // just cliqued			
			
			if (metos_menuToggled != 0) { // il y a en un d'ouvert
		
				if ( metos_menuToggled.attr("id") == metos_menuClicked.attr("id") ) { // clicked est celui deja ouvert
					metos_menuClicked.animate({ // on le ferme
						height: 'toggle'
					}, metos_toggleTiming);
					metos_menuToggled = 0; // tous sont fermes
				} else { // un est ouvert, on le ferme et en ouvre un autre
					metos_menuToggled.animate({
						height: 'toggle'
					}, metos_toggleTiming);
					metos_menuClicked.animate({
						height: 'toggle'
					}, metos_toggleTiming);
					metos_menuToggled = metos_menuClicked;
				}
			}
			else {
				metos_menuClicked.animate({ // ouvre le clicked
					height: 'toggle'
				}, metos_toggleTiming);
				metos_menuToggled = metos_menuClicked;
			}
		
			setTimeout("metos_toggleEnCours = false;", metos_toggleTiming); // libere
			
			return false; // annule le lien
			
		});
		
	} // function metos_MenuDyn

	
function defil() {	
	marginLeft_actu = parseInt( $('#defil').css('marginLeft') );
	marginLeft_new = marginLeft_actu - 1;
	if (marginLeft_new < -730) {
		marginLeft_new = 0;
		$('#defil').css('marginLeft', marginLeft_new+"px");
		setTimeout("defil();", 5000);
	} else {
		$('#defil').css('marginLeft', marginLeft_new+"px");
		setTimeout("defil();", 15);
	}
}

function initDefil() {
	if ($('#defil')) {
		$('#defil').css('marginLeft', '0px');
		setTimeout("defil();", 4000);
	}
}

// image preload
// use : jQuery.preLoadImages("image1.gif", "/path/to/image2.png");
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)
