function verifierLongueur(champ, decompte, nbMax) 
	{
		if (champ.value.length > nbMax)
			{
				champ.value = champ.value.substring(0, nbMax);
			}
		else
			{
				decompte.value = nbMax - champ.value.length;
			}
	}


function cacheCourriel()
{
	var alltags = document.all? document.all : document.getElementsByTagName("*");
	for (var i=0 ; i<alltags.length ; i++)
	{
		if (alltags[i].className.indexOf("cache-courriel") != "-1")
		{
			var oldText = alltags[i].firstChild;
			var emailAddress = alltags[i].firstChild.nodeValue;
			var user = emailAddress.substring(0, emailAddress.indexOf("("));
			if (user =="farf.and.wham")
				{
					var newText = "farf.and.wham@gmail.com";
					var node = "Farf and Wham Creation";
					var a = document.createElement("a");
					a.href = "mailto:"+newText;
					a.title = "Contact par e-mail";
					var address = document.createTextNode(node);
					a.appendChild(address);
					alltags[i].replaceChild(a,oldText);
				}
			else
				{
					var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
					var newText = user+"@"+website;
					var a = document.createElement("a");
					a.href = "mailto:"+newText;
					a.title = "Contact par e-mail";
					var address = document.createTextNode(newText);
					a.appendChild(address);
					alltags[i].replaceChild(a,oldText);
				}
		}
	}
}
window.onload = function()
{
	if (!(document.createElement && document.getElementsByTagName))
	{
		return;
	}
	cacheCourriel();
}

function nouvelleFenetre(url)
{
propriete = "top=1%, left=25%, resizable=no, toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no"
propriete += ", width=" + 1010 + ", height=" + 520;
win = window.open(url,"fenetre",propriete)
}

function favoris(nomSite,adresse) {
	if (navigator.appName != 'Microsoft Internet Explorer' )
	{
		window.sidebar.addPanel(nomSite,adresse,"");
	}
	else {
		window.external.AddFavorite(adresse,nomSite);
	}
}



/*
Author: mg12
Update: 2008/11/21
Author URI: http://www.neoease.com/
*/
(function() {

function $(id) {
	return document.getElementById(id);
}

function setStyleDisplay(id, status) {
	$(id).style.display = status;
}

function goTop(acceleration, time) {
	acceleration = acceleration || 0.1;
	time = time || 16;

	var dx = 0;
	var dy = 0;
	var bx = 0;
	var by = 0;
	var wx = 0;
	var wy = 0;

	if (document.documentElement) {
		dx = document.documentElement.scrollLeft || 0;
		dy = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		bx = document.body.scrollLeft || 0;
		by = document.body.scrollTop || 0;
	}
	var wx = window.scrollX || 0;
	var wy = window.scrollY || 0;

	var x = Math.max(wx, Math.max(bx, dx));
	var y = Math.max(wy, Math.max(by, dy));

	var speed = 1 + acceleration;
	window.scrollTo(Math.floor(x / speed), Math.floor(y / speed));
	if(x > 0 || y > 0) {
		var invokeFunction = "MGJS.goTop(" + acceleration + ", " + time + ")"
		window.setTimeout(invokeFunction, time);
	}
}

function switchTab(showPanels, hidePanels, activeTab, activeClass, fadeTab, fadeClass) {
	$(activeTab).className = activeClass;
	$(fadeTab).className = fadeClass;

	var panel, panelList;
	panelList = showPanels.split(',');
	for (var i = 0; i < panelList.length; i++) {
		var panel = panelList[i];
		if ($(panel)) {
			setStyleDisplay(panel, 'block');
		}
	}
	panelList = hidePanels.split(',');
	for (var i = 0; i < panelList.length; i++) {
		panel = panelList[i];
		if ($(panel)) {
			setStyleDisplay(panel, 'none');
		}
	}
}

window['MGJS'] = {};
window['MGJS']['$'] = $;
window['MGJS']['setStyleDisplay'] = setStyleDisplay;
window['MGJS']['goTop'] = goTop;
window['MGJS']['switchTab'] = switchTab;

})();

function switchImage(imageId, imageUrl, linkId, linkUrl, preview, title, alt) {
	if(imageId && imageUrl) {
		var image = $(imageId);
		image.src = imageUrl;

		if(title) {
			image.title = title;
		}
		if(alt) {
			image.alt = alt;
		}
	}

	if(linkId && linkUrl) {
		var link = $(linkId);
		link.href = linkUrl;
	}
}

//Variables nécessaires aux trois fonctions suivantes sur la taille des fonts
var min=50;
var max=200;
var norm=100;

function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("%",""));
      } else {
         var s = 100;
      }
      if(s!=max) {
         s += 10;
      }
      p[i].style.fontSize = s+"%"
   }

   var h = document.getElementsByTagName('h2');
   for(i=0;i<h.length;i++) {
      if(h[i].style.fontSize) {
         var size = parseInt(h[i].style.fontSize.replace("%",""));
      } else {
         var size = 150;
      }
      if(size!=(max+50)) {
         size += 10;
      }
      h[i].style.fontSize = size+"%"
   }
}

function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("%",""));
      } else {
         var s = 100;
      }
      if(s!=min) {
         s -= 10;
      }
      p[i].style.fontSize = s+"%"
   }

   var h = document.getElementsByTagName('h2');
   for(i=0;i<h.length;i++) {
      if(h[i].style.fontSize) {
         var size = parseInt(h[i].style.fontSize.replace("%",""));
      } else {
         var size = 150;
      }
      if(size!=(min+50)) {
         size -= 10;
      }
      h[i].style.fontSize = size+"%"
   }
}

function normalizeFontSize() {
	var p = document.getElementsByTagName('p');
	for(i=0;i<p.length;i++) {
	      if(p[i].style.fontSize) {
	         var s = parseInt(p[i].style.fontSize.replace("%",""));
	      } else {
	         var s = norm;
	      }
	      if(s!=norm) {
	         s = norm;
	      }
	      p[i].style.fontSize = s+"%"
	   }

	   var h = document.getElementsByTagName('h2');
	   for(i=0;i<h.length;i++) {
	      if(h[i].style.fontSize) {
	         var size = parseInt(h[i].style.fontSize.replace("%",""));
	      } else {
	         var size = norm + 50;
	      }
	      if(size!=norm) {
	         size = norm + 50;
	      }
	      h[i].style.fontSize = size+"%"
	   }
}