function isEmail(string){
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function validerFormulaire(){

var obj=document.getElementById("formDiffere");
var ok = true;

if (obj.nomprenom.value=="" || obj.nomprenom.value=="Nom Prenom"){
  ok=false;
	alert("Le champ 'nom prénom' doit être renseigné.");
	obj.nomprenom.value = '';
	obj.nomprenom.focus();
  return ok;
}

if (obj.mail.value=="" || obj.mail.value=="Adresse email"){
  ok=false;
	alert("Le champ 'adresse mail' doit être renseigné.");
	obj.mail.value = '';
	obj.mail.focus();
  return ok;
}

if (!isEmail(obj.mail.value)){
  ok=false;
	alert("L'adresse mail est incorrect.");
	obj.mail.focus();
  return ok;
}

if (obj.codepostal.value=="" || obj.codepostal.value=="Code postal"){
  ok=false;
	alert("Le champ 'code postal' doit être renseigné.");
	obj.codepostal.value = '';
	obj.codepostal.focus();
  return ok;
}

if (obj.numtel.value=="" || obj.numtel.value=="Tel"){
  ok=false;
	alert("Le champ 'téléphone' doit être renseigné.");
	obj.numtel.value = '';
	obj.numtel.focus();
  return ok;
}


return ok;
}

try { window.onload = function (){loadEventAppel();} }
catch(e) { window.attachEvent('onload', loadEventAppel); }

function loadEventAppel()
{
	addEventById ('contact-immediat', 'mouseover', onContactImmediat);
	addEventById ('contact-immediat', 'mouseout', offContactImmediat);
	
	try
	{
		var obj = document.getElementById("formDiffere");
		addEventByObj (obj.nomprenom, 'click', clickFormDiffereNom);
		addEventByObj (obj.mail, 'click', clickFormDiffereMail);
		addEventByObj (obj.codepostal, 'click', clickFormDiffereCodePostal);
		addEventByObj (obj.numtel, 'click', clickFormDiffereNumTel);
		addEventByObj (obj.precission, 'click', clickFormDifferePrecission);
		
		var obj = document.getElementById("div-contact-immediat");
		obj.style.display = "none";
				
		var obj = document.getElementById("contactez-nous");
		if (ie4)
			obj.style.left = getLeft(document.getElementById('contact-immediat'))-15;
		else
			obj.style.left = getLeft(document.getElementById('contact-immediat'))-15 + "px";
		
	}catch(e){}
	
	loadEvents();
}

function goToContact()
{
	window.location="#haut-appel";
	var obj = document.getElementById("formDiffere");
	obj.nomprenom.value="";
	obj.nomprenom.focus();
}

function clickFormDiffereNom()
{
	var obj = document.getElementById("formDiffere");
	if(obj.nomprenom.value=='Nom Prenom')
		obj.nomprenom.value='';
}

function clickFormDiffereMail()
{
	var obj = document.getElementById("formDiffere");
	if(obj.mail.value=='Adresse email')
		obj.mail.value='';
}

function clickFormDiffereCodePostal()
{
	var obj = document.getElementById("formDiffere");
	if(obj.codepostal.value=='Code postal')
		obj.codepostal.value='';
}

function clickFormDiffereNumTel()
{
	var obj = document.getElementById("formDiffere");
	if(obj.numtel.value=='Tel')
		obj.numtel.value='';
}

function clickFormDifferePrecission()
{
	var obj = document.getElementById("formDiffere");
	if(obj.precision.value=="Pr&eacute;cisions concernant vos besoins ou horaires d'appels...")
		obj.precision.value='';
}

function openBandeau()
{
	var obj = document.getElementById("div-bandeau");
	obj.style.display = "";
		
	if (ie4)
    {
        obj.style.left = getLeft(document.getElementById('bandeau'))-475;
		obj.style.top = getTop(document.getElementById('bandeau'))-220;
    }
    else
    {
        obj.style.left = getLeft(document.getElementById('bandeau'))-475 + "px";
		obj.style.top = getTop(document.getElementById('bandeau'))-220 + "px";
    }
}


function closeBandeau()
{
	var obj = document.getElementById("div-bandeau");
	obj.style.display = "none";
}

function openPopupAppel()
{
	var obj = document.getElementById("div-contact-immediat");
	obj.style.display = "";
		
	if (ie4)
    {
        obj.style.left = getLeft(document.getElementById('contact-immediat'))-475;
		obj.style.top = getTop(document.getElementById('contact-immediat'))-220;
    }
    else
    {
        obj.style.left = getLeft(document.getElementById('contact-immediat'))-475 + "px";
		obj.style.top = getTop(document.getElementById('contact-immediat'))-220 + "px";
    }
}


function onContactImmediat()
{
	var obj = document.getElementById("contact-immediat");
	obj.src="http://www.ifb-france.net/images/appel/contact_on.gif";
}

function offContactImmediat()
{
	var obj = document.getElementById("contact-immediat");
	obj.src="http://www.ifb-france.net/images/appel/contact_off.gif";
}

