	var regExpBeginning = /^\s+/;
	var regExpEnd = /\s+$/; 

	function index_mouseover(me){
		if(context==0 && curent_button!=me.id){
			me.style.color='#FF9933';
			me.style.backgroundColor='#333333';
			me.style.textDecoration='underline';
		}
		document.getElementById('p' + me.id).innerHTML = '&bull;';
	}
	
	function index_mouseout(me){
		if(context==0 && curent_button!=me.id){
			me.style.backgroundColor='';
			me.style.textDecoration='none';
		}
		if(curent_button!=me.id)document.getElementById('p' + me.id).innerHTML = '&nbsp;';
	}
	
	function trim(aString) {
		return aString.replace(regExpBeginning, "").replace(regExpEnd, "");
	}
	
	function ltrim(aString) {
	    return aString.replace(regExpBeginning, "");
	}

	function rtrim(aString) {
	    return aString.replace(regExpEnd, "");
	}

	function valid_form_contact(){
		if(trim(document.getElementById("message").value) != ""){
			var retour = file("php/contact_send.php?session_id="+document.getElementById("session_id").value+"&code="+document.getElementById("code").value+"&mail="+document.getElementById("mail").value+"&message="+document.getElementById("message").value,"POST");
			
			if(retour==1){
				document.getElementById('contenu').innerHTML = "<center><br /><br /><br /><br /><br /><br /><h2>Votre Message est bien envoy&eacute;,<br /><br /><b> Merci !</b></h2><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></center>";
			}else{
				if(retour==2){
					alert("Problme d'envoi de votre message. Veuillez essayer ultrieurement. Merci.");
				}else{
					alert("Le code que vous avez saisi n'est pas le bon !");
				}
			}
		}else{
			alert("Veuillez saisir votre message.");
		}
	}
	
	function unconnect(session_id){
		var retour = file("?action_form=unconnect&session_id=" + session_id);
		
		if(retour==1){
			document.location  = "index.php";
		}else{
			alert("Vous etes deja deconnecte.");
		}
	}
	
	function valid_connect(){
		var retour = file("php/ident.php?user="+Base64._utf8_encode(Base64.encode(document.getElementById("user").value))+"&passwd="+Base64._utf8_encode(Base64.encode(document.getElementById("passwd").value)),"POST");
		
		if(retour==1){
			Modalbox.hide();
			document.location  = "index.php";
		}else{
			alert("Identifiant ou mot de passe incorrect.");
		}
	}
	
	function connect_back_office(){
		Modalbox.show("php/ctbo.php", {title: "CONNEXION", height: 250}); return false;
	}

	function plan_site(){
		Modalbox.show("php/plan.php", {title: "PLAN DU SITE", height: 350}); return false;
	}
	
	function mentions_legales(){
		Modalbox.show("php/mentions.php", {title: "MENTIONS LEGALES ", height: 350}); return false;
	}

	function select_gal(gal_select,legende,src){
			if(gal_select.style.color!='#ff1111'){

				document.getElementById('gal1').style.color    = '';
				document.getElementById('gal2').style.color    = '';
				document.getElementById('gal3').style.color    = '';
				document.getElementById('gal11').style.color   = '';
				document.getElementById('gal12').style.color   = '';
				document.getElementById('gal13').style.color   = '';

				document.getElementById('gal1').style.cursor   = 'hand';
				document.getElementById('gal2').style.cursor   = 'hand';
				document.getElementById('gal3').style.cursor   = 'hand';
				document.getElementById('gal1').style.cursor   = 'pointer';
				document.getElementById('gal2').style.cursor   = 'pointer';
				document.getElementById('gal3').style.cursor   = 'pointer';

				document.getElementById('gal11').style.cursor  = 'hand';
				document.getElementById('gal12').style.cursor  = 'hand';
				document.getElementById('gal13').style.cursor  = 'hand';
				document.getElementById('gal11').style.cursor  = 'pointer';
				document.getElementById('gal12').style.cursor  = 'pointer';
				document.getElementById('gal13').style.cursor  = 'pointer';

				gal_select.style.color                         = '#ff1111';
				gal_select.style.cursor                        = 'default';
				gal_select.style.backgroundColor               = '';
				document.getElementById('legend_ct').innerHTML = legende;
				get_page_contenu(src);
			}
	}

	function gal_over(gal_select){
	    	if(navigator.appName!="Netscape"){
		    	if(gal_select.style.color!= '#ff1111'){
		    		gal_select.style.backgroundColor = '#770000';
		    	}else{
		    		gal_select.style.cursor = 'default';
		    	}
	    	}else{
	    		if(gal_select.style.color!= 'rgb(255, 68, 68)'){
		    		gal_select.style.backgroundColor = '#770000';
		    	}else{
		    		gal_select.style.cursor = 'default';
		    	}
	    	}
	}

	function init_contenu(page_name,link_name){
      	document.location='http://www.jeanfourton.com/index.html?page_name=' + page_name + '&link_name=' + link_name;
	}

	//*** INITIALISATION ***************************************************************************************************
	function init(){

		  var nom    = new Array();
	      var valeur = new Array();
	      link_name  = "";
	      page_name  = "";
	
	      param = window.location.search.slice(1,window.location.search.length);
	
	      first = param.split("&");
	
	      for(i=0;i<first.length;i++){
	          second = first[i].split("=");
	          nom[i] = second[0];
	          valeur[i] = second[1];
	          if(second[0]=="page_name")page_name = second[1];
	          if(second[0]=="link_name")link_name = second[1];
	      }

		  if(navigator.appName!="Netscape"){
				//document.getElementById('blank_top').style.height="27px";
				//document.getElementById('fcontenu').style.width="98%";

				//document.getElementById('gal1').stylecursor="hand";
				//document.getElementById('gal2').stylecursor="hand";
				//document.getElementById('gal3').stylecursor="hand";

				document.getElementById('b_biographie').style.cursor       = "hand";
				document.getElementById('b_textes_critiques').style.cursor = "hand";
				document.getElementById('b_ndrs').style.cursor             = "hand";
				document.getElementById('b_tenebre').style.cursor          = "hand";
				document.getElementById('b_margelay').style.cursor         = "hand";
				document.getElementById('b_thumbs').style.cursor           = "hand";
				document.getElementById('b_adagp').style.cursor            = "hand";
				document.getElementById('b_contact').style.cursor          = "hand";
			}else{
				//document.getElementById('blank_top').style.height="27px";
				//document.getElementById('fcontenu').style.width="98%";
				document.getElementById('b_biographie').style.cursor       = "pointer";
				document.getElementById('b_textes_critiques').style.cursor = "pointer";
				document.getElementById('b_ndrs').style.cursor             = "pointer";
				document.getElementById('b_tenebre').style.cursor          = "pointer";
				document.getElementById('b_margelay').style.cursor         = "pointer";
				document.getElementById('b_thumbs').style.cursor           = "pointer";
				document.getElementById('b_adagp').style.cursor            = "pointer";
				document.getElementById('b_contact').style.cursor          = "pointer";
			}
			document.getElementById('biographie_link').href         = "javascript:if(curent_button!='b_biographie')get_page_contenu('biographie.php','b_biographie')";
			document.getElementById('textes_critiques_link').href   = "javascript:if(curent_button!='b_textes_critiques')get_page_contenu('textes_critiques.htm','b_textes_critiques')";
			document.getElementById('ndrs_link').href               = "javascript:if(curent_button!='b_ndrs')get_page_contenu('ndrs.htm','b_ndrs')";
			document.getElementById('tenebre_link').href            = "javascript:if(curent_button!='b_tenebre')get_page_contenu('tenebre.htm','b_tenebre')";
			document.getElementById('margelay_link').href           = "javascript:if(curent_button!='b_margelay')get_page_contenu('margelay.htm','b_margelay')";
			document.getElementById('thumbs_link').href             = "javascript:if(curent_button!='b_thumbs')get_page_contenu('thumbs/index.html','b_thumbs');";
			document.getElementById('gadagp_link').href             = "javascript:if(curent_button!='b_adagp')get_page_contenu('gadagp.htm','b_adagp')";
			document.getElementById('contact_link').href            = "javascript:if(curent_button!='b_contact')get_page_contenu('contact.php','b_contact')";

			document.getElementById('b_biographie').innerHTML       = "&nbsp;Biographie de l'artiste";
			document.getElementById('b_textes_critiques').innerHTML = "&nbsp;Textes critiques";
			document.getElementById('b_ndrs').innerHTML             = "&nbsp;Le Noeud de Raison";
			document.getElementById('b_tenebre').innerHTML          = "&nbsp;La Galerie des T&eacute;n&egrave;bres";
			document.getElementById('b_margelay').innerHTML         = "&nbsp;Les vitraux du<br /><span style='margin-left:5px;'>Margeleix</span>";
			document.getElementById('b_thumbs').innerHTML           = "&nbsp;P&eacute;riode n&deg;5 <span class=\"txt9px\">et illustrations</span>";
			document.getElementById('b_adagp').innerHTML            = "&nbsp;La Galerie ADAGP";
			document.getElementById('b_contact').innerHTML          = "&nbsp;Contact";

			//reduction des sous-menu
			document.getElementById('cb_biographie').style.position="absolute";
			document.getElementById('cb_biographie').style.visibility="hidden";
			document.getElementById('cb_textes_critiques').style.position="absolute";
			document.getElementById('cb_textes_critiques').style.visibility="hidden";
			document.getElementById('cb_ndrs').style.position="absolute";
			document.getElementById('cb_ndrs').style.visibility="hidden";
			document.getElementById('cb_tenebre').style.position="absolute";
			document.getElementById('cb_tenebre').style.visibility="hidden";
			document.getElementById('cb_margelay').style.position="absolute";
			document.getElementById('cb_margelay').style.visibility="hidden";
			document.getElementById('cb_thumbs').style.position="absolute";
			document.getElementById('cb_thumbs').style.visibility="hidden";
			document.getElementById('cb_adagp').style.position="absolute";
			document.getElementById('cb_adagp').style.visibility="hidden";
			document.getElementById('cb_contact').style.position="absolute";
			document.getElementById('cb_contact').style.visibility="hidden";
			
			if(page_name!=""){
				setTimeout('get_page_contenu(\''+page_name+'\',link_name);document.getElementById(\'pb_'+get_buton_name(page_name)+'\').innerHTML = \'&bull;\';document.getElementById(\'b_'+get_buton_name(page_name)+'\').style.backgroundColor = \'#990000\';',1000);
		    }else{
		    	get_page_contenu('biographie.php','b_biographie');
		    	document.getElementById('pb_biographie').innerHTML = '&bull;';
		    	document.getElementById('b_biographie').style.backgroundColor = '#777777';
		    	document.getElementById('b_biographie').style.textDecoration = 'none';
		    	document.getElementById('cb_biographie').style.position="relative";
				document.getElementById('cb_biographie').style.visibility="visible";
		    }
			document.getElementById('cb_thumbs').style.position="absolute";
			document.getElementById('cb_thumbs').style.visibility="hidden";
			
			document.getElementById('contenu').allowtransparency="true";
	}
	
	function get_buton_name(page_name){
		switch (page_name){
			case 'contact.php':
				return 'contact';
				break;
			case 'biographie.php':
				return 'biographie';
				break;
			case 'textes_critiques.htm':
				return 'textes_critiques';
				break;
			case 'ndrs.htm':
				return 'ndrs';
				break;
			case 'tenebre.htm':
				return 'tenebre';
				break;
			case 'margelay.htm':
				return 'margelay';
				break;
			case 'thumbs/index.html':
				return 'thumbs';
				break;
			case 'gadagp.htm':
				return 'adagp';
				break;
			default:
				return 'biographie.php';
			break;
		}
	}

	function openGallerie(elem){
			var tenebre = window.open("http://jeanfourton.com/tenebre/main.html","Galerie","fullscreen");
			tenebre.focus();
			return(false);
	}

	function openGallerie_ndrs(elem){
   	  		var ndrs = window.open("http://jeanfourton.com/ndrs/index.htm","Le_Noeud_De_Raison","fullscreen=no,resizable=yes");
			ndrs.focus();
			return(false);
   	}

   	function writediv(texte,div,pere){
			eval(pere+'.getElementById(div).innerHTML = texte;');
	}

	function vb(){
			var C = null;
			try{
				C = new ActiveXObject("Msxml2.XMLHTTP")
			}catch(e){
				try{
					C = new ActiveXObject("Microsoft.XMLHTTP")
				}catch(sc){
					C = null
				}
			}
			if(!C&&typeof XMLHttpRequest!="undefined"){
				C = new XMLHttpRequest()
			}
			return C
	}

	function file(fichier,type){
			 if(!type) type = "GET";
			 xhr_object = vb()
		     xhr_object.open(type, fichier, false);
			 if(type=="POST"){
				 xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
				 xhr_object.send(fichier);
			 }else{
				 xhr_object.send(null);
			 }
		     if(xhr_object.readyState == 4) return(xhr_object.responseText);
		     else return(false);
	}

	last_button   = 0;
	curent_button = "";
	context       = 0;
	function get_page_contenu(page,button){			
		if(context==0 && button!= last_button){
			context = 1;
			document.getElementById(button).style.backgroundColor = '#443333';
			fadeout_JF('contenu',page,button);
		}
	}
	
	update = false;
	function get_page_contenu2(page,button){
		if(last_button!=button || update==true){				
			curent_button = button;
			//document.getElementById('contenu').innerHTML = "Veuillez patienter";
			document.getElementById('dwait').style.visibility = "visible";
			document.getElementById('contenu').style.heigt    = "450px";
			try{
				if(texte = file(page)){
					document.getElementById('contenu').innerHTML = stripslashes(texte);
					document.getElementById(button).style.color  = '#000000';						
					if(navigator.appName!="Netscape")document.getElementById(button).style.cursor = 'none';
					if(last_button){
						document.getElementById(last_button).style.color = '#FF9933';
						document.getElementById(last_button).style.backgroundColor = '';
						document.getElementById(last_button).style.cursor = 'pointer';
						document.getElementById('p' + last_button).innerHTML = '';
						document.getElementById('c' + last_button).style.position="absolute";
						document.getElementById('c' + last_button).style.visibility="hidden";
						if(navigator.appName!="Netscape"){
						  document.getElementById(last_button).style.cursor = 'hand';
						}else{
						  document.getElementById(last_button).style.cursor = 'pointer';
						}
					}
					document.getElementById(button).style.backgroundColor = '#777777';
					document.getElementById('p' + button).innerHTML = '&bull;';
					document.getElementById(curent_button).style.textDecoration = 'none';
					document.getElementById(curent_button).style.cursor = 'default';
					document.getElementById('c' + button).style.position="relative";
					document.getElementById('c' + button).style.visibility="visible";
					last_button = button;
				}
			}catch(ex){
				get_page_contenu('biographie.php','b_biographie');
		    	document.getElementById('pb_biographie').innerHTML = '&bull;';
		    	document.getElementById('b_biographie').style.backgroundColor = '#990000';
				//document.getElementById('contenu').innerHTML = "<br /><br /><p><font color=red><center><b>La page '" + page + "' est introuvable ou un probl&egrave;me de connexion en est peut-&ecirc;tre la cause.<br /><br />Si le probl&egrave;me persiste, merci de bien vouloir l'indiquer au <a href='mailto:info@jeanfourton.com'>webmaster</a>.</b></center></font></p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
			}
			document.getElementById('dwait').style.visibility = "hidden";
		}
		document.location='#top';
		setTimeout( "fadein_JF('contenu');",500);
	}

	function stripslashes(str){
			//str=str.replace(/\\'/g,'\'');
			//str=str.replace(/\\"/g,'"');
			str = str.replace(/\\\\/g,'\\');
			str = str.replace(/\\0/g,'');
			return str;
	}

	function addslashes(str){
			str = str.replace(/\'/g,'\\\'');
			str = str.replace(/\"/g,'\\"');
			str = str.replace(/\\/g,'\\\\');
			str = str.replace(/\0/g,'\\0');
			return str;
	}

	function open_url(url){
			var page_url;
			page_url = window.open(url,'Jean_Fourton');
			try{
				page_url.focus();
			}catch(ex){
			  alert('Une erreure est survenue lors de la tentative d\'ouverture de l\'URL.');
			}
	}
	
	function gradient_JF(id, level)
	{
		var box = document.getElementById(id);
		box.style.opacity = level;
		box.style.MozOpacity = level;
		box.style.KhtmlOpacity = level;
		//box.style.filter = "alpha(opacity=" + level+ ")";
		//box.style.filter ="progid:DXImageTransform.Microsoft.Alpha(Opacity=" + level+ ")";
		box.style.display="block";
		return;
	}
	
	function fadein_JF(id) 
	{
		var level = 0;
		while(level <= 1)
		{
			setTimeout( "gradient_JF('" + id + "'," + level + ")", (level* 300) + 10);
			level += 0.01;
		}
		context = 0;
		tb_init('a.thickbox, area.thickbox, input.thickbox');
		
		if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {
			jQuery(function(jquery) {
				jquery("a[rel^='lightbox']").slimbox({/* Put custom options here */}, null, function(el) {
					return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
				});
			});
		}
	}
	
	function fadeout_JF(id,page,button) 
	{
		var level = 1;
		while(level >0)
		{
			setTimeout( "gradient_JF('" + id + "'," + level + ")", ((1-level)*300) - 10);
			level -= 0.01;
		}
		setTimeout( "get_page_contenu2('" + page + "','" + button + "');",300);
	}
	
	var Base64 = {
			 
			// private property
			_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
		 
			// public method for encoding
			encode : function (input) {
				var output = "";
				var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
				var i = 0;
		 
				input = Base64._utf8_encode(input);
		 
				while (i < input.length) {
		 
					chr1 = input.charCodeAt(i++);
					chr2 = input.charCodeAt(i++);
					chr3 = input.charCodeAt(i++);
		 
					enc1 = chr1 >> 2;
					enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
					enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
					enc4 = chr3 & 63;
		 
					if (isNaN(chr2)) {
						enc3 = enc4 = 64;
					} else if (isNaN(chr3)) {
						enc4 = 64;
					}
		 
					output = output +
					this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
					this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
		 
				}
		 
				return output;
			},
		 
			// public method for decoding
			decode : function (input) {
				var output = "";
				var chr1, chr2, chr3;
				var enc1, enc2, enc3, enc4;
				var i = 0;
		 
				input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		 
				while (i < input.length) {
		 
					enc1 = this._keyStr.indexOf(input.charAt(i++));
					enc2 = this._keyStr.indexOf(input.charAt(i++));
					enc3 = this._keyStr.indexOf(input.charAt(i++));
					enc4 = this._keyStr.indexOf(input.charAt(i++));
		 
					chr1 = (enc1 << 2) | (enc2 >> 4);
					chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
					chr3 = ((enc3 & 3) << 6) | enc4;
		 
					output = output + String.fromCharCode(chr1);
		 
					if (enc3 != 64) {
						output = output + String.fromCharCode(chr2);
					}
					if (enc4 != 64) {
						output = output + String.fromCharCode(chr3);
					}
		 
				}
		 
				output = Base64._utf8_decode(output);
		 
				return output;
		 
			},
		 
			// private method for UTF-8 encoding
			_utf8_encode : function (string) {
				string = string.replace(/\r\n/g,"\n");
				var utftext = "";
		 
				for (var n = 0; n < string.length; n++) {
		 
					var c = string.charCodeAt(n);
		 
					if (c < 128) {
						utftext += String.fromCharCode(c);
					}
					else if((c > 127) && (c < 2048)) {
						utftext += String.fromCharCode((c >> 6) | 192);
						utftext += String.fromCharCode((c & 63) | 128);
					}
					else {
						utftext += String.fromCharCode((c >> 12) | 224);
						utftext += String.fromCharCode(((c >> 6) & 63) | 128);
						utftext += String.fromCharCode((c & 63) | 128);
					}
		 
				}
		 
				return utftext;
			},
		 
			// private method for UTF-8 decoding
			_utf8_decode : function (utftext) {
				var string = "";
				var i = 0;
				var c = c1 = c2 = 0;
		 
				while ( i < utftext.length ) {
		 
					c = utftext.charCodeAt(i);
		 
					if (c < 128) {
						string += String.fromCharCode(c);
						i++;
					}
					else if((c > 191) && (c < 224)) {
						c2 = utftext.charCodeAt(i+1);
						string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
						i += 2;
					}
					else {
						c2 = utftext.charCodeAt(i+1);
						c3 = utftext.charCodeAt(i+2);
						string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
						i += 3;
					}
		 
				}
		 
				return string;
			}
		 
		}
