
function addToFavorite() {


if (window.sidebar) { // Mozilla Firefox Bookmark		
    window.sidebar.addPanel(document.title, url,"");	
} else if( window.external ) { // IE Favorite	
    window.external.AddFavorite( window.location.href, document.title); 

} else if(window.opera && window.print) { // Opera Hotlist		
    return true; }
} 












function sendByMail() {
        var sendMailString = 'mailto:';
        sendMailString += '?subject= ' + encodeURIComponent( document.title );
        sendMailString += '&body= Un amis vous recommande la page suivante : ' + encodeURIComponent( document.title );
        sendMailString += '. Cette dernière est consultable à l\'adresse suivante : ' + encodeURIComponent(window.location.href);
        location.href (sendMailString);

	}	



var init = 1; // taille initiale du body		
var style_cookie_name = "style" ;
var style_cookie_duration = 30 ;		
		
		
		function NewCookie(nom,contenu,jours) //Nouveau cookie
		{
			var expireDate = new Date();
			expireDate.setTime(expireDate.getTime() + jours*24*3600*1000);
			document.cookie = nom + "=" + escape(contenu) + ";expires=" + expireDate.toGMTString() + ";path=/";
		}
                
                
                

		function getCookieVal(offset) //Utilisé par LireCookie - découpage de chaine
		{
			var endstr=document.cookie.indexOf (";", offset);
			if (endstr==-1) endstr=document.cookie.length;
			return unescape(document.cookie.substring(offset, endstr));
		}

	 
		function LireCookie(nom) //Recupere une valeur dans un cookie
		{
			var arg=nom+"=";
			var alen=arg.length;
			var clen=document.cookie.length;
			var i=0;
			while (i<clen)
			{
				var j=i+alen;
				if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
				i=document.cookie.indexOf(" ",i)+1;
				if (i==0) break;
			}
			return null;
		}
                
                
                
                


function Chargement() //Charge l'attribut du cookie ou le definit
{
          
          //Couleur
          var currentstyle = LireCookie(style_cookie_name);
          if(currentstyle == null) {
    		NewCookie(style_cookie_name, "white",style_cookie_duration );
          }
          set_style_from_cookie();
			
		
                
        //Taille       
        var UserTaille = LireCookie('taille');
        if(UserTaille == null)
        {
                UserTaille = init;
        }
        ApplyStyle(UserTaille);

}	  
	  
	  
function ApplyStyle(DefineTaille) //Applique le style / paramètre : taille à appliquer
{
        document.getElementsByTagName("body")[0].style.fontSize = DefineTaille + "em";		
}
		
		
function ChangeTaille(sens) //Action sur le bouton A+ ou A- / paramètre : '+' ou '-'
{
        if(sens == '+')
        {

                var UserTaille = LireCookie('taille');
                if(UserTaille == null)
                {
                        UserTaille = init;
                }
                UserTaille = eval(UserTaille) + 0.1;
                NewCookie('taille',UserTaille,'1');

        }
        else //sens = '-'
        {
                var UserTaille = LireCookie('taille');
                if(UserTaille == null)
                {
                        UserTaille = init;
                }
                UserTaille = eval(UserTaille) - 0.1;
                NewCookie('taille',UserTaille,'1');
        }

        Chargement();
}
                
                
                
function set_style_from_cookie()
{
      var css_title = LireCookie( style_cookie_name );
      if (css_title.length) {
        switch_style( css_title );
        }
}


function ChangeStyle() {
    

 var css_title = LireCookie( style_cookie_name );
 
if (css_title.length && (css_title== "white")) {
    switch_style( "black" );

}

if (css_title.length && (css_title == "black")) {
    switch_style( "white" );
}
 Chargement();
    
}


function ChangeCouleur() {
    var UserTaille = LireCookie('taille');
    
}

