
		function extractUrlParams(){
			var t = location.search.substring(1).split('&');
			var f = [];
			for (var i=0; i < t.length; i++){
				var x = t[ i ].split('=');
				f[x[0]]=x[1];
				}
			return f;
			}

		$(document).ready(function () {

			// Moteur de recherche interne
			// ---------------------------
			
			$('#recherche').focus(function () {
				if ( $('#recherche').val() == 'Rechercher...' )
					$('#recherche').val('');
		    });
		    
			$('#recherche').blur(function () {
				if (  $('#recherche').val() == '')
					$('#recherche').val('Rechercher...');
		    });

			// Préchargement image
			// -------------------

			var cacheImageBlog = new Image();
			cacheImageBlog.src = "/_images/communs/blog-on.png";

			var cacheImageBlog = new Image();
			cacheImageBlog.src = "/_images/accueil/sinistres-on.png";

			// Initialisation onglets s'il y a un jeu d'onglets
			// ------------------------------------------------

			$(function() {
				$(".agpmOnglets").tabs({
					select: function(event, ui) {
					var url = $.data(ui.tab, 'load.tabs');
					if( url ) {
						location.href = url;
						return false;
						}
					return true;
					}
				});
					
        var paramUrl = extractUrlParams();
        var idTabs = paramUrl["idTabs"];
        if(idTabs > 0 )
            $(".agpmOnglets").tabs( "select" ,  parseInt(idTabs));

				});

			// Initialisation calendrier sur champs date
			// ------------------------------------------

			$(function() {
				$(".agpmCalendrier").datepicker($.datepicker.regional['fr']);
				});

			// click n'deroulz
			// ----------------

			// Cache tous les blocs infos
			$('.agpmBlocInfo').hide();

			// Affiche ou cache le bloc info correspondant
			$('.agpmAfficheBlocInfo').css("cursor","pointer").live('click', function() {
				$(this).next('.agpmBlocInfo').slideToggle('slow');
				});

			// Alternance couleur lignes des tableaux
			// --------------------------------------
			$(".agpmTableau.alterne tr:even").addClass("alt");

			// -------------------------
			//
			// Debug - uniquement en DEV
			//
			// --------------------------

			// Bouton reinitalisation des donnees en cache 
			// --------------------------------------------
			$('#agpmSuppressionCache').click(function(){

				// Msg chargement
				$("#agpmOutilsDevMessage").html("Vidage cache en cours ..."); 
				
				// Ajax
				var html = $.ajax({
					url: "/communs/ajax/viderCacheServeur.php",
					async: false
					}).responseText;

				$("#agpmOutilsDevMessage").html(html); 
				
				});
				
			// Bouton reinitalisation des donnees en session 
			// --------------------------------------------
			$('#agpmSuppressionSession').click(function(){

				// Msg chargement
				$("#agpmOutilsDevMessage").html("Vidage session en cours ..."); 
				
				// Ajax
				var html = $.ajax({
					url: "/communs/ajax/viderSession.php",
					async: false
					}).responseText;

				$("#agpmOutilsDevMessage").html(html); 
				
				});
			

			// Bouton affichage des donnees en session
			// ---------------------------------------
			$('#agpmAffichageVariablesSession').click(function(){

				// Msg chargement
				$("#agpmOutilsDevMessage").html("Affichage variables session en cours ..."); 
				
				// Ajax
				var html = $.ajax({
					url: "/communs/ajax/afficherVariablesSession.php",
					async: false
					}).responseText;

				$("#agpmOutilsDevMessage").html(html); 
				
				});

			// Bouton affichage de la config (AgpmConfig)
			// ------------------------------------------
			$('#agpmAffichageConfig').click(function(){

				// Msg chargement
				$("#agpmOutilsDevMessage").html("Affichage config en cours ..."); 
				
				// Ajax
				var html = $.ajax({
					url: "/communs/ajax/afficherConfig.php",
					async: false
					}).responseText;

				$("#agpmOutilsDevMessage").html(html); 

				});

			// Bouton affichage de la config (AgpmConfig)
			// ------------------------------------------
			$('#agpmAffichagePub').click(function(){

				// Msg chargement
				$("#agpmOutilsDevMessage").html("Affichage config en cours ..."); 
				
				// Ajax
				var html = $.ajax({
					url: "/communs/ajax/afficherPubs.php",
					async: false
					}).responseText;

				$("#agpmOutilsDevMessage").html(html); 

				});
				
				
			// Bouton affichage du sitemap (AgpmConfig)
			// ------------------------------------------
			$('#agpmAffichageSiteMap').click(function(){

				// Msg chargement
				$("#agpmOutilsDevMessage").html("Affichage Sitemap en cours ..."); 
				
				// Ajax
				var html = $.ajax({
					data : "site=FREX",
					url: "/communs/ajax/genererSiteMap.php",
					async: false
					}).responseText;

				$("#agpmOutilsDevMessage").html(html); 

				});

			// Bouton de affichage des donnees en session
			// ------------------------------------------
			$('#agpmCacherOutilsDev').click(function(){
				$("#agpmOutilsDev").hide();
				});

		});

		// Fonction lien vers un onglet
		// ----------------------------
		function lienVersOnglet ( idJeuOnglets , indexOnglet ){
			var tabs = $("#" + idJeuOnglets ).tabs();
			tabs.tabs('select', eval(indexOnglet));
			}
