
    // RS >> ajax menu loader
    function LoadMenu()
    {
       jQuery.ajax({
          url: '/sites/module/ajax/getTopMenu.php',
          data: "id_doc=" + jQuery("body").attr("currentDocId"),
          cache: false,
          async: false,       
          success: function(response) {
            //alert(response);
            jQuery('#menu_accueil').html(response);
          }
        });        
    }
    // RS >> ajax last subscribers loader
    function LoadLastSubscribers()
    {
        jQuery.ajax({
          url: '/sites/module/ajax/getLastSubscribers.php',
          data: "id_doc=" + jQuery("body").attr("currentDocId") + "&nb_abonnes=8",
          cache: false,
          async: false,       
          success: function(response) {
            //alert(response);
            jQuery('#last_subscribers').html(response);
            SexyLightbox.refresh();
          }
        });
    }
    
    
    jQuery.noConflict();
    
    jQuery(document).ready(function(){
    
    	//*** FUNCTIONS ****
    	
	    function ResizeSiteHeight()
	    {
   	        if  (document.body.clientWidth < 1000)
   	        	{
   	        	jQuery("#page").css("left", "0px");
   	        	jQuery("#page").css("marginLeft", "0px");    	        	    
   	        	}	    
	    
	        // handle bottom div
	        var hauteur_max = Math.max(jQuery("#leftColumn").outerHeight(), jQuery("#content").outerHeight());            
	        hauteur_max += 172;            
	        jQuery("#footer").css("top", hauteur_max);        
	        jQuery("#page").css("visibility", "visible");
	        
	        if (jQuery("#div_localisation") != null)
	            jQuery("#div_localisation").css("visibility", "visible"); 
	        
	        jQuery("#footer").css("visibility", "visible");
	        
	    }	    
	    
	    function HideBottom()
	    {
	        // handle bottom div
	        jQuery("#footer").css("visibility", "hidden");        
	    }
	    
    	
        ResizeSiteHeight();
        
        
        // site effects
        
        jQuery("#cgv_div .cgv_title").click(function(){      
        
	        jQuery("#footer").css("visibility", "hidden");
	        
	        if (jQuery(this).parent().css("height") == "1500px")
	        {
	            jQuery(this).parent().animate({ height: "200px" }, 1000, function() {
                    ResizeSiteHeight();
                    jQuery("#footer").css("visibility", "visible");
                });
	        }
	        else
	        {
		        jQuery(this).parent().animate({ height: "1500px" }, 1000, function() {
				    ResizeSiteHeight();
				    jQuery("#footer").css("visibility", "visible");
				});
			}	        
	    });
        
        
        
        // initialize LightBox  
        SexyLightbox.initialize({
		    find          : 'sexylightbox', // rel="sexylightbox"
		    color         : 'orange',
		    dir           : '/sites/templates/images/lightBox_images/',
		    imagesdir     : '/sites/templates/images/lightBox_images/',
		    emergefrom    : 'top',
		    OverlayStyles : {
		      'background-color': '#000',
		      'opacity' : 0.5
		    }
		});
		
		
		//*** LOAD MENU ****        
        LoadMenu();
        
        //*** LOAD LAST SUBSCRIBERS ****
        LoadLastSubscribers();
        
        // checkboxes
        //jQuery('#form_recherche input:checkbox').checkbox({cls:'jquery-dark-checkbox'});
        //jQuery('#form_recherche input:radio').checkbox({cls:'jquery-dark-checkbox'});  
        
        
	    jQuery('.calendar').datepicker({ 
	        buttonImage: '/sites/module/img/ico_cal.png',
	        dateFormat: 'dd/mm/yy', 
	        dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], 
	        showOn: 'both',
	        changeMonth: true,
	        changeYear: true,
	        firstDay: 1,
	        yearRange: '-50:1',
	        buttonImageOnly: true,
	        monthNames: ['Janvier','Fevrier','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','Decembre'],
	        monthNamesShort: [ 'Janv','Fév','Mars','Avril','Mai','Juin','Juil','Aout','Sept','Oct','Nov','Déc']
	    });
	    //jQuery('.calendar_heure').datetimepicker();
	   /* jQuery('.calendar_heure').datetimepicker({ 
	        buttonImage: '/sites/module/img/ico_cal.png',
	        dateFormat: 'dd/mm/yy hh:mm:ss', 
	        dayNamesMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], 
	        showOn: 'both',
	        changeMonth: true,
	        changeYear: true,
	        firstDay: 1,
	        yearRange: '-50:1',
	        buttonImageOnly: true,
	        monthNames: ['Janvier','Fevrier','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','Decembre'],
	        monthNamesShort: [ 'Janv','Fév','Mars','Avril','Mai','Juin','Juil','Aout','Sept','Oct','Nov','Déc']
	    });*/
        
        
        
    
	    /* PLACEMENT DU DIV DE LOCALISATION VILLE ET PAYS*/
	    /*var inputNomLocalisationTop = jQuery("#input_nom_pays").offset().top + 18;
	    jQuery("#div_sel_pays").css("top", inputNomLocalisationTop + "px");
	    var inputNomLocalisationLeft = jQuery("#input_nom_pays").offset().left - 3;
	    jQuery("#div_sel_pays").css("left", inputNomLocalisationLeft + "px");
	    
	    inputNomLocalisationTop = jQuery("#input_nom_ville").offset().top + 18;
	    jQuery("#div_sel_villes").css("top", inputNomLocalisationTop + "px");
	    inputNomLocalisationLeft = jQuery("#input_nom_ville").offset().left - 3;
	    jQuery("#div_sel_villes").css("left", inputNomLocalisationLeft + "px");*/
	    
	    
	    jQuery('.user_exp_zone').each(function (index) {
	        var divHeight = jQuery(this).height();
	        var divWidth = jQuery(this).width();	        
	        if (divHeight > 90)
	        {
	           jQuery(this).attr("title", "Cliquez pour voir la description complète");
	           jQuery(this).css("height", "110px");
	           jQuery(".desc", this).css("height", "90px");
	           jQuery(".desc", this).css("overflow", "hidden");
	           jQuery(this).css("cursor", "pointer");
	           jQuery(".link_fulldesc", this).css("display", "block");
	           jQuery(".link_fulldesc", this).css("width", divWidth + "px");
	           ResizeSiteHeight();
	           
	           jQuery(this).click(function (i) {
	               if (jQuery(this).css("height") == divHeight + "px")
	               {		               
		               jQuery(this).animate({ height: "110px" }, 1000, function() {                
			                jQuery(".desc", this).css("height", "90px");
			                jQuery(".link_fulldesc", this).css("display", "block");
			                jQuery(this).attr("title", "Cliquez pour voir la description complète");
			                ResizeSiteHeight();
			           });
			       }
			       else
			       {
			           jQuery(".link_fulldesc", this).css("display", "none");
			           jQuery(".desc", this).css("height", divHeight + "px");
			           jQuery(this).attr("title", "Cliquez pour réduire la description complète");
			           jQuery(this).animate({ height: divHeight + "px" }, 1000, function() {                
                            ResizeSiteHeight();        
                       });
			       }	               
	           });
	        }
	    });
	    
	    
	    /* FOND DES LIGNES DU TABLEAU PROFIL */    
	    jQuery('.rounded_tables tr').each(function (i) {
	        if (i%2 != 0) {
	        	jQuery("td", this).css("background-color", "#f9fccd");
	        }   
	    });
		
		
		/*
		*
		* ARTICLES
		*
		*
		*/
        
        jQuery(".summaryPost .title, .summaryPost .bt_fulldesc").click(function () {
        	var docid = jQuery(this).parent().attr("article");
        	if (jQuery("#brut_" + docid).css("display") == "block") 	
        		jQuery("#brut_" + docid).click();
        	else
        		jQuery("#plain_" + docid).click();
        });
        
        jQuery(".summaryPost .contentPostBrut").each(function (i) {
        	jQuery(this).html(jQuery(this).text());
        	
        	var docid = jQuery(this).parent().attr("article");
        	
        	var divHeight = jQuery(this).height();
	        var divWidth = jQuery(this).width();	        
	        
           jQuery(this).attr("title", "Cliquez pour voir la description complète");
           jQuery(this).css("height", "55px");
           jQuery(this).css("overflow", "hidden");
           jQuery(this).css("cursor", "pointer");
           ResizeSiteHeight();
           
           jQuery(this).click(function () {               
               HideBottom();               
               if (jQuery(this).css("height") !== divHeight + "px")               
		       {
		           jQuery(this).css("display", "none");
		           jQuery("#plain_" + docid).css("display", "block");
		           jQuery("#plain_" + docid).attr("title", "Cliquez pour réduire la description");
		           
		           jQuery("#btn_" + docid).html("<img src='/sites/templates/images/bt_toggle_article_hide.gif' title='Réduire la description complète' />");
		           
		           ResizeSiteHeight();
		       }	               
           });
           
           jQuery("#plain_" + docid).click(function () {
           	   HideBottom();
           	   jQuery("#brut_" + docid).css("display", "block");
	           jQuery("#plain_" + docid).css("display", "none");
	           
	           jQuery("#btn_" + docid).html("<img src='/sites/templates/images/bt_toggle_article_show.gif' title='Cliquez pour voir la description complète' />");
	           
	           ResizeSiteHeight();
           });
	        
        	
        });
        
       
	    
	  
    
		
		
		
		
		
		
    });
    
    