// JavaScript Document
   function setCookie0(nom,contenu) {
      document.cookie = nom + "=" + escape(contenu)
      }
     
   function setCookie(nom,contenu,jours) {
      var expireDate = new Date();
      expireDate.setTime(expireDate.getTime() + jours*24*3600*1000);
      document.cookie = nom + "=" + escape(contenu)
         + ";expires=" + expireDate.toGMTString() + ";path=/";
      }
     

	function hasCookie(nom)	{
		return (getCookie(nom) != "");
	}

	function getCookie(nom) {
      var deb,fin
      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 ""
      }
     
   function unsetCookie(nom) { setCookie(nom,"",-1) }
   
	function putBackground( force ) {
		if( iBackgroundImage && !force ) { return true; }
		if( document.getElementById("background_link") == undefined ) return true;
		document.body.style.backgroundImage = urlBackgroundImage;
		setCookie( urlBackgroundImage, 1, 30 );
		
		

		if( linkBackgroundImage != "" ) {
			document.getElementById('background_link').onmouseover=function() {
				document.getElementById('background_link').style.border= "1px solid Gray";
			}
			document.getElementById('background_link').onmouseout=function() {
				document.getElementById('background_link').style.border= "0px solid Gray";
			}
		}

		if( linkBackgroundImage.indexOf( "http:" ) == 0 ) {
			document.getElementById('background_link').onclick=function() {
				window.open( linkBackgroundImage );
			}
		} else if( linkBackgroundImage.indexOf( "HTTP:" ) == 0 ) {
			document.getElementById('background_link').onclick=function() {
				window.open( linkBackgroundImage );
			}
		} else {
			document.getElementById('background_link').onclick=function() {
				document.location.href= linkBackgroundImage;
			}
		}
		
		document.body.style.backgroundRepeat = repeatBackgroundImage;
		if( colorBackgroundImage ) {
			document.body.style.backgroundColor = colorBackgroundImage;
		}
		iBackgroundImage = true;
		
	}
	
	function putBackgroundPage( id, urlBackgroundImagePage ) {
		if( iBackgroundImagePage ) { return true; }
		if( urlBackgroundImagePage != "" )	{
			document.getElementById( id ).style.backgroundImage = urlBackgroundImagePage;
			setCookie( "page=" + urlBackgroundImagePage, 1, 30 );
			document.getElementById( id ).style.backgroundRepeat = "no-repeat";
		}
		iBackgroundImagePage = true;
	}
	function putColorPage( id, colorBackgroundPage ) {
		if( colorBackgroundPage ) {
			document.getElementById( id ).style.backgroundColor = colorBackgroundPage;
		}
	}	
	
	function last_load() {
		putBackground( false );
	}

	function first_load() {
		if( getCookie( urlBackgroundImage ) == 1 ) {
			putBackground();
		}
	}
	
	urlBackgroundImage = false;
	colorBackgroundImage = false;
	linkBackgroundImage = "";	
	repeatBackgroundImage = "no-repeat";
	iBackgroundImage = false;
	iBackgroundImagePage = false;