// JavaScript Document
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  fFormulaire();
});


function fFormulaire()
{
	document.getElementById("email").onclick=function()
	{
		if(this.value=="mon e-mail") this.value="";
	}
	
	document.getElementById("email2").onclick=function()
	{
		if(this.value=="mon e-mail") this.value="";
	}
	
	document.getElementById("formulaire").onsubmit=function()
	{
		//alert(document.getElementById('nom').value);
		return CheckInput();
	}
}

function CheckInput()
{
	if(document.getElementById('email').value=="")
	{
		alert('Veuillez indiquer votre adresse e-mail');
		return false;
	}
	else
	{
		if(document.getElementById('email').value.indexOf("@")==-1 || document.getElementById('email').value.indexOf(".")==-1)
		{
			alert("Merci de vérifier la syntaxe de votre adresse e-mail.");
			return false;
		}
	} 
}

//addLoadEvent(nameOfSomeFunctionToRunOnsPageLoad);
addLoadEvent(function(){fFormulaire();});


